Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ResponseOps][Serverless]Maintenance window page displays dead breadcrumb for management #201147

Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8045cfa
Maintenance window page displays dead breadcrumb for management
georgianaonoleata1904 Nov 21, 2024
1bf8c91
fixed check types test by adding the missing type for serverless
georgianaonoleata1904 Nov 21, 2024
cf807c6
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Nov 21, 2024
23dccbc
fixed quick checks test
georgianaonoleata1904 Nov 22, 2024
639473f
Merge branch 'maintenance-windows-breadcrumb' of https://github.com/g…
georgianaonoleata1904 Nov 22, 2024
2ac8fbd
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Nov 22, 2024
a211aff
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Nov 25, 2024
a36f3cf
addressed comments
georgianaonoleata1904 Nov 26, 2024
731533b
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Nov 26, 2024
7bfea54
added back translations
georgianaonoleata1904 Nov 26, 2024
f5e466a
added test to check if the breadcrumb is present
georgianaonoleata1904 Nov 27, 2024
11b5a0e
added breadcrumb test in security also
georgianaonoleata1904 Nov 27, 2024
1685c10
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Dec 4, 2024
0cfbfc8
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Dec 5, 2024
bff2102
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Dec 5, 2024
c8746e3
added serverless as an optional plugin in alerting/kibana.jsonc
georgianaonoleata1904 Dec 9, 2024
9a68692
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Dec 9, 2024
98597dd
addressed comments
georgianaonoleata1904 Dec 9, 2024
dd1990c
addressed comments
georgianaonoleata1904 Dec 10, 2024
32e3dfa
Merge branch 'main' into maintenance-windows-breadcrumb
georgianaonoleata1904 Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions x-pack/plugins/alerting/public/hooks/use_breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,25 @@ export const useBreadcrumbs = (pageDeepLink: MaintenanceWindowDeepLinkIds) => {
services: {
chrome: { docTitle, setBreadcrumbs },
application: { navigateToUrl },
serverless,
},
} = useKibana();

const setTitle = docTitle.change;
const { getAppUrl } = useNavigation(MANAGEMENT_APP_ID);

useEffect(() => {
const breadcrumbs = [
{
georgianaonoleata1904 marked this conversation as resolved.
Show resolved Hide resolved
text: i18n.translate('xpack.alerting.breadcrumbs.stackManagementLinkText', {
defaultMessage: 'Stack Management',
}),
href: getAppUrl(),
},
...(!serverless
? [
{
text: i18n.translate('xpack.alerting.breadcrumbs.stackManagementLinkText', {
defaultMessage: 'Stack Management',
}),
href: getAppUrl(),
},
]
: []),
...(topLevelBreadcrumb[pageDeepLink]
? [
{
Expand All @@ -98,11 +104,14 @@ export const useBreadcrumbs = (pageDeepLink: MaintenanceWindowDeepLinkIds) => {
},
];

if (setBreadcrumbs) {
if (serverless?.setBreadcrumbs) {
serverless.setBreadcrumbs(breadcrumbs);
} else {
setBreadcrumbs(addClickHandlers(breadcrumbs, navigateToUrl));
}

if (setTitle) {
setTitle(getTitleFromBreadCrumbs(breadcrumbs));
}
}, [pageDeepLink, getAppUrl, navigateToUrl, setBreadcrumbs, setTitle]);
}, [pageDeepLink, getAppUrl, navigateToUrl, setBreadcrumbs, setTitle, serverless]);
};
2 changes: 2 additions & 0 deletions x-pack/plugins/alerting/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SpacesPluginStart } from '@kbn/spaces-plugin/public';
import { LicensingPluginStart } from '@kbn/licensing-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type { ServerlessPluginStart } from '@kbn/serverless/public';

import { AlertNavigationRegistry, AlertNavigationHandler } from './alert_navigation_registry';
import { loadRule, loadRuleType } from './services/rule_api';
Expand Down Expand Up @@ -68,6 +69,7 @@ export interface AlertingPluginStart {
spaces: SpacesPluginStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
data: DataPublicPluginStart;
serverless?: ServerlessPluginStart;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is changing this type enough? How does this guarantee that useKibana has it whenever the hook is called?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it correctly reflects (with the ?) the fact that the serverless plugin is not required but optional in alerting's kibana.jsonc config file

}

export interface AlertingUIConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,15 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'fleet' });
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Fleet', 'Agents']);
});

it('navigates to maintenance windows', async () => {
await svlCommonNavigation.sidenav.openSection('project_settings_project_nav');
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' });
await testSubjects.click('app-card-maintenanceWindows');
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts([
'Management',
'Maintenance Windows',
]);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,13 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await testSubjects.existOrFail('cases-all-title');
});
});
it('navigates to maintenance windows', async () => {
await svlCommonPage.loginAsAdmin();
await svlSecNavigation.navigateToLandingPage();
georgianaonoleata1904 marked this conversation as resolved.
Show resolved Hide resolved
await svlCommonNavigation.sidenav.openSection('category-management');
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'management' });
await testSubjects.click('app-card-maintenanceWindows');
await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Maintenance Windows' });
georgianaonoleata1904 marked this conversation as resolved.
Show resolved Hide resolved
});
});
}