mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix: validation errors appearing after ssh tunnel switch (#24849)
(cherry picked from commit b71541fb7f)
This commit is contained in:
committed by
Michael S. Molina
parent
e47377e576
commit
8cf702bf3d
@@ -49,6 +49,7 @@ export const hostField = ({
|
|||||||
onChange={changeMethods.onParametersChange}
|
onChange={changeMethods.onParametersChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const portField = ({
|
export const portField = ({
|
||||||
required,
|
required,
|
||||||
changeMethods,
|
changeMethods,
|
||||||
@@ -255,6 +256,7 @@ export const forceSSLField = ({
|
|||||||
export const SSHTunnelSwitch = ({
|
export const SSHTunnelSwitch = ({
|
||||||
isEditMode,
|
isEditMode,
|
||||||
changeMethods,
|
changeMethods,
|
||||||
|
clearValidationErrors,
|
||||||
db,
|
db,
|
||||||
}: FieldPropTypes) => (
|
}: FieldPropTypes) => (
|
||||||
<div css={(theme: SupersetTheme) => infoTooltip(theme)}>
|
<div css={(theme: SupersetTheme) => infoTooltip(theme)}>
|
||||||
@@ -270,6 +272,7 @@ export const SSHTunnelSwitch = ({
|
|||||||
value: changed,
|
value: changed,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
clearValidationErrors();
|
||||||
}}
|
}}
|
||||||
data-test="ssh-tunnel-switch"
|
data-test="ssh-tunnel-switch"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export interface FieldPropTypes {
|
|||||||
};
|
};
|
||||||
validationErrors: JsonObject | null;
|
validationErrors: JsonObject | null;
|
||||||
getValidation: () => void;
|
getValidation: () => void;
|
||||||
|
clearValidationErrors: () => void;
|
||||||
db?: DatabaseObject;
|
db?: DatabaseObject;
|
||||||
field: string;
|
field: string;
|
||||||
isEditMode?: boolean;
|
isEditMode?: boolean;
|
||||||
@@ -132,6 +133,7 @@ interface DatabaseConnectionFormProps {
|
|||||||
onRemoveTableCatalog: (idx: number) => void;
|
onRemoveTableCatalog: (idx: number) => void;
|
||||||
validationErrors: JsonObject | null;
|
validationErrors: JsonObject | null;
|
||||||
getValidation: () => void;
|
getValidation: () => void;
|
||||||
|
clearValidationErrors: () => void;
|
||||||
getPlaceholder?: (field: string) => string | undefined;
|
getPlaceholder?: (field: string) => string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +153,7 @@ const DatabaseConnectionForm = ({
|
|||||||
onRemoveTableCatalog,
|
onRemoveTableCatalog,
|
||||||
sslForced,
|
sslForced,
|
||||||
validationErrors,
|
validationErrors,
|
||||||
|
clearValidationErrors,
|
||||||
}: DatabaseConnectionFormProps) => (
|
}: DatabaseConnectionFormProps) => (
|
||||||
<Form>
|
<Form>
|
||||||
<div
|
<div
|
||||||
@@ -179,6 +182,7 @@ const DatabaseConnectionForm = ({
|
|||||||
},
|
},
|
||||||
validationErrors,
|
validationErrors,
|
||||||
getValidation,
|
getValidation,
|
||||||
|
clearValidationErrors,
|
||||||
db,
|
db,
|
||||||
key: field,
|
key: field,
|
||||||
field,
|
field,
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ export function dbReducer(
|
|||||||
};
|
};
|
||||||
case ActionType.extraInputChange:
|
case ActionType.extraInputChange:
|
||||||
// "extra" payload in state is a string
|
// "extra" payload in state is a string
|
||||||
|
|
||||||
if (
|
if (
|
||||||
action.payload.name === 'schema_cache_timeout' ||
|
action.payload.name === 'schema_cache_timeout' ||
|
||||||
action.payload.name === 'table_cache_timeout'
|
action.payload.name === 'table_cache_timeout'
|
||||||
@@ -1635,6 +1634,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
|||||||
getValidation={() => getValidation(db)}
|
getValidation={() => getValidation(db)}
|
||||||
validationErrors={validationErrors}
|
validationErrors={validationErrors}
|
||||||
getPlaceholder={getPlaceholder}
|
getPlaceholder={getPlaceholder}
|
||||||
|
clearValidationErrors={() => setValidationErrors(null)}
|
||||||
/>
|
/>
|
||||||
{db?.parameters?.ssh && (
|
{db?.parameters?.ssh && (
|
||||||
<SSHTunnelContainer>{renderSSHTunnelForm()}</SSHTunnelContainer>
|
<SSHTunnelContainer>{renderSSHTunnelForm()}</SSHTunnelContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user