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

Hide assistant's knowledge base UI when assistantKnowledgeBaseByDefault feature flag is disabled #196762

Merged
merged 7 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -9,11 +9,13 @@ import type { ProductFeatureParams } from '../types';
import { getAssistantBaseKibanaFeature } from './kibana_features';
import {
getAssistantBaseKibanaSubFeatureIds,
assistantSubFeaturesMap,
getAssistantSubFeaturesMap,
} from './kibana_sub_features';

export const getAssistantFeature = (): ProductFeatureParams<AssistantSubFeatureId> => ({
export const getAssistantFeature = (
experimentalFeatures: Record<string, boolean>
): ProductFeatureParams<AssistantSubFeatureId> => ({
baseKibanaFeature: getAssistantBaseKibanaFeature(),
baseKibanaSubFeatureIds: getAssistantBaseKibanaSubFeatureIds(),
subFeaturesMap: assistantSubFeaturesMap,
subFeaturesMap: getAssistantSubFeaturesMap(experimentalFeatures),
});
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,28 @@ export const getAssistantBaseKibanaSubFeatureIds = (): AssistantSubFeatureId[] =
* Defines all the Security Assistant subFeatures available.
* The order of the subFeatures is the order they will be displayed
*/
export const assistantSubFeaturesMap = Object.freeze(
new Map<AssistantSubFeatureId, SubFeatureConfig>([
export const getAssistantSubFeaturesMap = (
experimentalFeatures: Record<string, boolean>
): Map<AssistantSubFeatureId, SubFeatureConfig> => {
const assistantSubFeaturesList: Array<[AssistantSubFeatureId, SubFeatureConfig]> = [
[AssistantSubFeatureId.updateAnonymization, updateAnonymizationSubFeature],
[AssistantSubFeatureId.manageGlobalKnowledgeBase, manageGlobalKnowledgeBaseSubFeature],
])
);
];

// Use the following code to add feature based on feature flag
// if (experimentalFeatures.featureFlagName) {
// assistantSubFeaturesList.push([AssistantSubFeatureId.featureId, featureSubFeature]);
// }

if (experimentalFeatures.assistantKnowledgeBaseByDefault) {
assistantSubFeaturesList.push([
AssistantSubFeatureId.manageGlobalKnowledgeBase,
manageGlobalKnowledgeBaseSubFeature,
]);
}

const assistantSubFeaturesMap = new Map<AssistantSubFeatureId, SubFeatureConfig>(
assistantSubFeaturesList
);

return Object.freeze(assistantSubFeaturesMap);
};
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ProductFeaturesService {
casesFeature.baseKibanaSubFeatureIds
);

const assistantFeature = getAssistantFeature();
const assistantFeature = getAssistantFeature(this.experimentalFeatures);
this.securityAssistantProductFeatures = new ProductFeatures(
this.logger,
assistantFeature.subFeaturesMap,
Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/api_integration/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export async function getApiIntegrationConfig({ readConfigFile }: FtrConfigProvi
'--xpack.ruleRegistry.write.enabled=true',
'--xpack.ruleRegistry.write.enabled=true',
'--xpack.ruleRegistry.write.cache.enabled=false',
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'assistantKnowledgeBaseByDefault',
])}`,
'--monitoring_collection.opentelemetry.metrics.prometheus.enabled=true',
],
},
Expand Down