Skip to content

Commit

Permalink
fix: validation errors appearing after ssh tunnel switch (#24849)
Browse files Browse the repository at this point in the history
(cherry picked from commit b71541f)
  • Loading branch information
hughhhh authored and eschutho committed Oct 20, 2023
1 parent f3bb63b commit a0f5d89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const hostField = ({
onChange={changeMethods.onParametersChange}
/>
);

export const portField = ({
required,
changeMethods,
Expand Down Expand Up @@ -255,6 +256,7 @@ export const forceSSLField = ({
export const SSHTunnelSwitch = ({
isEditMode,
changeMethods,
clearValidationErrors,
db,
}: FieldPropTypes) => (
<div css={(theme: SupersetTheme) => infoTooltip(theme)}>
Expand All @@ -270,6 +272,7 @@ export const SSHTunnelSwitch = ({
value: changed,
},
});
clearValidationErrors();
}}
data-test="ssh-tunnel-switch"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface FieldPropTypes {
};
validationErrors: JsonObject | null;
getValidation: () => void;
clearValidationErrors: () => void;
db?: DatabaseObject;
field: string;
isEditMode?: boolean;
Expand Down Expand Up @@ -132,6 +133,7 @@ interface DatabaseConnectionFormProps {
onRemoveTableCatalog: (idx: number) => void;
validationErrors: JsonObject | null;
getValidation: () => void;
clearValidationErrors: () => void;
getPlaceholder?: (field: string) => string | undefined;
}

Expand All @@ -151,6 +153,7 @@ const DatabaseConnectionForm = ({
onRemoveTableCatalog,
sslForced,
validationErrors,
clearValidationErrors,
}: DatabaseConnectionFormProps) => (
<Form>
<div
Expand Down Expand Up @@ -179,6 +182,7 @@ const DatabaseConnectionForm = ({
},
validationErrors,
getValidation,
clearValidationErrors,
db,
key: field,
field,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -1433,6 +1432,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
getValidation={() => getValidation(db)}
validationErrors={validationErrors}
getPlaceholder={getPlaceholder}
clearValidationErrors={() => setValidationErrors(null)}
/>
{db?.parameters?.ssh && (
<SSHTunnelContainer>{renderSSHTunnelForm()}</SSHTunnelContainer>
Expand Down

0 comments on commit a0f5d89

Please sign in to comment.