Skip to content

Commit

Permalink
[Obs-UX-Management] SLO documentation in page header (elastic#208075)
Browse files Browse the repository at this point in the history
## Summary

Resolves elastic#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

<img width="836" alt="Screenshot 2025-01-23 at 10 05 12 AM"
src="https://github.com/user-attachments/assets/bf5e0a91-eac2-4a2e-8819-5a5c62016f4e"
/>

### 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
  • Loading branch information
baileycash-elastic authored Jan 24, 2025
1 parent 18c73ea commit f0eb5d6
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
1 change: 1 addition & 0 deletions src/platform/packages/shared/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ export interface DocLinks {
syntheticsCommandReference: string;
syntheticsProjectMonitors: string;
syntheticsMigrateFromIntegration: string;
slo: string;
sloBurnRateRule: string;
aiAssistant: string;
}>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export const kibanaStartMock = {
...observabilityPublicPluginsStartMock.createStart(),
storage: coreMock.createStorage(),
cases: { ...casesPluginMock.createStartContract() },
docLinks: {
links: {
query: {},
observability: {
slo: 'dummy_link',
},
},
},
},
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -25,6 +25,16 @@ export function HeaderMenu(): React.ReactElement | null {
<EuiFlexGroup responsive={false} gutterSize="s">
<EuiFlexItem>
<EuiHeaderLinks>
<EuiHeaderLink
color="primary"
href={docLinks.links.observability.slo}
iconType="documentation"
target="_blank"
>
{i18n.translate('xpack.slo.headerMenu.documentation', {
defaultMessage: 'SLO documentation',
})}
</EuiHeaderLink>
<EuiHeaderLink
color="primary"
href={http.basePath.prepend('/app/observabilityOnboarding')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ const mockKibana = () => {
get: () => 'http://localhost:5601',
},
},
docLinks: {
links: {
query: {},
observability: {
slo: 'dummy_link',
},
},
},
dataViews: {
create: jest.fn().mockResolvedValue({
getIndexPattern: jest.fn().mockReturnValue('some-index'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const mockKibana = (license: ILicense | null = licenseMock) => {
docLinks: {
links: {
query: {},
observability: {
slo: 'dummy_link',
},
},
},
http: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ const mockKibana = () => {
docLinks: {
links: {
query: {},
observability: {
slo: 'dummy_link',
},
},
},
http: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ const mockKibana = () => {
prepend: (url: string) => url,
},
},
docLinks: {
links: {
query: {},
observability: {
slo: 'dummy_link',
},
},
},
observabilityAIAssistant: mockObservabilityAIAssistant,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function SlosWelcomePage() {
const {
application: { navigateToUrl },
http: { basePath },
docLinks,
} = useKibana().services;

const { ObservabilityPageTemplate } = usePluginContext();
Expand Down Expand Up @@ -179,7 +180,7 @@ export function SlosWelcomePage() {
&nbsp;
<EuiLink
data-test-subj="o11ySloListWelcomePromptReadTheDocsLink"
href="https://www.elastic.co/guide/en/observability/current/slo.html"
href={docLinks.links.observability.slo}
target="_blank"
>
{i18n.translate('xpack.slo.sloList.welcomePrompt.learnMoreLink', {
Expand Down

0 comments on commit f0eb5d6

Please sign in to comment.