Skip to content

Commit

Permalink
[Actionable Observability] hide rules from sidebar and move under ale…
Browse files Browse the repository at this point in the history
…rts (#128437)

* hide rules from sidebar and move under alerts

* update tests

* remove commented code

* update order

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
mgiota and kibanamachine authored Mar 24, 2022
1 parent 5a3faca commit 8d1b8c0
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function createUseRulesLink(isNewRuleManagementEnabled = false) {
const linkProps = isNewRuleManagementEnabled
? {
app: 'observability',
pathname: '/rules',
pathname: '/alerts/rules',
}
: {
app: 'management',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function AlertsPage() {
}, []);

const manageRulesHref = config.unsafe.rules.enabled
? http.basePath.prepend('/app/observability/rules')
? http.basePath.prepend('/app/observability/alerts/rules')
: http.basePath.prepend('/app/management/insightsAndAlerting/triggersActions/rules');

const dynamicIndexPatternsAsyncState = useAsync(async (): Promise<DataViewBase[]> => {
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/observability/public/pages/rules/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
EuiFieldSearch,
OnRefreshChangeProps,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { usePluginContext } from '../../hooks/use_plugin_context';
import { useBreadcrumbs } from '../../hooks/use_breadcrumbs';
Expand Down Expand Up @@ -140,6 +141,12 @@ export function RulesPage() {
}, [refreshInterval, reload, isPaused]);

useBreadcrumbs([
{
text: i18n.translate('xpack.observability.breadcrumbs.alertsLinkText', {
defaultMessage: 'Alerts',
}),
href: http.basePath.prepend('/app/observability/alerts'),
},
{
text: RULES_BREADCRUMB_TEXT,
},
Expand Down
21 changes: 11 additions & 10 deletions x-pack/plugins/observability/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,22 @@ export class Plugin
order: 8001,
path: '/alerts',
navLinkStatus: AppNavLinkStatus.hidden,
},
{
id: 'rules',
title: i18n.translate('xpack.observability.rulesLinkTitle', {
defaultMessage: 'Rules',
}),
order: 8002,
path: '/rules',
navLinkStatus: AppNavLinkStatus.hidden,
deepLinks: [
{
id: 'rules',
title: i18n.translate('xpack.observability.rulesLinkTitle', {
defaultMessage: 'Rules',
}),
path: '/alerts/rules',
navLinkStatus: AppNavLinkStatus.hidden,
},
],
},
getCasesDeepLinks({
basePath: casesPath,
extend: {
[CasesDeepLinkId.cases]: {
order: 8003,
order: 8002,
navLinkStatus: AppNavLinkStatus.hidden,
},
[CasesDeepLinkId.casesCreate]: {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/public/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const routes = {
},
exact: true,
},
'/rules': {
'/alerts/rules': {
handler: () => {
return <RulesPage />;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(navLinks.map((link) => link.text)).to.eql([
'Overview',
'Alerts',
'Rules',
'APM',
'User Experience',
'Stack Management',
Expand Down Expand Up @@ -120,7 +119,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(navLinks).to.eql([
'Overview',
'Alerts',
'Rules',
'APM',
'User Experience',
'Stack Management',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

it('shows metrics navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Rules', 'Metrics', 'Stack Management']);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Metrics', 'Stack Management']);
});

describe('infrastructure landing page without data', () => {
Expand Down Expand Up @@ -161,7 +161,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

it('shows metrics navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Rules', 'Metrics', 'Stack Management']);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Metrics', 'Stack Management']);
});

describe('infrastructure landing page without data', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

it('shows logs navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Rules', 'Logs', 'Stack Management']);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Logs', 'Stack Management']);
});

describe('logs landing page without data', () => {
Expand Down Expand Up @@ -123,7 +123,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

it('shows logs navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Rules', 'Logs', 'Stack Management']);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Logs', 'Stack Management']);
});

describe('logs landing page without data', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(navLinks.map((link) => link.text)).to.eql([
'Overview',
'Alerts',
'Rules',
'Uptime',
'Stack Management',
]);
Expand Down Expand Up @@ -124,7 +123,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

it('shows uptime navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Rules', 'Uptime', 'Stack Management']);
expect(navLinks).to.eql(['Overview', 'Alerts', 'Uptime', 'Stack Management']);
});

it('can navigate to Uptime app', async () => {
Expand Down

0 comments on commit 8d1b8c0

Please sign in to comment.