Skip to content

Commit

Permalink
[Cases] Update configure cases breadcrumb to settings (elastic#169532)
Browse files Browse the repository at this point in the history
## Summary

fixes elastic#169213

This PR updates route and deeplink breadcrumb from `Configure cases ` to
`Settings`.

It also updates bread crumb text for serverless as mentioned in
elastic#169401 (review)


![image](https://github.com/elastic/kibana/assets/117571355/94b8a0b8-9842-4570-a2e0-fd7c9b42bcb4)


![image](https://github.com/elastic/kibana/assets/117571355/65666e53-1b61-4088-bf65-87fef6dd70bd)

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
js-jankisalvi authored Oct 24, 2023
1 parent ad932ec commit 68b2e4d
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 30 deletions.
20 changes: 10 additions & 10 deletions x-pack/plugins/cases/public/common/navigation/deep_links.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ describe('getCasesDeepLinks', () => {
{
id: 'cases_create',
path: '/cases/create',
title: 'Create New Case',
title: 'Create',
},
{
id: 'cases_configure',
path: '/cases/configure',
title: 'Configure Cases',
title: 'Settings',
},
],
});
Expand All @@ -40,12 +40,12 @@ describe('getCasesDeepLinks', () => {
{
id: 'cases_create',
path: '/test/create',
title: 'Create New Case',
title: 'Create',
},
{
id: 'cases_configure',
path: '/test/configure',
title: 'Configure Cases',
title: 'Settings',
},
],
});
Expand Down Expand Up @@ -75,13 +75,13 @@ describe('getCasesDeepLinks', () => {
{
id: 'cases_create',
path: '/cases/create',
title: 'Create New Case',
title: 'Create',
navLinkStatus: AppNavLinkStatus.hidden,
},
{
id: 'cases_configure',
path: '/cases/configure',
title: 'Configure Cases',
title: 'Settings',
order: 8002,
},
],
Expand Down Expand Up @@ -115,12 +115,12 @@ describe('getCasesDeepLinks', () => {
{
id: 'cases_create',
path: '/cases/create',
title: 'Create New Case',
title: 'Create',
},
{
id: 'cases_configure',
path: '/cases/configure',
title: 'Configure Cases',
title: 'Settings',
},
],
});
Expand All @@ -136,7 +136,7 @@ describe('getCasesDeepLinks', () => {
title: 'My new create cases title',
},
cases_configure: {
title: 'My new configure cases title',
title: 'My new settings title',
},
},
});
Expand All @@ -154,7 +154,7 @@ describe('getCasesDeepLinks', () => {
{
id: 'cases_configure',
path: '/cases/configure',
title: 'My new configure cases title',
title: 'My new settings title',
},
],
});
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/cases/public/common/navigation/deep_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export const getCasesDeepLinks = <T extends AppDeepLink = AppDeepLink>({
deepLinks: [
{
title: i18n.translate('xpack.cases.navigation.create', {
defaultMessage: 'Create New Case',
defaultMessage: 'Create',
}),
...(extend[CasesDeepLinkId.casesCreate] ?? {}),
id: CasesDeepLinkId.casesCreate,
path: getCreateCasePath(basePath),
},
{
title: i18n.translate('xpack.cases.navigation.configure', {
defaultMessage: 'Configure Cases',
title: i18n.translate('xpack.cases.navigation.settings', {
defaultMessage: 'Settings',
}),
...(extend[CasesDeepLinkId.casesConfigure] ?? {}),
id: CasesDeepLinkId.casesConfigure,
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/public/components/app/routes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jest.mock('../create', () => ({
}));

jest.mock('../configure_cases', () => ({
ConfigureCases: () => <div>{'Configure cases'}</div>,
ConfigureCases: () => <div>{'Settings'}</div>,
}));

const getCaseViewPaths = () => ['/cases/test-id', '/cases/test-id/comment-id'];
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('Cases routes', () => {
describe('Configure cases', () => {
it('navigates to the configure cases page', () => {
renderWithRouter(['/cases/configure']);
expect(screen.getByText('Configure cases')).toBeInTheDocument();
expect(screen.getByText('Settings')).toBeInTheDocument();
});

it('shows the no privileges page if the user does not have update privileges', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,27 @@ describe('useCasesBreadcrumbs', () => {
expect(mockSetServerlessBreadcrumbs).not.toHaveBeenCalled();
});
});

describe('set settings breadcrumbs', () => {
it('call setBreadcrumbs with all items', () => {
renderHook(() => useCasesBreadcrumbs(CasesDeepLinkId.casesConfigure), { wrapper });
expect(mockSetBreadcrumbs).toHaveBeenCalledWith([
{ href: '/test', onClick: expect.any(Function), text: 'Test' },
{ href: CasesDeepLinkId.cases, onClick: expect.any(Function), text: 'Cases' },
{ text: 'Settings' },
]);
expect(mockSetServerlessBreadcrumbs).toHaveBeenCalledWith([]);
});

it('should set the cases title', () => {
renderHook(() => useCasesBreadcrumbs(CasesDeepLinkId.casesConfigure), { wrapper });
expect(mockSetTitle).toHaveBeenCalledWith(['Settings', 'Cases', 'Test']);
});

it('should not set serverless breadcrumbs in ess', () => {
mockGetKibanaServices.mockReturnValueOnce({ serverless: undefined });
renderHook(() => useCasesBreadcrumbs(CasesDeepLinkId.casesConfigure), { wrapper });
expect(mockSetServerlessBreadcrumbs).not.toHaveBeenCalled();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const casesBreadcrumbTitle: Record<ICasesDeepLinkId, string> = {
[CasesDeepLinkId.casesCreate]: i18n.translate('xpack.cases.breadcrumbs.create_case', {
defaultMessage: 'Create',
}),
[CasesDeepLinkId.casesConfigure]: i18n.translate('xpack.cases.breadcrumbs.configure_cases', {
defaultMessage: 'Configure',
[CasesDeepLinkId.casesConfigure]: i18n.translate('xpack.cases.breadcrumbs.settings', {
defaultMessage: 'Settings',
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ import { i18n } from '@kbn/i18n';
export * from '../translations';

export const SUCCESS_CONFIGURE = i18n.translate('xpack.cases.configure.successSaveToast', {
defaultMessage: 'Saved external connection settings',
defaultMessage: 'Settings successfully updated',
});
1 change: 0 additions & 1 deletion x-pack/plugins/security_solution/public/cases/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const casesLinks = getCasesDeepLinks<LinkItem>({
},
[SecurityPageName.caseConfigure]: {
capabilities: [`${CASES_FEATURE_ID}.${UPDATE_CASES_CAPABILITY}`],
licenseType: 'gold',
sideNavDisabled: true,
},
[SecurityPageName.caseCreate]: {
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -10495,7 +10495,6 @@
"xpack.cases.badge.readOnly.text": "Lecture seule",
"xpack.cases.badge.readOnly.tooltip": "Impossible de créer ou de modifier des cas",
"xpack.cases.breadcrumbs.all_cases": "Cas",
"xpack.cases.breadcrumbs.configure_cases": "Configurer",
"xpack.cases.breadcrumbs.create_case": "Créer",
"xpack.cases.callout.appropriateLicense": "licence appropriée",
"xpack.cases.callout.cloudDeploymentLink": "déploiement sur le cloud",
Expand Down Expand Up @@ -10792,7 +10791,6 @@
"xpack.cases.markdownEditor.preview": "Aperçu",
"xpack.cases.modal.attachments.noAttachmentsTitle": "Aucune pièce jointe ajoutée au cas",
"xpack.cases.navigation.cases": "Cas",
"xpack.cases.navigation.configure": "Configurer les cas",
"xpack.cases.navigation.create": "Créer un nouveau cas",
"xpack.cases.noPrivileges.button": "Retour aux cas",
"xpack.cases.noPrivileges.title": "Privilèges requis",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -10510,7 +10510,6 @@
"xpack.cases.badge.readOnly.text": "読み取り専用",
"xpack.cases.badge.readOnly.tooltip": "ケースを作成または編集できません",
"xpack.cases.breadcrumbs.all_cases": "ケース",
"xpack.cases.breadcrumbs.configure_cases": "構成",
"xpack.cases.breadcrumbs.create_case": "作成",
"xpack.cases.callout.appropriateLicense": "適切なライセンス",
"xpack.cases.callout.cloudDeploymentLink": "クラウド展開",
Expand Down Expand Up @@ -10807,7 +10806,6 @@
"xpack.cases.markdownEditor.preview": "プレビュー",
"xpack.cases.modal.attachments.noAttachmentsTitle": "ケースに追加された添付ファイルはありません",
"xpack.cases.navigation.cases": "ケース",
"xpack.cases.navigation.configure": "ケースを構成",
"xpack.cases.navigation.create": "新規ケースを作成",
"xpack.cases.noPrivileges.button": "ケースに戻る",
"xpack.cases.noPrivileges.title": "権限が必要です",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -10510,7 +10510,6 @@
"xpack.cases.badge.readOnly.text": "只读",
"xpack.cases.badge.readOnly.tooltip": "无法创建或编辑案例",
"xpack.cases.breadcrumbs.all_cases": "案例",
"xpack.cases.breadcrumbs.configure_cases": "配置",
"xpack.cases.breadcrumbs.create_case": "创建",
"xpack.cases.callout.appropriateLicense": "适当的许可证",
"xpack.cases.callout.cloudDeploymentLink": "云部署",
Expand Down Expand Up @@ -10807,7 +10806,6 @@
"xpack.cases.markdownEditor.preview": "预览",
"xpack.cases.modal.attachments.noAttachmentsTitle": "未向该案例添加任何附件",
"xpack.cases.navigation.cases": "案例",
"xpack.cases.navigation.configure": "配置案例",
"xpack.cases.navigation.create": "创建新案例",
"xpack.cases.noPrivileges.button": "返回到案例",
"xpack.cases.noPrivileges.title": "需要权限",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
it('change closure option successfully', async () => {
await cases.common.selectRadioGroupValue('closure-options-radio-group', 'close-by-pushing');
const toast = await toasts.getToastElement(1);
expect(await toast.getVisibleText()).to.be('Saved external connection settings');
expect(await toast.getVisibleText()).to.be('Settings successfully updated');
await toasts.dismissAllToasts();
await cases.common.assertRadioGroupValue('closure-options-radio-group', 'close-by-pushing');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
it('change closure option successfully', async () => {
await cases.common.selectRadioGroupValue('closure-options-radio-group', 'close-by-pushing');
const toast = await toasts.getToastElement(1);
expect(await toast.getVisibleText()).to.be('Saved external connection settings');
expect(await toast.getVisibleText()).to.be('Settings successfully updated');
await toasts.dismissAllToasts();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await svlCommonNavigation.sidenav.expectLinkActive({
deepLinkId: 'observability-overview:cases',
});
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Cases', 'Create New Case']);
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Cases', 'Create']);

await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' });

Expand All @@ -117,7 +117,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await svlCommonNavigation.sidenav.expectLinkActive({
deepLinkId: 'observability-overview:cases',
});
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Cases', 'Configure Cases']);
await svlCommonNavigation.breadcrumbs.expectBreadcrumbTexts(['Cases', 'Settings']);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
it('change closure option successfully', async () => {
await cases.common.selectRadioGroupValue('closure-options-radio-group', 'close-by-pushing');
const toast = await toasts.getToastElement(1);
expect(await toast.getVisibleText()).to.be('Saved external connection settings');
expect(await toast.getVisibleText()).to.be('Settings successfully updated');
await toasts.dismissAllToasts();
});
});
Expand Down

0 comments on commit 68b2e4d

Please sign in to comment.