From 5a2b80f8db172b17c75f1532e7799d88ade80b0b Mon Sep 17 00:00:00 2001 From: Bena Kansara <69037875+benakansara@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:53:29 +0200 Subject: [PATCH] Add feature flag for new Threshold Alert details page (#162394) Resolves https://github.com/elastic/kibana/issues/162393 Adds a new feature flag `xpack.observability.unsafe.alertDetails.observability.enabled` to show/hide threshold alert details page until it is ready for GA. --- .../docker_generator/resources/base/bin/kibana-docker | 1 + .../plugin_functional/test_suites/core_plugins/rendering.ts | 1 + x-pack/README.md | 6 ++++++ .../public/pages/overview/overview.stories.tsx | 1 + .../plugins/observability/public/pages/rules/rules.test.tsx | 1 + x-pack/plugins/observability/public/plugin.ts | 3 +++ .../observability/public/utils/is_alert_details_enabled.ts | 2 +- .../public/utils/kibana_react.storybook_decorator.tsx | 1 + x-pack/plugins/observability/public/utils/test_helper.tsx | 1 + x-pack/plugins/observability/server/index.ts | 3 +++ 10 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index d35b39efca4eb..43df58235e68d 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -307,6 +307,7 @@ kibana_vars=( xpack.observability.unsafe.alertDetails.metrics.enabled xpack.observability.unsafe.alertDetails.logs.enabled xpack.observability.unsafe.alertDetails.uptime.enabled + xpack.observability.unsafe.alertDetails.observability.enabled xpack.observability.unsafe.thresholdRule.enabled xpack.observability.compositeSlo.enabled xpack.reporting.capture.browser.autoDownload diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index d60914578b2f7..4f604e0fad3b8 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -284,6 +284,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.observability.unsafe.alertDetails.metrics.enabled (boolean)', 'xpack.observability.unsafe.alertDetails.logs.enabled (boolean)', 'xpack.observability.unsafe.alertDetails.uptime.enabled (boolean)', + 'xpack.observability.unsafe.alertDetails.observability.enabled (boolean)', 'xpack.observability.unsafe.thresholdRule.enabled (boolean)', 'xpack.observability_onboarding.ui.enabled (boolean)', /** diff --git a/x-pack/README.md b/x-pack/README.md index 9c554c651b41f..ea8777f46b143 100644 --- a/x-pack/README.md +++ b/x-pack/README.md @@ -26,6 +26,12 @@ xpack.observability.unsafe.alertDetails.uptime.enabled: true **[For Uptime rule type]** In Kibana configuration, will allow the user to navigate to the new Alert Details page, instead of the Alert Flyout when clicking on `View alert details` in the Alert table +```yaml +xpack.observability.unsafe.alertDetails.observability.enabled: true +``` + +**[For Observability Threshold rule type]** In Kibana configuration, will allow the user to navigate to the new Alert Details page, instead of the Alert Flyout when clicking on `View alert details` in the Alert table + # Development By default, Kibana will run with X-Pack installed as mentioned in the [contributing guide](../CONTRIBUTING.md). 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 4fd78735bdb68..79d058fb5f632 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -84,6 +84,7 @@ const withCore = makeDecorator({ logs: { enabled: false }, metrics: { enabled: false }, uptime: { enabled: false }, + observability: { enabled: false }, }, thresholdRule: { enabled: false }, }, 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 0c5a18c5ac9c7..d0d8678488aa6 100644 --- a/x-pack/plugins/observability/public/pages/rules/rules.test.tsx +++ b/x-pack/plugins/observability/public/pages/rules/rules.test.tsx @@ -40,6 +40,7 @@ jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({ logs: { enabled: false }, metrics: { enabled: false }, uptime: { enabled: false }, + observability: { enabled: false }, }, thresholdRule: { enabled: false }, }, diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index 287248538b633..fc6753e5997a8 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -86,6 +86,9 @@ export interface ConfigSchema { uptime: { enabled: boolean; }; + observability: { + enabled: boolean; + }; }; thresholdRule: { enabled: boolean; diff --git a/x-pack/plugins/observability/public/utils/is_alert_details_enabled.ts b/x-pack/plugins/observability/public/utils/is_alert_details_enabled.ts index 6432563897e16..15b9589be60f6 100644 --- a/x-pack/plugins/observability/public/utils/is_alert_details_enabled.ts +++ b/x-pack/plugins/observability/public/utils/is_alert_details_enabled.ts @@ -14,7 +14,7 @@ const ALLOWED_RULE_TYPES = ['apm.transaction_duration']; const isUnsafeAlertDetailsFlag = ( subject: string ): subject is keyof ConfigSchema['unsafe']['alertDetails'] => - ['uptime', 'logs', 'metrics'].includes(subject); + ['uptime', 'logs', 'metrics', 'observability'].includes(subject); // We are mapping the ruleTypeId from the feature flag with the ruleTypeId from the alert // to know whether the feature flag is enabled or not. 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 e56487549a689..8a89cb6cf93f2 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 @@ -31,6 +31,7 @@ export function KibanaReactStorybookDecorator(Story: ComponentType) { logs: { enabled: false }, metrics: { enabled: false }, uptime: { enabled: false }, + observability: { enabled: false }, }, thresholdRule: { enabled: false }, }, diff --git a/x-pack/plugins/observability/public/utils/test_helper.tsx b/x-pack/plugins/observability/public/utils/test_helper.tsx index c979eaef6b879..3b84ffe786f91 100644 --- a/x-pack/plugins/observability/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability/public/utils/test_helper.tsx @@ -35,6 +35,7 @@ const defaultConfig: ConfigSchema = { logs: { enabled: false }, metrics: { enabled: false }, uptime: { enabled: false }, + observability: { enabled: false }, }, thresholdRule: { enabled: false }, }, diff --git a/x-pack/plugins/observability/server/index.ts b/x-pack/plugins/observability/server/index.ts index 1f06f63c5de00..6c6b68981b117 100644 --- a/x-pack/plugins/observability/server/index.ts +++ b/x-pack/plugins/observability/server/index.ts @@ -42,6 +42,9 @@ const configSchema = schema.object({ uptime: schema.object({ enabled: schema.boolean({ defaultValue: false }), }), + observability: schema.object({ + enabled: schema.boolean({ defaultValue: false }), + }), }), thresholdRule: schema.object({ enabled: schema.boolean({ defaultValue: false }),