fix: Remove default values for engine and schemas (#15635)

* remove default values

* don't set initial value on save

* set defaults for engine_params

* update with JSON.parse
This commit is contained in:
Hugh A. Miles II 2021-07-12 15:37:44 -07:00 committed by GitHub
parent 34542db3b6
commit 2252f3396c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -414,7 +414,7 @@ const ExtraOptions = ({
<div className="input-container"> <div className="input-container">
<StyledJsonEditor <StyledJsonEditor
name="metadata_params" name="metadata_params"
value={db?.extra_json?.metadata_params || '{}'} value={db?.extra_json?.metadata_params || ''}
placeholder={t('Metadata Parameters')} placeholder={t('Metadata Parameters')}
onChange={(json: string) => onChange={(json: string) =>
onExtraEditorChange({ json, name: 'metadata_params' }) onExtraEditorChange({ json, name: 'metadata_params' })
@ -436,7 +436,7 @@ const ExtraOptions = ({
<div className="input-container"> <div className="input-container">
<StyledJsonEditor <StyledJsonEditor
name="engine_params" name="engine_params"
value={db?.extra_json?.engine_params || '{}'} value={db?.extra_json?.engine_params || ''}
placeholder={t('Engine Parameters')} placeholder={t('Engine Parameters')}
onChange={(json: string) => onChange={(json: string) =>
onExtraEditorChange({ json, name: 'engine_params' }) onExtraEditorChange({ json, name: 'engine_params' })

View File

@ -468,9 +468,10 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
engine_params: JSON.parse( engine_params: JSON.parse(
(dbToUpdate?.extra_json?.engine_params as string) || '{}', (dbToUpdate?.extra_json?.engine_params as string) || '{}',
), ),
schemas_allowed_for_csv_upload: schemas_allowed_for_csv_upload: JSON.parse(
(dbToUpdate?.extra_json?.schemas_allowed_for_csv_upload as string) || (dbToUpdate?.extra_json?.schemas_allowed_for_csv_upload as string) ||
'[]', '[]',
),
}); });
} }