You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2023/10/20 23:02:52 UTC
[superset] 05/09: fix: validation errors appearing after ssh tunnel switch (#24849)
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a0f5d89e2fd09bea315dd4a65092fb3b2edba89b
Author: Hugh A. Miles II <hu...@gmail.com>
AuthorDate: Wed Aug 2 17:41:37 2023 -0400
fix: validation errors appearing after ssh tunnel switch (#24849)
(cherry picked from commit b71541fb7fb1bdfd3e1eea59ee76de1f51e67e6b)
---
.../DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx | 3 +++
.../CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx | 4 ++++
.../src/views/CRUD/data/database/DatabaseModal/index.tsx | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx
index 7078b49cbc..7b52eab26c 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx
@@ -49,6 +49,7 @@ export const hostField = ({
onChange={changeMethods.onParametersChange}
/>
);
+
export const portField = ({
required,
changeMethods,
@@ -255,6 +256,7 @@ export const forceSSLField = ({
export const SSHTunnelSwitch = ({
isEditMode,
changeMethods,
+ clearValidationErrors,
db,
}: FieldPropTypes) => (
<div css={(theme: SupersetTheme) => infoTooltip(theme)}>
@@ -270,6 +272,7 @@ export const SSHTunnelSwitch = ({
value: changed,
},
});
+ clearValidationErrors();
}}
data-test="ssh-tunnel-switch"
/>
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx
index 5dce73206f..e747b3c895 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/index.tsx
@@ -79,6 +79,7 @@ export interface FieldPropTypes {
};
validationErrors: JsonObject | null;
getValidation: () => void;
+ clearValidationErrors: () => void;
db?: DatabaseObject;
field: string;
isEditMode?: boolean;
@@ -132,6 +133,7 @@ interface DatabaseConnectionFormProps {
onRemoveTableCatalog: (idx: number) => void;
validationErrors: JsonObject | null;
getValidation: () => void;
+ clearValidationErrors: () => void;
getPlaceholder?: (field: string) => string | undefined;
}
@@ -151,6 +153,7 @@ const DatabaseConnectionForm = ({
onRemoveTableCatalog,
sslForced,
validationErrors,
+ clearValidationErrors,
}: DatabaseConnectionFormProps) => (
<Form>
<div
@@ -179,6 +182,7 @@ const DatabaseConnectionForm = ({
},
validationErrors,
getValidation,
+ clearValidationErrors,
db,
key: field,
field,
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 97bd916fd6..63c38e3e10 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -267,7 +267,6 @@ export function dbReducer(
};
case ActionType.extraInputChange:
// "extra" payload in state is a string
-
if (
action.payload.name === 'schema_cache_timeout' ||
action.payload.name === 'table_cache_timeout'
@@ -1433,6 +1432,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
getValidation={() => getValidation(db)}
validationErrors={validationErrors}
getPlaceholder={getPlaceholder}
+ clearValidationErrors={() => setValidationErrors(null)}
/>
{db?.parameters?.ssh && (
<SSHTunnelContainer>{renderSSHTunnelForm()}</SSHTunnelContainer>