From 344512f8b457d4dca6471fc6f4e0b27b697dd068 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:52:34 +1000 Subject: [PATCH] [8.x] [Security Solution] Fix the feature app list (#191965) (#194541) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution] Fix the feature app list (#191965)](https://github.com/elastic/kibana/pull/191965) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Sergi Massaneda --- .../security_solution/public/plugin.tsx | 195 ++++++++++-------- 1 file changed, 106 insertions(+), 89 deletions(-) diff --git a/x-pack/plugins/security_solution/public/plugin.tsx b/x-pack/plugins/security_solution/public/plugin.tsx index f7c35fbcb99f5..9833414b7a31f 100644 --- a/x-pack/plugins/security_solution/public/plugin.tsx +++ b/x-pack/plugins/security_solution/public/plugin.tsx @@ -17,7 +17,7 @@ import type { PluginInitializerContext, Plugin as IPlugin, } from '@kbn/core/public'; -import { DEFAULT_APP_CATEGORIES } from '@kbn/core/public'; +import { AppStatus, DEFAULT_APP_CATEGORIES } from '@kbn/core/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import type { TriggersAndActionsUIPublicPluginSetup } from '@kbn/triggers-actions-ui-plugin/public'; import { uiMetricService } from '@kbn/cloud-security-posture-common/utils/ui_metrics'; @@ -208,81 +208,8 @@ export class Plugin implements IPlugin { if (!this._subPlugins) { const { subPluginClasses } = await this.lazySubPlugins(); @@ -317,9 +249,6 @@ export class Plugin implements IPlugin ({ + status: AppStatus.inaccessible, + visibleIn: [], + })); + // no need to register the links updater when the plugin is inaccessible + return; + } + + // Configuration of AppLinks updater registration based on license and capabilities const { appLinks: initialAppLinks, getFilteredLinks, solutionAppLinksSwitcher, } = await this.lazyApplicationLinks(); - const { license$ } = plugins.licensing; - const { upsellingService, isSolutionNavigationEnabled$ } = this.contract; registerDeepLinksUpdater(this.appUpdater$, isSolutionNavigationEnabled$); - const appLinks$ = new Subject(); - appLinks$.next(initialAppLinks); + const appLinksToUpdate$ = new Subject(); + appLinksToUpdate$.next(initialAppLinks); - appLinks$ + appLinksToUpdate$ .pipe(combineLatestWith(license$, isSolutionNavigationEnabled$)) .subscribe(([appLinks, license, isSolutionNavigationEnabled]) => { const links = isSolutionNavigationEnabled ? solutionAppLinksSwitcher(appLinks) : appLinks; const linksPermissions: LinksPermissions = { experimentalFeatures: this.experimentalFeatures, upselling: upsellingService, - capabilities: core.application.capabilities, + capabilities, uiSettingsClient: core.uiSettings, ...(license.type != null && { license }), }; @@ -437,7 +379,82 @@ export class Plugin implements IPlugin