diff --git a/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx b/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx index e4b15afdec3..9cdfc9747ea 100644 --- a/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx @@ -68,7 +68,6 @@ export function ChannelOptions({ )?.[option.propertyName]; const defaultValue = defaultValues?.settings?.[option.propertyName]; - const hasSecureProperty = defaultValues.secureSettings?.[option.propertyName]; return ( ({ key={key} error={error} pathPrefix={pathPrefix} - pathSuffix={option.secure && hasSecureProperty ? 'secureSettings.' : 'settings.'} + pathSuffix={option.secure ? 'secureSettings.' : 'settings.'} option={option} /> ); diff --git a/public/app/features/alerting/unified/utils/receiver-form.ts b/public/app/features/alerting/unified/utils/receiver-form.ts index b023b29ff71..829e351d287 100644 --- a/public/app/features/alerting/unified/utils/receiver-form.ts +++ b/public/app/features/alerting/unified/utils/receiver-form.ts @@ -215,6 +215,10 @@ function grafanaChannelConfigToFormChannelValues( delete values.settings[option.propertyName]; values.secureFields[option.propertyName] = true; } + if (option.secure && values.settings[option.propertyName]) { + values.secureSettings[option.propertyName] = values.settings[option.propertyName]; + delete values.settings[option.propertyName]; + } }); return values;