mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Spaces] update privilege selection text and icon (#199498)
## Summary Closes https://github.com/elastic/kibana-team/issues/1257 This PR modifies the spaces bulk edit context menu items to match the new design icons and text #### Visuals ##### After <img width="223" alt="Screenshot 2024-11-08 at 16 06 20" src="https://github.com/user-attachments/assets/4c09145a-c614-4d9f-a680-7fe28ef3087f"> ##### Before <img width="262" alt="Screenshot 2024-11-08 at 15 59 02" src="https://github.com/user-attachments/assets/14669115-8d98-46f9-b8c3-afb243e861d2"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) <!-- - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed --> - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) <!-- - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) --> - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) <!-- ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) - [ ] This will appear in the **Release Notes** and follow the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) -->
This commit is contained in:
parent
ae15c54d18
commit
cb7e5f6a0a
5 changed files with 217 additions and 184 deletions
|
@ -5,5 +5,5 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export const NO_PRIVILEGE_VALUE: string = 'none';
|
||||
export const NO_PRIVILEGE_VALUE = 'none' as const;
|
||||
export const CUSTOM_PRIVILEGE_VALUE: string = 'custom';
|
||||
|
|
|
@ -15,9 +15,9 @@ import {
|
|||
EuiPopover,
|
||||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
import _ from 'lodash';
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import type { KibanaPrivilege } from '@kbn/security-role-management-model';
|
||||
|
||||
|
@ -38,6 +38,43 @@ export class ChangeAllPrivilegesControl extends Component<Props, State> {
|
|||
isPopoverOpen: false,
|
||||
};
|
||||
|
||||
private getPrivilegeCopy = (privilege: string): { label?: string; icon?: string } => {
|
||||
switch (privilege) {
|
||||
case 'all':
|
||||
return {
|
||||
icon: 'documentEdit',
|
||||
label: i18n.translate(
|
||||
'xpack.security.management.editRole.changeAllPrivileges.allSelectionLabel',
|
||||
{
|
||||
defaultMessage: 'Grant full access for all',
|
||||
}
|
||||
),
|
||||
};
|
||||
case 'read':
|
||||
return {
|
||||
icon: 'glasses',
|
||||
label: i18n.translate(
|
||||
'xpack.security.management.editRole.changeAllPrivileges.readSelectionLabel',
|
||||
{
|
||||
defaultMessage: 'Grant read access for all',
|
||||
}
|
||||
),
|
||||
};
|
||||
case 'none':
|
||||
return {
|
||||
icon: 'trash',
|
||||
label: i18n.translate(
|
||||
'xpack.security.management.editRole.changeAllPrivileges.noneSelectionLabel',
|
||||
{
|
||||
defaultMessage: 'Revoke access to all',
|
||||
}
|
||||
),
|
||||
};
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
public render() {
|
||||
const button = (
|
||||
<EuiLink
|
||||
|
@ -56,8 +93,10 @@ export class ChangeAllPrivilegesControl extends Component<Props, State> {
|
|||
);
|
||||
|
||||
const items = this.props.privileges.map((privilege) => {
|
||||
const { icon, label } = this.getPrivilegeCopy(privilege.id);
|
||||
return (
|
||||
<EuiContextMenuItem
|
||||
icon={icon}
|
||||
key={privilege.id}
|
||||
data-test-subj={`changeAllPrivileges-${privilege.id}`}
|
||||
onClick={() => {
|
||||
|
@ -65,21 +104,24 @@ export class ChangeAllPrivilegesControl extends Component<Props, State> {
|
|||
}}
|
||||
disabled={this.props.disabled}
|
||||
>
|
||||
{_.upperFirst(privilege.id)}
|
||||
{label}
|
||||
</EuiContextMenuItem>
|
||||
);
|
||||
});
|
||||
|
||||
items.push(
|
||||
<EuiContextMenuItem
|
||||
icon={this.getPrivilegeCopy(NO_PRIVILEGE_VALUE).icon}
|
||||
key={NO_PRIVILEGE_VALUE}
|
||||
data-test-subj={`changeAllPrivileges-${NO_PRIVILEGE_VALUE}`}
|
||||
onClick={() => {
|
||||
this.onSelectPrivilege(NO_PRIVILEGE_VALUE);
|
||||
}}
|
||||
disabled={this.props.disabled}
|
||||
// @ts-expect-error leaving this here so that when https://github.com/elastic/eui/issues/8123 is fixed we remove this comment
|
||||
css={({ euiTheme }) => ({ color: euiTheme.colors.danger })}
|
||||
>
|
||||
{_.upperFirst(NO_PRIVILEGE_VALUE)}
|
||||
{this.getPrivilegeCopy(NO_PRIVILEGE_VALUE).label}
|
||||
</EuiContextMenuItem>
|
||||
);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiAccordion, EuiIconTip } from '@elastic/eui';
|
||||
import { EuiAccordion, EuiIconTip, EuiThemeProvider } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
|
||||
import type { KibanaFeature, SubFeatureConfig } from '@kbn/features-plugin/public';
|
||||
|
@ -47,16 +47,18 @@ const setup = (config: TestConfig) => {
|
|||
const onChange = jest.fn();
|
||||
const onChangeAll = jest.fn();
|
||||
const wrapper = mountWithIntl(
|
||||
<FeatureTable
|
||||
role={config.role}
|
||||
privilegeCalculator={calculator}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
onChange={onChange}
|
||||
onChangeAll={onChangeAll}
|
||||
canCustomizeSubFeaturePrivileges={config.canCustomizeSubFeaturePrivileges}
|
||||
privilegeIndex={config.privilegeIndex}
|
||||
allSpacesSelected={true}
|
||||
/>
|
||||
<EuiThemeProvider>
|
||||
<FeatureTable
|
||||
role={config.role}
|
||||
privilegeCalculator={calculator}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
onChange={onChange}
|
||||
onChangeAll={onChangeAll}
|
||||
canCustomizeSubFeaturePrivileges={config.canCustomizeSubFeaturePrivileges}
|
||||
privilegeIndex={config.privilegeIndex}
|
||||
allSpacesSelected={true}
|
||||
/>
|
||||
</EuiThemeProvider>
|
||||
);
|
||||
|
||||
const displayedPrivileges = config.calculateDisplayedPrivileges
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiButtonGroup } from '@elastic/eui';
|
||||
import { EuiButtonGroup, EuiThemeProvider } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -48,21 +48,28 @@ const displaySpaces: Space[] = [
|
|||
},
|
||||
];
|
||||
|
||||
const renderComponent = (props: React.ComponentProps<typeof PrivilegeSpaceForm>) => {
|
||||
return mountWithIntl(
|
||||
<EuiThemeProvider>
|
||||
<PrivilegeSpaceForm {...props} />
|
||||
</EuiThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
describe('PrivilegeSpaceForm', () => {
|
||||
it('renders an empty form when the role contains no Kibana privileges', () => {
|
||||
const role = createRole();
|
||||
const kibanaPrivileges = createKibanaPrivileges(kibanaFeatures);
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
onChange={jest.fn()}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
privilegeIndex: -1,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
onChange: jest.fn(),
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
expect(
|
||||
wrapper.find(EuiButtonGroup).filter('[name="basePrivilegeButtonGroup"]').props().idSelected
|
||||
|
@ -110,17 +117,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
]);
|
||||
const kibanaPrivileges = createKibanaPrivileges(kibanaFeatures);
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={jest.fn()}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange: jest.fn(),
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
expect(
|
||||
wrapper.find(EuiButtonGroup).filter('[name="basePrivilegeButtonGroup"]').props().idSelected
|
||||
|
@ -178,17 +183,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
]);
|
||||
const kibanaPrivileges = createKibanaPrivileges(kibanaFeatures);
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={jest.fn()}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange: jest.fn(),
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
expect(
|
||||
wrapper.find(EuiButtonGroup).filter('[name="basePrivilegeButtonGroup"]').props().idSelected
|
||||
|
@ -249,16 +252,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
|
||||
const kibanaPrivileges = createKibanaPrivileges(kibanaFeatures);
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
onChange={jest.fn()}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
privilegeIndex: -1,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
onChange: jest.fn(),
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
wrapper.find(SpaceSelector).props().onChange(['*']);
|
||||
|
||||
|
@ -286,17 +288,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
]);
|
||||
const kibanaPrivileges = createKibanaPrivileges(kibanaFeatures);
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={jest.fn()}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange: jest.fn(),
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
expect(
|
||||
wrapper.find(EuiButtonGroup).filter('[name="basePrivilegeButtonGroup"]').props().idSelected
|
||||
|
@ -360,17 +360,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
|
||||
const onChange = jest.fn();
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
findTestSubject(wrapper, 'changeAllPrivilegesButton').simulate('click');
|
||||
findTestSubject(wrapper, 'changeAllPrivileges-read').simulate('click');
|
||||
|
@ -418,17 +416,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
|
||||
const canCustomize = Symbol('can customize') as unknown as boolean;
|
||||
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={canCustomize}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: canCustomize,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
expect(wrapper.find(FeatureTable).props().canCustomizeSubFeaturePrivileges).toBe(canCustomize);
|
||||
});
|
||||
|
@ -464,17 +460,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
onChange.mockReset();
|
||||
});
|
||||
it('still allow other features privileges to be changed via "change read"', () => {
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
findTestSubject(wrapper, 'changeAllPrivilegesButton').simulate('click');
|
||||
findTestSubject(wrapper, 'changeAllPrivileges-read').simulate('click');
|
||||
|
@ -510,17 +504,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
});
|
||||
|
||||
it('still allow all privileges to be changed via "change all"', () => {
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
findTestSubject(wrapper, 'changeAllPrivilegesButton').simulate('click');
|
||||
findTestSubject(wrapper, 'changeAllPrivileges-all').simulate('click');
|
||||
|
@ -587,17 +579,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
});
|
||||
|
||||
it('still allow all features privileges to be changed via "change read" in foo space', () => {
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
findTestSubject(wrapper, 'changeAllPrivilegesButton').simulate('click');
|
||||
findTestSubject(wrapper, 'changeAllPrivileges-read').simulate('click');
|
||||
|
@ -631,17 +621,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
});
|
||||
|
||||
it('still allow other features privileges to be changed via "change all" in foo space', () => {
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={role}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
findTestSubject(wrapper, 'changeAllPrivilegesButton').simulate('click');
|
||||
findTestSubject(wrapper, 'changeAllPrivileges-all').simulate('click');
|
||||
|
@ -692,17 +680,15 @@ describe('PrivilegeSpaceForm', () => {
|
|||
spaces: ['bar'],
|
||||
},
|
||||
]);
|
||||
const wrapper = mountWithIntl(
|
||||
<PrivilegeSpaceForm
|
||||
role={roleAllSpace}
|
||||
spaces={displaySpaces}
|
||||
kibanaPrivileges={kibanaPrivileges}
|
||||
canCustomizeSubFeaturePrivileges={true}
|
||||
privilegeIndex={0}
|
||||
onChange={onChange}
|
||||
onCancel={jest.fn()}
|
||||
/>
|
||||
);
|
||||
const wrapper = renderComponent({
|
||||
role: roleAllSpace,
|
||||
spaces: displaySpaces,
|
||||
kibanaPrivileges,
|
||||
canCustomizeSubFeaturePrivileges: true,
|
||||
privilegeIndex: 0,
|
||||
onChange,
|
||||
onCancel: jest.fn(),
|
||||
});
|
||||
|
||||
findTestSubject(wrapper, 'changeAllPrivilegesButton').simulate('click');
|
||||
findTestSubject(wrapper, 'changeAllPrivileges-all').simulate('click');
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiThemeProvider } from '@elastic/eui';
|
||||
import { render, screen, waitFor, within } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import crypto from 'crypto';
|
||||
|
@ -81,46 +82,48 @@ const renderPrivilegeRolesForm = ({
|
|||
preSelectedRoles?: Role[];
|
||||
} = {}) => {
|
||||
return render(
|
||||
<IntlProvider locale="en">
|
||||
<EditSpaceProvider
|
||||
{...{
|
||||
logger,
|
||||
i18n,
|
||||
http,
|
||||
theme,
|
||||
overlays,
|
||||
notifications,
|
||||
spacesManager,
|
||||
serverBasePath: '',
|
||||
getUrlForApp: jest.fn((_) => _),
|
||||
navigateToUrl: jest.fn(),
|
||||
license: licenseMock,
|
||||
isRoleManagementEnabled: true,
|
||||
capabilities: {
|
||||
navLinks: {},
|
||||
management: {},
|
||||
catalogue: {},
|
||||
spaces: { manage: true },
|
||||
},
|
||||
dispatch: dispatchMock,
|
||||
state: {
|
||||
roles: new Map(),
|
||||
fetchRolesError: false,
|
||||
},
|
||||
invokeClient: spacesClientsInvocatorMock,
|
||||
}}
|
||||
>
|
||||
<PrivilegesRolesForm
|
||||
<EuiThemeProvider>
|
||||
<IntlProvider locale="en">
|
||||
<EditSpaceProvider
|
||||
{...{
|
||||
space,
|
||||
features: kibanaFeatures,
|
||||
closeFlyout,
|
||||
defaultSelected: preSelectedRoles,
|
||||
onSaveCompleted,
|
||||
logger,
|
||||
i18n,
|
||||
http,
|
||||
theme,
|
||||
overlays,
|
||||
notifications,
|
||||
spacesManager,
|
||||
serverBasePath: '',
|
||||
getUrlForApp: jest.fn((_) => _),
|
||||
navigateToUrl: jest.fn(),
|
||||
license: licenseMock,
|
||||
isRoleManagementEnabled: true,
|
||||
capabilities: {
|
||||
navLinks: {},
|
||||
management: {},
|
||||
catalogue: {},
|
||||
spaces: { manage: true },
|
||||
},
|
||||
dispatch: dispatchMock,
|
||||
state: {
|
||||
roles: new Map(),
|
||||
fetchRolesError: false,
|
||||
},
|
||||
invokeClient: spacesClientsInvocatorMock,
|
||||
}}
|
||||
/>
|
||||
</EditSpaceProvider>
|
||||
</IntlProvider>
|
||||
>
|
||||
<PrivilegesRolesForm
|
||||
{...{
|
||||
space,
|
||||
features: kibanaFeatures,
|
||||
closeFlyout,
|
||||
defaultSelected: preSelectedRoles,
|
||||
onSaveCompleted,
|
||||
}}
|
||||
/>
|
||||
</EditSpaceProvider>
|
||||
</IntlProvider>
|
||||
</EuiThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue