[8.x] [Search] Enable AI Assistant in Search solution view (#198941) (#199042)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Search] Enable AI Assistant in Search solution view
(#198941)](https://github.com/elastic/kibana/pull/198941)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sander
Philipse","email":"94373878+sphilipse@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-05T18:19:11Z","message":"[Search]
Enable AI Assistant in Search solution view (#198941)\n\n##
Summary\r\n\r\nThis enables the Observability AI Assistant (which is
also the Search AI\r\nAssistant) in the Search solution
view.","sha":"62d16709e42e9282dc7235bb4a4fb6b008483021","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Search","v8.16.0","backport:version","v8.17.0"],"title":"[Search]
Enable AI Assistant in Search solution
view","number":198941,"url":"https://github.com/elastic/kibana/pull/198941","mergeCommit":{"message":"[Search]
Enable AI Assistant in Search solution view (#198941)\n\n##
Summary\r\n\r\nThis enables the Observability AI Assistant (which is
also the Search AI\r\nAssistant) in the Search solution
view.","sha":"62d16709e42e9282dc7235bb4a4fb6b008483021"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198941","number":198941,"mergeCommit":{"message":"[Search]
Enable AI Assistant in Search solution view (#198941)\n\n##
Summary\r\n\r\nThis enables the Observability AI Assistant (which is
also the Search AI\r\nAssistant) in the Search solution
view.","sha":"62d16709e42e9282dc7235bb4a4fb6b008483021"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sander Philipse <94373878+sphilipse@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-11-06 07:05:59 +11:00 committed by GitHub
parent ee77e0387b
commit 7c8fe2fda3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 6 deletions

View file

@ -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<SolutionId, string[]> = {
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]));

View file

@ -80,7 +80,6 @@ export function createTestSuiteFactory(esArchiver: any, supertest: SuperTest<any
'infrastructure',
'inventory',
'logs',
'observabilityAIAssistant',
'observabilityCases',
'securitySolutionAssistant',
'securitySolutionAttackDiscovery',

View file

@ -84,7 +84,6 @@ export function getTestSuiteFactory(esArchiver: any, supertest: SuperAgent<any>)
'infrastructure',
'inventory',
'logs',
'observabilityAIAssistant',
'observabilityCases',
'securitySolutionAssistant',
'securitySolutionAttackDiscovery',

View file

@ -79,7 +79,6 @@ const ALL_SPACE_RESULTS: Space[] = [
'infrastructure',
'inventory',
'logs',
'observabilityAIAssistant',
'observabilityCases',
'securitySolutionAssistant',
'securitySolutionAttackDiscovery',