From b37116e360360464921baa98bf419bfcaec6f9a7 Mon Sep 17 00:00:00 2001 From: Bena Kansara Date: Wed, 6 Dec 2023 16:52:29 +0530 Subject: [PATCH] make thresholdRule config optional --- .../plugins/observability/public/pages/alerts/alerts.test.tsx | 1 - .../observability/public/pages/overview/overview.stories.tsx | 4 ++-- .../plugins/observability/public/pages/rules/rules.test.tsx | 1 - x-pack/plugins/observability/public/plugin.ts | 2 +- .../public/utils/kibana_react.storybook_decorator.tsx | 4 ++-- x-pack/plugins/observability/public/utils/test_helper.tsx | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts.test.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts.test.tsx index 247a700acfa6c2..1724f212303515 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts.test.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts.test.tsx @@ -58,7 +58,6 @@ jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({ uptime: { enabled: false }, observability: { enabled: false }, }, - thresholdRule: { enabled: false }, }, aiAssistant: { enabled: false, diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 15a47605e079c3..30d402a6fec94a 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -78,7 +78,7 @@ const withCore = makeDecorator({ }, } as unknown as Partial); - const config = { + const config: ConfigSchema = { unsafe: { alertDetails: { logs: { enabled: false }, @@ -87,7 +87,7 @@ const withCore = makeDecorator({ observability: { enabled: false }, }, }, - } as ConfigSchema; + }; return ( diff --git a/x-pack/plugins/observability/public/pages/rules/rules.test.tsx b/x-pack/plugins/observability/public/pages/rules/rules.test.tsx index 4239cdeee811e9..d18a85824aeaea 100644 --- a/x-pack/plugins/observability/public/pages/rules/rules.test.tsx +++ b/x-pack/plugins/observability/public/pages/rules/rules.test.tsx @@ -45,7 +45,6 @@ jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({ uptime: { enabled: false }, observability: { enabled: false }, }, - thresholdRule: { enabled: false }, }, }, observabilityRuleTypeRegistry: createObservabilityRuleTypeRegistryMock(), diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index e52e6c353c2e7c..f504ccbec8496e 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -100,7 +100,7 @@ export interface ConfigSchema { enabled: boolean; }; }; - thresholdRule: { + thresholdRule?: { enabled: boolean; }; }; diff --git a/x-pack/plugins/observability/public/utils/kibana_react.storybook_decorator.tsx b/x-pack/plugins/observability/public/utils/kibana_react.storybook_decorator.tsx index 4b6df9929bb4b2..78ae055f43159d 100644 --- a/x-pack/plugins/observability/public/utils/kibana_react.storybook_decorator.tsx +++ b/x-pack/plugins/observability/public/utils/kibana_react.storybook_decorator.tsx @@ -25,7 +25,7 @@ export function KibanaReactStorybookDecorator(Story: ComponentType) { } as unknown as AppMountParameters; const observabilityRuleTypeRegistry = createObservabilityRuleTypeRegistryMock(); - const config = { + const config: ConfigSchema = { unsafe: { alertDetails: { logs: { enabled: false }, @@ -34,7 +34,7 @@ export function KibanaReactStorybookDecorator(Story: ComponentType) { observability: { enabled: false }, }, }, - } as ConfigSchema; + }; const mockTheme: CoreTheme = { darkMode: false, diff --git a/x-pack/plugins/observability/public/utils/test_helper.tsx b/x-pack/plugins/observability/public/utils/test_helper.tsx index aa09f6c0b9140c..33dbc4a3db5f51 100644 --- a/x-pack/plugins/observability/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability/public/utils/test_helper.tsx @@ -38,7 +38,7 @@ const defaultConfig: ConfigSchema = { observability: { enabled: false }, }, }, -} as ConfigSchema; +}; const queryClient = new QueryClient({ defaultOptions: {