Skip to content

Commit b747586

Browse files
committed
Revert Role Mappings union type removal
- 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
1 parent aaf3705 commit b747586

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import { i18n } from '@kbn/i18n';
99

10+
import { ProductName } from '../types';
11+
1012
export const ANY_AUTH_PROVIDER = '*';
1113

1214
export const ANY_AUTH_PROVIDER_OPTION_LABEL = i18n.translate(
@@ -182,7 +184,7 @@ export const ROLE_MAPPINGS_HEADING_TITLE = i18n.translate(
182184
{ defaultMessage: 'Role mappings' }
183185
);
184186

185-
export const ROLE_MAPPINGS_HEADING_DESCRIPTION = (productName: string) =>
187+
export const ROLE_MAPPINGS_HEADING_DESCRIPTION = (productName: ProductName) =>
186188
i18n.translate('xpack.enterpriseSearch.roleMapping.roleMappingsHeadingDescription', {
187189
defaultMessage:
188190
'Role mappings provide an interface to associate native or SAML-governed role attributes with {productName} permissions.',

x-pack/plugins/enterprise_search/public/applications/shared/role_mapping/role_mappings_heading.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
EuiTitle,
1818
} from '@elastic/eui';
1919

20+
import { ProductName } from '../types';
21+
2022
import {
2123
ROLE_MAPPINGS_HEADING_TITLE,
2224
ROLE_MAPPINGS_HEADING_DESCRIPTION,
@@ -25,7 +27,7 @@ import {
2527
} from './constants';
2628

2729
interface Props {
28-
productName: string;
30+
productName: ProductName;
2931
onClick(): void;
3032
}
3133

x-pack/plugins/enterprise_search/public/applications/shared/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* 2.0.
66
*/
77

8+
import { APP_SEARCH_PLUGIN, WORKPLACE_SEARCH_PLUGIN } from '../../../common/constants';
9+
810
import { ADD, UPDATE } from './constants/operations';
911

1012
export type TOperation = typeof ADD | typeof UPDATE;
@@ -35,3 +37,6 @@ export interface RoleMapping {
3537
content: string;
3638
};
3739
}
40+
41+
const productNames = [APP_SEARCH_PLUGIN.NAME, WORKPLACE_SEARCH_PLUGIN.NAME] as const;
42+
export type ProductName = typeof productNames[number];

0 commit comments

Comments
 (0)