From aae42b8b452078b754a12a884bebc637c89af52d Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 14 Apr 2021 11:29:00 -0400 Subject: [PATCH] [Workplace Search] Add breadcrumbs to Role mappings (#97051) (#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 --- .../app_search/components/role_mappings/constants.ts | 9 --------- .../components/role_mappings/role_mapping.tsx | 8 +++++--- .../applications/shared/role_mapping/constants.ts | 10 ++++++++++ .../workplace_search/components/layout/nav.tsx | 4 +++- .../public/applications/workplace_search/constants.ts | 2 +- .../views/role_mappings/role_mapping.tsx | 10 +++++++++- .../views/role_mappings/role_mappings.tsx | 2 ++ 7 files changed, 30 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/constants.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/constants.ts index 1fed750a86dc4..2f9ff707f9631 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/constants.ts @@ -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', { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.tsx index 47c0eb2483ec1..610ceae8856f2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/role_mapping.tsx @@ -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'; @@ -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, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/constants.ts b/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/constants.ts index 8abab6d060a96..a172fbae18d8f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/constants.ts @@ -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', { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx index f2edc04a5661c..51cdcc688e682 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx @@ -42,7 +42,9 @@ export const WorkplaceSearchNav: React.FC = ({ {NAV.GROUPS} - {NAV.ROLE_MAPPINGS} + + {NAV.ROLE_MAPPINGS} + {NAV.SECURITY} {NAV.SETTINGS} diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts index d771673506761..9f758cacdfce3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts @@ -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', diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.tsx index d69e94b20444e..fb366883601a6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mapping.tsx @@ -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'; @@ -105,6 +111,7 @@ export const RoleMapping: React.FC = ({ 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', { @@ -121,6 +128,7 @@ export const RoleMapping: React.FC = ({ isNew }) => { return ( <> +
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.tsx index 0e3533d48a5a9..9ec0dfc0acefc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/role_mappings/role_mappings.tsx @@ -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 { @@ -61,6 +62,7 @@ export const RoleMappings: React.FC = () => { return ( <> +