Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Search] Enable AI Assistant in Search solution view #198941

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand All @@ -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]));
Expand Down