-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SecuritySolution] Register AI Assistant management settings according to productFeatureKeys #213105
base: main
Are you sure you want to change the base?
[SecuritySolution] Register AI Assistant management settings according to productFeatureKeys #213105
Changes from 2 commits
6ae9b0b
e5fdb46
82c6210
5b268f8
82a297d
7efa0f3
666ef4f
93a2c5c
5612a56
9025334
68d2c9e
6a0d714
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -61,6 +61,7 @@ import { PluginContract } from './plugin_contract'; | |||||
import { PluginServices } from './plugin_services'; | ||||||
import { getExternalReferenceAttachmentEndpointRegular } from './cases/attachments/external_reference'; | ||||||
import { hasAccessToSecuritySolution } from './helpers_access'; | ||||||
import { ProductFeatureAssistantKey } from '../../../packages/features/src/product_features_keys'; | ||||||
|
||||||
export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, StartPlugins> { | ||||||
private config: SecuritySolutionUiConfigType; | ||||||
|
@@ -99,6 +100,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S | |||||
this.services.setup(core, plugins); | ||||||
|
||||||
const { home, usageCollection, management, cases } = plugins; | ||||||
const { productFeatureKeys$ } = this.contract; | ||||||
|
||||||
// Lazily instantiate subPlugins and initialize services | ||||||
const mountDependencies = async (params?: AppMountParameters) => { | ||||||
|
@@ -183,23 +185,33 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S | |||||
category: 'admin', | ||||||
}); | ||||||
|
||||||
management?.sections.section.kibana.registerApp({ | ||||||
id: 'securityAiAssistantManagement', | ||||||
title: ASSISTANT_MANAGEMENT_TITLE, | ||||||
hideFromSidebar: true, | ||||||
order: 1, | ||||||
mount: async (params) => { | ||||||
const { renderApp, services, store } = await mountDependencies(); | ||||||
const { ManagementSettings } = await this.lazyAssistantSettingsManagement(); | ||||||
|
||||||
return renderApp({ | ||||||
...params, | ||||||
services, | ||||||
store, | ||||||
usageCollection, | ||||||
children: <ManagementSettings />, | ||||||
productFeatureKeys$.subscribe((productFeatureKeys) => { | ||||||
// initial value is null, then it is set as an array in serverless/ess plugin | ||||||
console.log('productFeatureKeys---',productFeatureKeys); | ||||||
// This seemed to work with serverless but not sure how to deal with ess productFeatureKeys | ||||||
|
||||||
const isInProductFeatureKeys = productFeatureKeys && productFeatureKeys.length > 0 && productFeatureKeys.includes(ProductFeatureAssistantKey.assistant); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we define the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to have some control to prevent registering this twice, in case more values are emitted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I check the registration by its id, wdyt? https://github.com/elastic/kibana/pull/213105/files#diff-fa30014b439035af4cc4c875257fb2707ebbeb2f77acb875273129f163db013dR192 |
||||||
if (isInProductFeatureKeys) { | ||||||
console.log('======registering assistant management======'); | ||||||
management?.sections.section.kibana.registerApp({ | ||||||
id: 'securityAiAssistantManagement', | ||||||
title: ASSISTANT_MANAGEMENT_TITLE, | ||||||
hideFromSidebar: true, | ||||||
order: 1, | ||||||
mount: async (params) => { | ||||||
const { renderApp, services, store } = await mountDependencies(); | ||||||
const { ManagementSettings } = await this.lazyAssistantSettingsManagement(); | ||||||
|
||||||
return renderApp({ | ||||||
...params, | ||||||
services, | ||||||
store, | ||||||
usageCollection, | ||||||
children: <ManagementSettings />, | ||||||
}); | ||||||
}, | ||||||
}); | ||||||
}, | ||||||
} | ||||||
}); | ||||||
|
||||||
cases?.attachmentFramework.registerExternalReference( | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import { | |
} from '../common/experimental_features'; | ||
import { setOnboardingSettings } from './onboarding'; | ||
import { getAdditionalChargesMessage } from './components/additional_charges_message'; | ||
import { getProductProductFeatures } from '../common/pli/pli_features'; | ||
|
||
export class SecuritySolutionServerlessPlugin | ||
implements | ||
|
@@ -47,12 +48,15 @@ export class SecuritySolutionServerlessPlugin | |
setupDeps: SecuritySolutionServerlessPluginSetupDeps | ||
): SecuritySolutionServerlessPluginSetup { | ||
const { securitySolution } = setupDeps; | ||
const { productTypes } = this.config; | ||
|
||
this.experimentalFeatures = parseExperimentalConfigValue( | ||
this.config.enableExperimental, | ||
securitySolution.experimentalFeatures | ||
).features; | ||
|
||
console.log('serverless setup: setProductFeatureKeys====== ') | ||
securitySolution.setProductFeatureKeys(getProductProductFeatures(productTypes)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It setProductFeatureKeys correctly for complete and essential tiers. |
||
return {}; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running sequence - serverless complete:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running sequence - serverless essentials: