Skip to content

Commit

Permalink
Revert Role Mappings union type removal
Browse files Browse the repository at this point in the history
- but shenanigans it a bit to take our i18n'd shared product names (requires as const assertion)

- done to reduce merge conflicts for Scotty / make his life (hopefully) a bit easier between ent-search and Kibana
  • Loading branch information
cee-chen committed Jun 16, 2021
1 parent aaf3705 commit b747586
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
EuiTitle,
} from '@elastic/eui';

import { ProductName } from '../types';

import {
ROLE_MAPPINGS_HEADING_TITLE,
ROLE_MAPPINGS_HEADING_DESCRIPTION,
Expand All @@ -25,7 +27,7 @@ import {
} from './constants';

interface Props {
productName: string;
productName: ProductName;
onClick(): void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];

0 comments on commit b747586

Please sign in to comment.