Skip to content

Commit

Permalink
[Workplace Search] Add breadcrumbs to Role mappings (elastic#97051) (e…
Browse files Browse the repository at this point in the history
…lastic#97113)

* Update Workplace Search nav to align with App Search

* Add constants to shared

* [App Search] Use shared constants

* [Workplace Search] Add breadcrumbs to Role mappings

* Enable shouldShowActiveForSubroutes

Co-authored-by: Scotty Bollinger <[email protected]>
  • Loading branch information
kibanamachine and scottybollinger authored Apr 14, 2021
1 parent 5d680ed commit aae42b8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ export const UPDATE_ROLE_MAPPING = i18n.translate(
{ defaultMessage: 'Update role mapping' }
);

export const ADD_ROLE_MAPPING_TITLE = i18n.translate(
'xpack.enterpriseSearch.appSearch.roleMapping.newRoleMappingTitle',
{ defaultMessage: 'Add role mapping' }
);
export const MANAGE_ROLE_MAPPING_TITLE = i18n.translate(
'xpack.enterpriseSearch.appSearch.roleMapping.manageRoleMappingTitle',
{ defaultMessage: 'Manage role mapping' }
);

export const EMPTY_ROLE_MAPPINGS_BODY = i18n.translate(
'xpack.enterpriseSearch.appSearch.roleMapping.emptyRoleMappingsBody',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ import {
DeleteMappingCallout,
RoleSelector,
} from '../../../shared/role_mapping';
import { ROLE_MAPPINGS_TITLE } from '../../../shared/role_mapping/constants';
import {
ROLE_MAPPINGS_TITLE,
ADD_ROLE_MAPPING_TITLE,
MANAGE_ROLE_MAPPING_TITLE,
} from '../../../shared/role_mapping/constants';
import { AppLogic } from '../../app_logic';

import { roleHasScopedEngines } from '../../utils/role/has_scoped_engines';
Expand All @@ -42,8 +46,6 @@ import { Engine } from '../engine/types';
import {
SAVE_ROLE_MAPPING,
UPDATE_ROLE_MAPPING,
ADD_ROLE_MAPPING_TITLE,
MANAGE_ROLE_MAPPING_TITLE,
ADVANCED_ROLE_TYPES,
STANDARD_ROLE_TYPES,
ADVANCED_ROLE_SELECTORS_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ export const ROLE_MAPPINGS_TITLE = i18n.translate(
}
);

export const ADD_ROLE_MAPPING_TITLE = i18n.translate(
'xpack.enterpriseSearch.roleMapping.newRoleMappingTitle',
{ defaultMessage: 'Add role mapping' }
);

export const MANAGE_ROLE_MAPPING_TITLE = i18n.translate(
'xpack.enterpriseSearch.roleMapping.manageRoleMappingTitle',
{ defaultMessage: 'Manage role mapping' }
);

export const EMPTY_ROLE_MAPPINGS_TITLE = i18n.translate(
'xpack.enterpriseSearch.roleMapping.emptyRoleMappingsTitle',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export const WorkplaceSearchNav: React.FC<Props> = ({
<SideNavLink to={GROUPS_PATH} subNav={groupsSubNav}>
{NAV.GROUPS}
</SideNavLink>
<SideNavLink to={ROLE_MAPPINGS_PATH}>{NAV.ROLE_MAPPINGS}</SideNavLink>
<SideNavLink shouldShowActiveForSubroutes to={ROLE_MAPPINGS_PATH}>
{NAV.ROLE_MAPPINGS}
</SideNavLink>
<SideNavLink to={SECURITY_PATH}>{NAV.SECURITY}</SideNavLink>
<SideNavLink subNav={settingsSubNav} to={ORG_SETTINGS_PATH}>
{NAV.SETTINGS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const NAV = {
defaultMessage: 'Content',
}),
ROLE_MAPPINGS: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.roleMappings', {
defaultMessage: 'Role Mappings',
defaultMessage: 'Users & roles',
}),
SECURITY: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.security', {
defaultMessage: 'Security',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ import {
import { i18n } from '@kbn/i18n';

import { FlashMessages } from '../../../shared/flash_messages';
import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome';
import { Loading } from '../../../shared/loading';
import {
AttributeSelector,
DeleteMappingCallout,
RoleSelector,
} from '../../../shared/role_mapping';
import { ROLE_LABEL } from '../../../shared/role_mapping/constants';
import {
ROLE_LABEL,
ROLE_MAPPINGS_TITLE,
ADD_ROLE_MAPPING_TITLE,
MANAGE_ROLE_MAPPING_TITLE,
} from '../../../shared/role_mapping/constants';
import { ViewContentHeader } from '../../components/shared/view_content_header';
import { Role } from '../../types';

Expand Down Expand Up @@ -105,6 +111,7 @@ export const RoleMapping: React.FC<RoleMappingProps> = ({ isNew }) => {

const hasGroupAssignment = selectedGroups.size > 0 || includeInAllGroups;

const TITLE = isNew ? ADD_ROLE_MAPPING_TITLE : MANAGE_ROLE_MAPPING_TITLE;
const SAVE_ROLE_MAPPING_LABEL = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.roleMapping.saveRoleMappingButtonMessage',
{
Expand All @@ -121,6 +128,7 @@ export const RoleMapping: React.FC<RoleMappingProps> = ({ isNew }) => {

return (
<>
<SetPageChrome trail={[ROLE_MAPPINGS_TITLE, TITLE]} />
<ViewContentHeader title={SAVE_ROLE_MAPPING_LABEL} action={saveRoleMappingButton} />
<EuiSpacer size="l" />
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useActions, useValues } from 'kea';
import { EuiEmptyPrompt, EuiPanel } from '@elastic/eui';

import { FlashMessages } from '../../../shared/flash_messages';
import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome';
import { Loading } from '../../../shared/loading';
import { AddRoleMappingButton, RoleMappingsTable } from '../../../shared/role_mapping';
import {
Expand Down Expand Up @@ -61,6 +62,7 @@ export const RoleMappings: React.FC = () => {

return (
<>
<SetPageChrome trail={[ROLE_MAPPINGS_TITLE]} />
<ViewContentHeader title={ROLE_MAPPINGS_TITLE} description={ROLE_MAPPINGS_DESCRIPTION} />
<div>
<FlashMessages />
Expand Down

0 comments on commit aae42b8

Please sign in to comment.