Skip to content

Commit

Permalink
improve slos and alerts breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant committed Oct 25, 2023
1 parent 5c578a0 commit 8fa3ed2
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/public/pages/rules/rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function SloEditPage() {
text: i18n.translate('xpack.observability.breadcrumbs.sloLabel', {
defaultMessage: 'SLOs',
}),
deepLinkId: 'observability-overview:slos',
},
...(!!slo
? [
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/public/pages/slos/slos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function SlosPage() {
text: i18n.translate('xpack.observability.breadcrumbs.slosLinkText', {
defaultMessage: 'SLOs',
}),
deepLinkId: 'observability-overview:slos',
},
]);

Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/observability/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
const svlCommonNavigation = getPageObject('svlCommonNavigation');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const retry = getService('retry');

describe('navigation', function () {
before(async () => {
Expand Down Expand Up @@ -129,6 +130,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' });
Expand Down

0 comments on commit 8fa3ed2

Please sign in to comment.