diff --git a/x-pack/plugins/apm/public/components/app/settings/general_settings/index.tsx b/x-pack/plugins/apm/public/components/app/settings/general_settings/index.tsx index 114d080fb3a34..5eae7486a9290 100644 --- a/x-pack/plugins/apm/public/components/app/settings/general_settings/index.tsx +++ b/x-pack/plugins/apm/public/components/app/settings/general_settings/index.tsx @@ -30,7 +30,6 @@ import { useUiTracker, } from '@kbn/observability-shared-plugin/public'; import { FieldRowProvider } from '@kbn/management-settings-components-field-row'; -import { ValueValidation } from '@kbn/core-ui-settings-browser/src/types'; import { useApmFeatureFlag } from '../../../../hooks/use_apm_feature_flag'; import { ApmFeatureFlagName } from '../../../../../common/apm_feature_flags'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; @@ -66,7 +65,7 @@ function getApmSettingsKeys(isProfilingIntegrationEnabled: boolean) { export function GeneralSettings() { const trackApmEvent = useUiTracker({ app: 'apm' }); - const { docLinks, notifications } = useApmPluginContext().core; + const { docLinks, notifications, settings } = useApmPluginContext().core; const isProfilingIntegrationEnabled = useApmFeatureFlag( ApmFeatureFlagName.ProfilingIntegrationAvailable ); @@ -101,11 +100,9 @@ export function GeneralSettings() { } } - // We don't validate the user input on these settings - const settingsValidationResponse: ValueValidation = { - successfulValidation: true, - valid: true, - }; + const hasInvalidChanges = Object.values(unsavedChanges).some( + ({ isInvalid }) => isInvalid + ); return ( <> @@ -118,7 +115,8 @@ export function GeneralSettings() { links: docLinks.links.management, showDanger: (message: string) => notifications.toasts.addDanger(message), - validateChange: async () => settingsValidationResponse, + validateChange: (key: string, value: any) => + settings.client.validateValue(key, value), }} > )}