diff --git a/x-pack/plugins/spaces/server/lib/utils/space_solution_disabled_features.ts b/x-pack/plugins/spaces/server/lib/utils/space_solution_disabled_features.ts index 4e66260f3d057..066166e7e87dd 100644 --- a/x-pack/plugins/spaces/server/lib/utils/space_solution_disabled_features.ts +++ b/x-pack/plugins/spaces/server/lib/utils/space_solution_disabled_features.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import type { SolutionId } from '@kbn/core-chrome-browser'; import type { KibanaFeature } from '@kbn/features-plugin/server'; import type { SolutionView } from '../../../common'; @@ -23,6 +24,16 @@ const getFeatureIdsForCategories = ( .map((feature) => feature.id); }; +/** + * These features will be enabled per solution view, even if they fall under a category that is disabled in the solution. + */ + +const enabledFeaturesPerSolution: Record = { + es: ['observabilityAIAssistant'], + oblt: [], + security: [], +}; + /** * When a space has a `solution` defined, we want to disable features that are not part of that solution. * This function takes the current space's disabled features and the space solution and returns @@ -47,17 +58,17 @@ export function withSpaceSolutionDisabledFeatures( disabledFeatureKeysFromSolution = getFeatureIdsForCategories(features, [ 'observability', 'securitySolution', - ]); + ]).filter((featureId) => !enabledFeaturesPerSolution.es.includes(featureId)); } else if (spaceSolution === 'oblt') { disabledFeatureKeysFromSolution = getFeatureIdsForCategories(features, [ 'enterpriseSearch', 'securitySolution', - ]); + ]).filter((featureId) => !enabledFeaturesPerSolution.oblt.includes(featureId)); } else if (spaceSolution === 'security') { disabledFeatureKeysFromSolution = getFeatureIdsForCategories(features, [ 'observability', 'enterpriseSearch', - ]); + ]).filter((featureId) => !enabledFeaturesPerSolution.security.includes(featureId)); } return Array.from(new Set([...disabledFeatureKeysFromSolution])); diff --git a/x-pack/test/spaces_api_integration/common/suites/create.ts b/x-pack/test/spaces_api_integration/common/suites/create.ts index 3c65ba8aba156..795d177805f89 100644 --- a/x-pack/test/spaces_api_integration/common/suites/create.ts +++ b/x-pack/test/spaces_api_integration/common/suites/create.ts @@ -80,7 +80,6 @@ export function createTestSuiteFactory(esArchiver: any, supertest: SuperTest) 'infrastructure', 'inventory', 'logs', - 'observabilityAIAssistant', 'observabilityCases', 'securitySolutionAssistant', 'securitySolutionAttackDiscovery', diff --git a/x-pack/test/spaces_api_integration/common/suites/get_all.ts b/x-pack/test/spaces_api_integration/common/suites/get_all.ts index 236c98d9364b9..b90128ab12c70 100644 --- a/x-pack/test/spaces_api_integration/common/suites/get_all.ts +++ b/x-pack/test/spaces_api_integration/common/suites/get_all.ts @@ -79,7 +79,6 @@ const ALL_SPACE_RESULTS: Space[] = [ 'infrastructure', 'inventory', 'logs', - 'observabilityAIAssistant', 'observabilityCases', 'securitySolutionAssistant', 'securitySolutionAttackDiscovery',