diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
index c4f8e0379aafa..5b9c57a463876 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
@@ -210,19 +210,21 @@ const portField = ({
validationErrors,
db,
}: FieldPropTypes) => (
-
+ <>
+
+ >
);
const databaseField = ({
required,
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index 832cf03510771..6f106198676c5 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -56,6 +56,7 @@ import ExtraOptions from './ExtraOptions';
import SqlAlchemyForm from './SqlAlchemyForm';
import DatabaseConnectionForm from './DatabaseConnectionForm';
import {
+ antDErrorAlertStyles,
antDAlertStyles,
antDModalNoPaddingStyles,
antDModalStyles,
@@ -314,7 +315,7 @@ const DatabaseModal: FunctionComponent = ({
// Database fetch logic
const {
- state: { loading: dbLoading, resource: dbFetched },
+ state: { loading: dbLoading, resource: dbFetched, error: dbError },
fetchResource,
createResource,
updateResource,
@@ -641,6 +642,16 @@ const DatabaseModal: FunctionComponent = ({
setTabKey(key);
};
+ const errorAlert = () => (
+ antDErrorAlertStyles(theme)}
+ message="Missing Required Fields"
+ description="Please complete all required fields."
+ showIcon
+ />
+ );
+
const renderFinishState = () => {
if (!editNewDb) {
return (
@@ -876,6 +887,7 @@ const DatabaseModal: FunctionComponent = ({
onChange(ActionType.extraEditorChange, payload);
}}
/>
+ {dbError && errorAlert()}
@@ -1001,6 +1013,7 @@ const DatabaseModal: FunctionComponent = ({
/>
{/* Step 2 */}
+ {dbError && errorAlert()}
>
))}
>
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts
index ca1f8e0342daf..e784bf84b88be 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts
@@ -180,6 +180,27 @@ export const antDAlertStyles = (theme: SupersetTheme) => css`
}
`;
+export const antDErrorAlertStyles = (theme: SupersetTheme) => css`
+ padding: ${theme.gridUnit * 4}px;
+ margin: ${theme.gridUnit * 8}px ${theme.gridUnit * 4}px;
+ .ant-alert-message {
+ color: ${theme.colors.info.dark2};
+ font-size: ${theme.typography.sizes.s + 1}px;
+ font-weight: bold;
+ }
+ .ant-alert-description {
+ color: ${theme.colors.info.dark2};
+ font-size: ${theme.typography.sizes.s + 1}px;
+ line-height: ${theme.gridUnit * 4}px;
+ .ant-alert-icon {
+ margin-right: ${theme.gridUnit * 2.5}px;
+ font-size: ${theme.typography.sizes.l + 1}px;
+ position: relative;
+ top: ${theme.gridUnit / 4}px;
+ }
+ }
+`;
+
export const formHelperStyles = (theme: SupersetTheme) => css`
.required {
margin-left: ${theme.gridUnit / 2}px;