-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[management/security] implement k7Breadcrumbs (#26603)
## Summary This PR updates the security management routes to provide k7Breadcrumbs used by the new header navigation. See #25884 for general information about the integration with the router and #25689 for the breadcrumb taxonomy ![2018-12-03 19 05 40](https://user-images.githubusercontent.com/1329312/49416328-764b4200-f72e-11e8-9db7-aeb1294d131b.gif) ### Checklist - [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/master/packages/kbn-i18n/README.md)
- Loading branch information
Spencer
authored
Dec 4, 2018
1 parent
3e1b98e
commit f524e9e
Showing
8 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
x-pack/plugins/security/public/views/management/breadcrumbs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { MANAGEMENT_BREADCRUMB } from 'ui/management/breadcrumbs'; | ||
|
||
export function getUsersBreadcrumbs() { | ||
return [ | ||
MANAGEMENT_BREADCRUMB, | ||
{ | ||
text: i18n.translate('xpack.security.users.breadcrumb', { | ||
defaultMessage: 'Users', | ||
}), | ||
href: '#/management/security/users', | ||
}, | ||
]; | ||
} | ||
|
||
export function getEditUserBreadcrumbs($route: Record<string, any>) { | ||
const { username } = $route.current.params; | ||
return [ | ||
...getUsersBreadcrumbs(), | ||
{ | ||
text: username, | ||
href: `#/management/security/users/edit/${username}`, | ||
}, | ||
]; | ||
} | ||
|
||
export function getCreateUserBreadcrumbs() { | ||
return [ | ||
...getUsersBreadcrumbs(), | ||
{ | ||
text: i18n.translate('xpack.security.users.createBreadcrumb', { | ||
defaultMessage: 'Create', | ||
}), | ||
}, | ||
]; | ||
} | ||
|
||
export function getRolesBreadcrumbs() { | ||
return [ | ||
MANAGEMENT_BREADCRUMB, | ||
{ | ||
text: i18n.translate('xpack.security.roles.breadcrumb', { | ||
defaultMessage: 'Roles', | ||
}), | ||
href: '#/management/security/roles', | ||
}, | ||
]; | ||
} | ||
|
||
export function getEditRoleBreadcrumbs($route: Record<string, any>) { | ||
const { name } = $route.current.params; | ||
return [ | ||
...getRolesBreadcrumbs(), | ||
{ | ||
text: name, | ||
href: `#/management/security/roles/edit/${name}`, | ||
}, | ||
]; | ||
} | ||
|
||
export function getCreateRoleBreadcrumbs() { | ||
return [ | ||
...getUsersBreadcrumbs(), | ||
{ | ||
text: i18n.translate('xpack.security.roles.createBreadcrumb', { | ||
defaultMessage: 'Create', | ||
}), | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters