MM-67095: Hide Workspace Optimization for cloud-licensed workspaces (#36077)

Made-with: Cursor
This commit is contained in:
Nick Misasi
2026-04-14 10:02:07 -04:00
committed by GitHub
parent 01219efbf4
commit 5af77b7e08
2 changed files with 17 additions and 2 deletions
@@ -343,7 +343,10 @@ const AdminDefinition: AdminDefinitionType = {
id: 'WorkspaceOptimizationDashboard',
component: WorkspaceOptimizationDashboard,
},
isHidden: it.not(it.userHasReadPermissionOnResource(RESOURCE_KEYS.REPORTING.SITE_STATISTICS)),
isHidden: it.any(
it.not(it.userHasReadPermissionOnResource(RESOURCE_KEYS.REPORTING.SITE_STATISTICS)),
it.licensedForFeature('Cloud'),
),
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.REPORTING.SITE_STATISTICS)),
},
system_analytics: {
@@ -12,7 +12,7 @@ import AdminSidebar from 'components/admin_console/admin_sidebar/admin_sidebar';
import type {Props as OriginalProps} from 'components/admin_console/admin_sidebar/admin_sidebar';
import {samplePlugin1} from 'tests/helpers/admin_console_plugin_index_sample_pluings';
import {renderWithContext, userEvent} from 'tests/react_testing_utils';
import {renderWithContext, screen, userEvent} from 'tests/react_testing_utils';
import {generateIndex} from 'utils/admin_console_index';
jest.mock('utils/utils', () => {
@@ -129,6 +129,18 @@ describe('components/AdminSidebar', () => {
expect(container).toMatchSnapshot();
});
test('should not show Workspace Optimization when Cloud license feature is enabled', () => {
const props = {
...defaultProps,
license: {
IsLicensed: 'true',
Cloud: 'true',
},
};
renderWithContext(<AdminSidebar {...props}/>);
expect(screen.queryByText('Workspace Optimization')).not.toBeInTheDocument();
});
test('should match snapshot, no access', () => {
const props = {
...defaultProps,