diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_feature_selector.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_feature_selector.tsx index e172b851f1f3..863449627b33 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_feature_selector.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_feature_selector.tsx @@ -20,7 +20,7 @@ import { DEFAULT_APP_CATEGORIES, PublicAppInfo } from '../../../../../core/publi import { WorkspaceFeature, WorkspaceFeatureGroup } from './types'; import { isDefaultCheckedFeatureId, isWorkspaceFeatureGroup } from './utils'; -import { getAllExcludingManagementApps } from '../../utils'; +import { getAllIncludingDashboardsManagementApps } from '../../utils'; const libraryCategoryLabel = i18n.translate('core.ui.libraryNavList.label', { defaultMessage: 'Library', @@ -55,7 +55,7 @@ export const WorkspaceFeatureSelector = ({ Array >((previousValue, currentKey) => { const apps = category2Applications[currentKey]; - const features = getAllExcludingManagementApps(apps).map(({ id, title }) => ({ + const features = getAllIncludingDashboardsManagementApps(apps).map(({ id, title }) => ({ id, name: title, })); diff --git a/src/plugins/workspace/public/utils.test.ts b/src/plugins/workspace/public/utils.test.ts index 80f278e8e284..2aee3b2b94d8 100644 --- a/src/plugins/workspace/public/utils.test.ts +++ b/src/plugins/workspace/public/utils.test.ts @@ -141,19 +141,32 @@ describe('workspace utils: getSelectedFeatureQuantities', () => { status: 0, workspaceAccessibility: WorkspaceAccessibility.NO, }, + { + appRoute: '/app/management', + id: 'management', + title: 'Dashboards Management', + category: { + id: 'management', + label: 'Management', + order: 5000, + euiIconType: 'managementApp', + }, + status: 0, + navLinkStatus: 1, + }, ] as PublicAppInfo[]; - it('should support * rules and exclude management category', () => { + it('should support * rules and include dashboards management', () => { const { total, selected } = getSelectedFeatureQuantities(['*'], defaultApplications); - expect(total).toBe(1); - expect(selected).toBe(1); + expect(total).toBe(2); + expect(selected).toBe(2); }); - it('should get quantity normally and exclude management category', () => { + it('should get quantity normally and include dashboards management', () => { const { total, selected } = getSelectedFeatureQuantities( ['dev_tools', '!@management'], defaultApplications ); - expect(total).toBe(1); + expect(total).toBe(2); expect(selected).toBe(0); }); }); diff --git a/src/plugins/workspace/public/utils.ts b/src/plugins/workspace/public/utils.ts index a305e9334e12..0814c160eab9 100644 --- a/src/plugins/workspace/public/utils.ts +++ b/src/plugins/workspace/public/utils.ts @@ -70,7 +70,9 @@ export const featureMatchesConfig = (featureConfigs: string[]) => ({ }; // Get all apps excluding management category -export const getAllExcludingManagementApps = (applications: PublicAppInfo[]): PublicAppInfo[] => { +export const getAllIncludingDashboardsManagementApps = ( + applications: PublicAppInfo[] +): PublicAppInfo[] => { return applications.filter( ({ navLinkStatus, chromeless, category, workspaceAccessibility, id }) => { const filterCondition = @@ -90,7 +92,7 @@ export const getSelectedFeatureQuantities = ( featuresConfig: string[], applications: PublicAppInfo[] ) => { - const visibleApplications = getAllExcludingManagementApps(applications); + const visibleApplications = getAllIncludingDashboardsManagementApps(applications); const featureFilter = featureMatchesConfig(featuresConfig); const selectedApplications = visibleApplications.filter((app) => featureFilter(app)); return {