diff --git a/app/client/cypress/fixtures/saveAction.json b/app/client/cypress/fixtures/saveAction.json index e247df9ce532..e556089c53ad 100644 --- a/app/client/cypress/fixtures/saveAction.json +++ b/app/client/cypress/fixtures/saveAction.json @@ -25,7 +25,6 @@ } ], "authentication": { - "authenticationType": "dbAuth", "authenticationType": "dbAuth", "authType": "SCRAM_SHA_1", "username": "cypress-test", diff --git a/app/client/src/entities/Datasource/index.ts b/app/client/src/entities/Datasource/index.ts index 4088d906915c..e67626c2cdff 100644 --- a/app/client/src/entities/Datasource/index.ts +++ b/app/client/src/entities/Datasource/index.ts @@ -9,6 +9,7 @@ export interface DatasourceAuthentication { value?: string; addTo?: string; bearerToken?: string; + authenticationStatus?: string; } export interface DatasourceColumns { diff --git a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx index 5827a23a8be0..de553503d70f 100644 --- a/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx +++ b/app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx @@ -74,6 +74,12 @@ type DatasourceSaaSEditorProps = StateProps & type Props = DatasourceSaaSEditorProps & InjectedFormProps; +enum AuthenticationStatus { + NONE = "NONE", + IN_PROGRESS = "IN_PROGRESS", + SUCCESS = "SUCCESS", +} + const StyledButton = styled(Button)` &&&& { width: 180px; @@ -91,6 +97,15 @@ const EditDatasourceButton = styled(AdsButton)` } `; +const StyledAuthMessage = styled.div` + color: ${(props) => props.theme.colors.error}; + margin-top: 15px; + &:after { + content: " *"; + color: inherit; + } +`; + class DatasourceSaaSEditor extends JSONtoForm { componentDidMount() { super.componentDidMount(); @@ -131,6 +146,7 @@ class DatasourceSaaSEditor extends JSONtoForm { renderDataSourceConfigForm = (sections: any) => { const { + datasource, deleteDatasource, isDeleting, isSaving, @@ -141,6 +157,10 @@ class DatasourceSaaSEditor extends JSONtoForm { const params: string = location.search; const viewMode = new URLSearchParams(params).get("viewMode"); + const isAuthorized = + datasource?.datasourceConfiguration.authentication + ?.authenticationStatus === AuthenticationStatus.SUCCESS; + return (
{ @@ -152,6 +172,7 @@ class DatasourceSaaSEditor extends JSONtoForm { + {viewMode && ( { {!_.isNil(sections) ? _.map(sections, this.renderMainSection) : null} + {!isAuthorized && ( + Datasource not authorized + )} { } text="Delete" /> + { ); }} size="small" - text="Continue" + text={isAuthorized ? "Re-authorize" : "Authorize"} /> ) : ( - + <> + + {!isAuthorized && ( + Datasource not authorized + )} + )} );