-
Notifications
You must be signed in to change notification settings - Fork 407
fix: [UIE-8447] - refresh drawer after config add/update #11979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b92d61b
dc1c05c
ba9482c
b169b6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,9 +68,9 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
|
|
||
| const configurations = convertEngineConfigToOptions(databaseConfig); | ||
|
|
||
| const existingConfigsArray = convertExistingConfigsToArray( | ||
| existingConfigurations, | ||
| databaseConfig | ||
| const existingConfigsArray = useMemo( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Not sure about the names.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something we could do in a follow-up π |
||
| () => convertExistingConfigsToArray(existingConfigurations, databaseConfig), | ||
| [existingConfigurations, databaseConfig] | ||
| ); | ||
|
|
||
| const { | ||
|
|
@@ -81,6 +81,7 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
| watch, | ||
| } = useForm<FormValues>({ | ||
| defaultValues: { configs: existingConfigsArray }, | ||
| mode: 'onBlur', | ||
| resolver: yupResolver( | ||
| createDynamicAdvancedConfigSchema( | ||
| configurations | ||
|
|
@@ -96,10 +97,10 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
| const configs = watch('configs'); | ||
|
|
||
| useEffect(() => { | ||
| if (databaseConfig) { | ||
| if (existingConfigsArray) { | ||
| reset({ configs: existingConfigsArray }); | ||
| } | ||
| }, [databaseConfig]); | ||
| }, [existingConfigsArray]); | ||
|
|
||
| const usedConfigs = useMemo( | ||
| () => new Set(fields.map((config) => config.label)), | ||
|
|
@@ -109,7 +110,7 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
| (config) => !usedConfigs.has(config.label) | ||
| ); | ||
|
|
||
| const hasRestartCluster = fields.some((item) => item.restart_cluster); | ||
| const hasRestartCluster = fields.some((item) => item.requires_restart); | ||
|
|
||
| const handleAddConfiguration = (config: ConfigurationOption | null) => { | ||
| if (!config || usedConfigs.has(config.label)) { | ||
|
|
@@ -140,7 +141,7 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
| engine_config: formatConfigPayload(formData.configs, configurations), | ||
| }; | ||
| await updateDatabase(payload).then(() => { | ||
| onClose(); | ||
| handleClose(); | ||
| enqueueSnackbar('Advanced Configuration settings saved', { | ||
| variant: 'success', | ||
| }); | ||
|
|
@@ -150,7 +151,7 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
| return ( | ||
| <Drawer | ||
| NotFoundComponent={NotFound} | ||
| onClose={onClose} | ||
| onClose={handleClose} | ||
| open={open} | ||
| title="Advanced Configuration" | ||
| > | ||
|
|
@@ -208,6 +209,7 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => { | |
| configItem={config} | ||
| engine={engine} | ||
| errorText={fieldState.error?.message} | ||
| onBlur={field.onBlur} | ||
| onChange={field.onChange} | ||
| onRemove={() => handleRemoveConfig(index)} | ||
| /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.