mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Serverless] fix breadcrumbs for alerts and slo (#169778)
## Summary Close https://github.com/elastic/kibana/issues/161447 This fixes deeper context breadcrumbs in serverless observability project for alerts and slos apps. This builds on top of https://github.com/elastic/kibana/pull/169513 where we added merging of navigational project breadcrumbs with deeper context breadcrumbs set by `chrome.setBreadcrumbs`. The merging is based on deepLinkId, so we're adding it to base breadcrumbs. The deepLinkId is type checked.  
This commit is contained in:
parent
ef68ba981b
commit
cb2a6e5348
8 changed files with 22 additions and 3 deletions
|
@ -75,6 +75,7 @@ export function AlertDetails() {
|
|||
text: i18n.translate('xpack.observability.breadcrumbs.alertsLinkText', {
|
||||
defaultMessage: 'Alerts',
|
||||
}),
|
||||
deepLinkId: 'observability-overview:alerts',
|
||||
},
|
||||
{
|
||||
text: alert ? pageTitleContent(alert.fields[ALERT_RULE_CATEGORY]) : defaultBreadcrumb,
|
||||
|
|
|
@ -85,6 +85,7 @@ export function RuleDetailsPage() {
|
|||
defaultMessage: 'Alerts',
|
||||
}),
|
||||
href: basePath.prepend(paths.observability.alerts),
|
||||
deepLinkId: 'observability-overview:alerts',
|
||||
},
|
||||
{
|
||||
href: basePath.prepend(paths.observability.rules),
|
||||
|
|
|
@ -46,6 +46,7 @@ export function RulesPage({ activeTab = RULES_TAB_NAME }: RulesPageProps) {
|
|||
defaultMessage: 'Alerts',
|
||||
}),
|
||||
href: http.basePath.prepend('/app/observability/alerts'),
|
||||
deepLinkId: 'observability-overview:alerts',
|
||||
},
|
||||
{
|
||||
text: i18n.translate('xpack.observability.breadcrumbs.rulesLinkText', {
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
import React, { useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useIsMutating } from '@tanstack/react-query';
|
||||
import { EuiBreadcrumbProps } from '@elastic/eui/src/components/breadcrumbs/breadcrumb';
|
||||
import { EuiLoadingSpinner } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { IBasePath } from '@kbn/core-http-browser';
|
||||
import type { ChromeBreadcrumb } from '@kbn/core-chrome-browser';
|
||||
import type { SLOWithSummaryResponse } from '@kbn/slo-schema';
|
||||
import { useBreadcrumbs } from '@kbn/observability-shared-plugin/public';
|
||||
|
||||
|
@ -97,13 +97,14 @@ export function SloDetailsPage() {
|
|||
function getBreadcrumbs(
|
||||
basePath: IBasePath,
|
||||
slo: SLOWithSummaryResponse | undefined
|
||||
): EuiBreadcrumbProps[] {
|
||||
): ChromeBreadcrumb[] {
|
||||
return [
|
||||
{
|
||||
href: basePath.prepend(paths.observability.slos),
|
||||
text: i18n.translate('xpack.observability.breadcrumbs.slosLinkText', {
|
||||
defaultMessage: 'SLOs',
|
||||
}),
|
||||
deepLinkId: 'observability-overview:slos',
|
||||
},
|
||||
{
|
||||
text:
|
||||
|
|
|
@ -41,6 +41,7 @@ export function SloEditPage() {
|
|||
text: i18n.translate('xpack.observability.breadcrumbs.sloLabel', {
|
||||
defaultMessage: 'SLOs',
|
||||
}),
|
||||
deepLinkId: 'observability-overview:slos',
|
||||
},
|
||||
...(!!slo
|
||||
? [
|
||||
|
|
|
@ -44,6 +44,7 @@ export function SlosPage() {
|
|||
text: i18n.translate('xpack.observability.breadcrumbs.slosLinkText', {
|
||||
defaultMessage: 'SLOs',
|
||||
}),
|
||||
deepLinkId: 'observability-overview:slos',
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
"@kbn/core-application-common",
|
||||
"@kbn/react-kibana-mount",
|
||||
"@kbn/react-kibana-context-theme",
|
||||
"@kbn/shared-ux-link-redirect-app"
|
||||
"@kbn/shared-ux-link-redirect-app",
|
||||
"@kbn/core-chrome-browser"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*"
|
||||
|
|
|
@ -127,6 +127,18 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
|
|||
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Cases', 'Settings']);
|
||||
});
|
||||
|
||||
it('navigates to alerts app', async () => {
|
||||
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:alerts' });
|
||||
await svlCommonNavigation.sidenav.expectLinkActive({
|
||||
deepLinkId: 'observability-overview:alerts',
|
||||
});
|
||||
await testSubjects.click('manageRulesPageButton');
|
||||
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Alerts', 'Rules']);
|
||||
await svlCommonNavigation.sidenav.expectLinkActive({
|
||||
deepLinkId: 'observability-overview:alerts',
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to integrations', async () => {
|
||||
await svlCommonNavigation.sidenav.openSection('project_settings_project_nav');
|
||||
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'integrations' });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue