mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Removes visible features column from spaces grid when in serverless (#194438)
Closes #194403 ## Summary Removes the 'Features visible' column from the Spaces management page grid when in serverless. ### Tests - x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_page.test.tsx ### Manual tesing - Start ES & Kibana in serverless mode, with a `xpack.spaces.maxSpaces` setting > 1 - Navigate to spaces management page and verify that the 'Features visible' column is not present - Start ES & Kibana in stateful mode - Navigate to spaces management page and verify that the 'Features visible' column is present
This commit is contained in:
parent
620b8bfbf8
commit
22e36117c4
7 changed files with 95 additions and 2 deletions
|
@ -50,6 +50,7 @@ describe('ManagementService', () => {
|
|||
getRolesAPIClient: getRolesAPIClientMock,
|
||||
getPrivilegesAPIClient: jest.fn(),
|
||||
eventTracker,
|
||||
isServerless: false,
|
||||
});
|
||||
|
||||
expect(mockKibanaSection.registerApp).toHaveBeenCalledTimes(1);
|
||||
|
@ -73,6 +74,7 @@ describe('ManagementService', () => {
|
|||
getRolesAPIClient: getRolesAPIClientMock,
|
||||
getPrivilegesAPIClient: jest.fn(),
|
||||
eventTracker,
|
||||
isServerless: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -97,6 +99,7 @@ describe('ManagementService', () => {
|
|||
getRolesAPIClient: jest.fn(),
|
||||
getPrivilegesAPIClient: jest.fn(),
|
||||
eventTracker,
|
||||
isServerless: false,
|
||||
});
|
||||
|
||||
service.stop();
|
||||
|
|
|
@ -28,6 +28,7 @@ interface SetupDeps {
|
|||
eventTracker: EventTracker;
|
||||
getPrivilegesAPIClient: () => Promise<PrivilegesAPIClientPublicContract>;
|
||||
logger: Logger;
|
||||
isServerless: boolean;
|
||||
}
|
||||
|
||||
export class ManagementService {
|
||||
|
@ -42,6 +43,7 @@ export class ManagementService {
|
|||
getRolesAPIClient,
|
||||
eventTracker,
|
||||
getPrivilegesAPIClient,
|
||||
isServerless,
|
||||
}: SetupDeps) {
|
||||
this.registeredSpacesManagementApp = management.sections.section.kibana.registerApp(
|
||||
spacesManagementApp.create({
|
||||
|
@ -52,6 +54,7 @@ export class ManagementService {
|
|||
getRolesAPIClient,
|
||||
eventTracker,
|
||||
getPrivilegesAPIClient,
|
||||
isServerless,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ featuresStart.getFeatures.mockResolvedValue([
|
|||
const spacesGridCommonProps = {
|
||||
serverBasePath: '',
|
||||
maxSpaces: 1000,
|
||||
isServerless: false,
|
||||
};
|
||||
|
||||
describe('SpacesGridPage', () => {
|
||||
|
@ -326,6 +327,7 @@ describe('SpacesGridPage', () => {
|
|||
maxSpaces={1}
|
||||
allowSolutionVisibility
|
||||
serverBasePath={spacesGridCommonProps.serverBasePath}
|
||||
isServerless={false}
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -410,4 +412,81 @@ describe('SpacesGridPage', () => {
|
|||
title: 'Error loading spaces',
|
||||
});
|
||||
});
|
||||
|
||||
it(`renders the 'Features visible' column when not serverless`, async () => {
|
||||
const httpStart = httpServiceMock.createStartContract();
|
||||
httpStart.get.mockResolvedValue([]);
|
||||
|
||||
const error = new Error('something awful happened');
|
||||
|
||||
const notifications = notificationServiceMock.createStartContract();
|
||||
|
||||
const wrapper = shallowWithIntl(
|
||||
<SpacesGridPage
|
||||
spacesManager={spacesManager}
|
||||
getFeatures={() => Promise.reject(error)}
|
||||
notifications={notifications}
|
||||
getUrlForApp={getUrlForApp}
|
||||
history={history}
|
||||
capabilities={{
|
||||
navLinks: {},
|
||||
management: {},
|
||||
catalogue: {},
|
||||
spaces: { manage: true },
|
||||
}}
|
||||
allowSolutionVisibility
|
||||
{...spacesGridCommonProps}
|
||||
/>
|
||||
);
|
||||
|
||||
// allow spacesManager to load spaces and lazy-load SpaceAvatar
|
||||
await act(async () => {});
|
||||
wrapper.update();
|
||||
|
||||
expect(wrapper.find('EuiInMemoryTable').prop('columns')).toContainEqual(
|
||||
expect.objectContaining({
|
||||
field: 'disabledFeatures',
|
||||
name: 'Features visible',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it(`does not render the 'Features visible' column when serverless`, async () => {
|
||||
const httpStart = httpServiceMock.createStartContract();
|
||||
httpStart.get.mockResolvedValue([]);
|
||||
|
||||
const error = new Error('something awful happened');
|
||||
|
||||
const notifications = notificationServiceMock.createStartContract();
|
||||
|
||||
const wrapper = shallowWithIntl(
|
||||
<SpacesGridPage
|
||||
spacesManager={spacesManager}
|
||||
getFeatures={() => Promise.reject(error)}
|
||||
notifications={notifications}
|
||||
getUrlForApp={getUrlForApp}
|
||||
history={history}
|
||||
capabilities={{
|
||||
navLinks: {},
|
||||
management: {},
|
||||
catalogue: {},
|
||||
spaces: { manage: true },
|
||||
}}
|
||||
allowSolutionVisibility
|
||||
{...spacesGridCommonProps}
|
||||
isServerless={true}
|
||||
/>
|
||||
);
|
||||
|
||||
// allow spacesManager to load spaces and lazy-load SpaceAvatar
|
||||
await act(async () => {});
|
||||
wrapper.update();
|
||||
|
||||
expect(wrapper.find('EuiInMemoryTable').prop('columns')).not.toContainEqual(
|
||||
expect.objectContaining({
|
||||
field: 'disabledFeatures',
|
||||
name: 'Features visible',
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -63,6 +63,7 @@ interface Props {
|
|||
getUrlForApp: ApplicationStart['getUrlForApp'];
|
||||
maxSpaces: number;
|
||||
allowSolutionVisibility: boolean;
|
||||
isServerless: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -335,7 +336,8 @@ export class SpacesGridPage extends Component<Props, State> {
|
|||
},
|
||||
];
|
||||
|
||||
const shouldShowFeaturesColumn = !activeSolution || activeSolution === SOLUTION_VIEW_CLASSIC;
|
||||
const shouldShowFeaturesColumn =
|
||||
!this.props.isServerless && (!activeSolution || activeSolution === SOLUTION_VIEW_CLASSIC);
|
||||
if (shouldShowFeaturesColumn) {
|
||||
config.push({
|
||||
field: 'disabledFeatures',
|
||||
|
|
|
@ -78,6 +78,7 @@ async function mountApp(basePath: string, pathname: string, spaceId?: string) {
|
|||
getRolesAPIClient: jest.fn(),
|
||||
getPrivilegesAPIClient: jest.fn(),
|
||||
eventTracker,
|
||||
isServerless: false,
|
||||
})
|
||||
.mount({
|
||||
basePath,
|
||||
|
@ -102,6 +103,7 @@ describe('spacesManagementApp', () => {
|
|||
getRolesAPIClient: jest.fn(),
|
||||
getPrivilegesAPIClient: jest.fn(),
|
||||
eventTracker,
|
||||
isServerless: false,
|
||||
})
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
|
@ -126,7 +128,7 @@ describe('spacesManagementApp', () => {
|
|||
css="You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop)."
|
||||
data-test-subj="kbnRedirectAppLink"
|
||||
>
|
||||
Spaces Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{}},"serverBasePath":"","history":{"action":"PUSH","length":1,"location":{"pathname":"/","search":"","hash":""}},"maxSpaces":1000,"allowSolutionVisibility":true}
|
||||
Spaces Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{}},"serverBasePath":"","history":{"action":"PUSH","length":1,"location":{"pathname":"/","search":"","hash":""}},"maxSpaces":1000,"allowSolutionVisibility":true,"isServerless":false}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
|
|
@ -36,6 +36,7 @@ interface CreateParams {
|
|||
getRolesAPIClient: () => Promise<RolesAPIClient>;
|
||||
eventTracker: EventTracker;
|
||||
getPrivilegesAPIClient: () => Promise<PrivilegesAPIClientPublicContract>;
|
||||
isServerless: boolean;
|
||||
}
|
||||
|
||||
export const spacesManagementApp = Object.freeze({
|
||||
|
@ -48,6 +49,7 @@ export const spacesManagementApp = Object.freeze({
|
|||
eventTracker,
|
||||
getRolesAPIClient,
|
||||
getPrivilegesAPIClient,
|
||||
isServerless,
|
||||
}: CreateParams) {
|
||||
const title = i18n.translate('xpack.spaces.displayName', {
|
||||
defaultMessage: 'Spaces',
|
||||
|
@ -92,6 +94,7 @@ export const spacesManagementApp = Object.freeze({
|
|||
getUrlForApp={application.getUrlForApp}
|
||||
maxSpaces={config.maxSpaces}
|
||||
allowSolutionVisibility={config.allowSolutionVisibility}
|
||||
isServerless={isServerless}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -129,6 +129,7 @@ export class SpacesPlugin implements Plugin<SpacesPluginSetup, SpacesPluginStart
|
|||
getRolesAPIClient,
|
||||
eventTracker: this.eventTracker,
|
||||
getPrivilegesAPIClient,
|
||||
isServerless: this.isServerless,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue