From f0eb5d695745f1f3a19ae6392618d1826ce29ce2 Mon Sep 17 00:00:00 2001 From: Bailey Cash Date: Fri, 24 Jan 2025 09:15:11 -0500 Subject: [PATCH] [Obs-UX-Management] SLO documentation in page header (#208075) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Resolves #198176 This PR: - Adds link to SLO documentation to SLO page header - Creates a new path constant for SLO documentation to be shared between the welcome page and page header links Screenshot 2025-01-23 at 10 05 12 AM ### Testing (Manual) Both "Read the docs" and "SLO Documentation" links should both go to the same place, in a new tab: https://www.elastic.co/guide/en/observability/current/slo.html --- .../shared/kbn-doc-links/src/get_doc_links.ts | 3 +++ .../packages/shared/kbn-doc-links/src/types.ts | 1 + .../observability/public/utils/kibana_react.mock.ts | 8 ++++++++ .../public/components/header_menu/header_menu.tsx | 12 +++++++++++- .../public/pages/slo_details/slo_details.test.tsx | 8 ++++++++ .../slo/public/pages/slo_edit/slo_edit.test.tsx | 3 +++ .../plugins/slo/public/pages/slos/slos.test.tsx | 3 +++ .../public/pages/slos_welcome/slos_welcome.test.tsx | 8 ++++++++ .../slo/public/pages/slos_welcome/slos_welcome.tsx | 3 ++- 9 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index e024e94a773e7..ad76bb9369cd9 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -575,6 +575,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D ? `${SERVERLESS_DOCS}observability-synthetics-get-started-project.html` : `${OBSERVABILITY_DOCS}synthetic-run-tests.html#synthetic-monitor-choose-project`, syntheticsMigrateFromIntegration: `${OBSERVABILITY_DOCS}synthetics-migrate-from-integration.html`, + slo: isServerless + ? `${SERVERLESS_DOCS}observability-slos.html` + : `${OBSERVABILITY_DOCS}slo.html`, sloBurnRateRule: isServerless ? `${SERVERLESS_DOCS}observability-create-slo-burn-rate-alert-rule.html` : `${OBSERVABILITY_DOCS}slo-burn-rate-alert.html`, diff --git a/src/platform/packages/shared/kbn-doc-links/src/types.ts b/src/platform/packages/shared/kbn-doc-links/src/types.ts index 7eb18d6582e91..a065b7a9f6db9 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/types.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/types.ts @@ -390,6 +390,7 @@ export interface DocLinks { syntheticsCommandReference: string; syntheticsProjectMonitors: string; syntheticsMigrateFromIntegration: string; + slo: string; sloBurnRateRule: string; aiAssistant: string; }>; diff --git a/x-pack/solutions/observability/plugins/observability/public/utils/kibana_react.mock.ts b/x-pack/solutions/observability/plugins/observability/public/utils/kibana_react.mock.ts index 1e854540afb5c..95609a6c53436 100644 --- a/x-pack/solutions/observability/plugins/observability/public/utils/kibana_react.mock.ts +++ b/x-pack/solutions/observability/plugins/observability/public/utils/kibana_react.mock.ts @@ -19,6 +19,14 @@ export const kibanaStartMock = { ...observabilityPublicPluginsStartMock.createStart(), storage: coreMock.createStorage(), cases: { ...casesPluginMock.createStartContract() }, + docLinks: { + links: { + query: {}, + observability: { + slo: 'dummy_link', + }, + }, + }, }, }; }, diff --git a/x-pack/solutions/observability/plugins/slo/public/components/header_menu/header_menu.tsx b/x-pack/solutions/observability/plugins/slo/public/components/header_menu/header_menu.tsx index bc01ed55acbdf..92be96a212e53 100644 --- a/x-pack/solutions/observability/plugins/slo/public/components/header_menu/header_menu.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/components/header_menu/header_menu.tsx @@ -14,7 +14,7 @@ import { usePluginContext } from '../../hooks/use_plugin_context'; import { SLOS_BASE_PATH, SLO_SETTINGS_PATH } from '../../../common/locators/paths'; export function HeaderMenu(): React.ReactElement | null { - const { http, theme } = useKibana().services; + const { http, theme, docLinks } = useKibana().services; const { appMountParameters, isServerless } = usePluginContext(); return ( @@ -25,6 +25,16 @@ export function HeaderMenu(): React.ReactElement | null { + + {i18n.translate('xpack.slo.headerMenu.documentation', { + defaultMessage: 'SLO documentation', + })} + { get: () => 'http://localhost:5601', }, }, + docLinks: { + links: { + query: {}, + observability: { + slo: 'dummy_link', + }, + }, + }, dataViews: { create: jest.fn().mockResolvedValue({ getIndexPattern: jest.fn().mockReturnValue('some-index'), diff --git a/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.test.tsx index 8d52ed914302c..00c4cbb471ee8 100644 --- a/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.test.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.test.tsx @@ -104,6 +104,9 @@ const mockKibana = (license: ILicense | null = licenseMock) => { docLinks: { links: { query: {}, + observability: { + slo: 'dummy_link', + }, }, }, http: { diff --git a/x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.test.tsx index 3a9c21c2ffa0e..cdf795a8f2093 100644 --- a/x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.test.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.test.tsx @@ -100,6 +100,9 @@ const mockKibana = () => { docLinks: { links: { query: {}, + observability: { + slo: 'dummy_link', + }, }, }, http: { diff --git a/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.test.tsx index 369a1fbeed932..945c01a3496b6 100644 --- a/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.test.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.test.tsx @@ -52,6 +52,14 @@ const mockKibana = () => { prepend: (url: string) => url, }, }, + docLinks: { + links: { + query: {}, + observability: { + slo: 'dummy_link', + }, + }, + }, observabilityAIAssistant: mockObservabilityAIAssistant, }, }); diff --git a/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.tsx index ccb273aad913e..e99970dad2cc8 100644 --- a/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.tsx @@ -32,6 +32,7 @@ export function SlosWelcomePage() { const { application: { navigateToUrl }, http: { basePath }, + docLinks, } = useKibana().services; const { ObservabilityPageTemplate } = usePluginContext(); @@ -179,7 +180,7 @@ export function SlosWelcomePage() {   {i18n.translate('xpack.slo.sloList.welcomePrompt.learnMoreLink', {