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 e5312c6c0343f7..9f40844e52470a 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 @@ -7,6 +7,8 @@ import { i18n } from '@kbn/i18n'; +import { ProductName } from '../types'; + export const ANY_AUTH_PROVIDER = '*'; export const ANY_AUTH_PROVIDER_OPTION_LABEL = i18n.translate( @@ -182,7 +184,7 @@ export const ROLE_MAPPINGS_HEADING_TITLE = i18n.translate( { defaultMessage: 'Role mappings' } ); -export const ROLE_MAPPINGS_HEADING_DESCRIPTION = (productName: string) => +export const ROLE_MAPPINGS_HEADING_DESCRIPTION = (productName: ProductName) => i18n.translate('xpack.enterpriseSearch.roleMapping.roleMappingsHeadingDescription', { defaultMessage: 'Role mappings provide an interface to associate native or SAML-governed role attributes with {productName} permissions.', diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/role_mappings_heading.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/role_mappings_heading.tsx index d36bdfda06d31c..eee8b180d32819 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/role_mappings_heading.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/role_mappings_heading.tsx @@ -17,6 +17,8 @@ import { EuiTitle, } from '@elastic/eui'; +import { ProductName } from '../types'; + import { ROLE_MAPPINGS_HEADING_TITLE, ROLE_MAPPINGS_HEADING_DESCRIPTION, @@ -25,7 +27,7 @@ import { } from './constants'; interface Props { - productName: string; + productName: ProductName; onClick(): void; } diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/types.ts b/x-pack/plugins/enterprise_search/public/applications/shared/types.ts index 2cdadc1c6b0d30..67208c63ddf4cc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/types.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { APP_SEARCH_PLUGIN, WORKPLACE_SEARCH_PLUGIN } from '../../../common/constants'; + import { ADD, UPDATE } from './constants/operations'; export type TOperation = typeof ADD | typeof UPDATE; @@ -35,3 +37,6 @@ export interface RoleMapping { content: string; }; } + +const productNames = [APP_SEARCH_PLUGIN.NAME, WORKPLACE_SEARCH_PLUGIN.NAME] as const; +export type ProductName = typeof productNames[number];