[Stateful sidenav] Add deeplink definitions & hide page side nav (#178861)

This commit is contained in:
Sébastien Loix 2024-03-20 12:39:47 +00:00 committed by GitHub
parent be9ad681ba
commit 37dee75e31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 392 additions and 134 deletions

5
.github/CODEOWNERS vendored
View file

@ -339,10 +339,13 @@ x-pack/plugins/observability_solution/dataset_quality @elastic/obs-ux-logs-team
packages/kbn-datemath @elastic/kibana-data-discovery
packages/deeplinks/analytics @elastic/kibana-data-discovery @elastic/kibana-presentation @elastic/kibana-visualizations
packages/deeplinks/devtools @elastic/kibana-management
packages/deeplinks/fleet @elastic/fleet
packages/deeplinks/management @elastic/kibana-management
packages/deeplinks/ml @elastic/ml-ui
packages/deeplinks/observability @elastic/obs-ux-logs-team
packages/deeplinks/search @elastic/enterprise-search-frontend
packages/deeplinks/security @elastic/security-solution
packages/deeplinks/shared @elastic/appex-sharedux
packages/default-nav/analytics @elastic/kibana-data-discovery @elastic/kibana-presentation @elastic/kibana-visualizations
packages/default-nav/devtools @elastic/kibana-management
packages/default-nav/management @elastic/kibana-management
@ -722,7 +725,7 @@ packages/kbn-server-http-tools @elastic/kibana-core
packages/kbn-server-route-repository @elastic/obs-knowledge-team
x-pack/plugins/serverless @elastic/appex-sharedux
packages/serverless/settings/common @elastic/appex-sharedux @elastic/kibana-management
x-pack/plugins/serverless_observability @elastic/appex-sharedux @elastic/obs-ux-management-team
x-pack/plugins/serverless_observability @elastic/obs-ux-management-team
packages/serverless/settings/observability_project @elastic/appex-sharedux @elastic/kibana-management @elastic/obs-ux-management-team
packages/serverless/project_switcher @elastic/appex-sharedux
x-pack/plugins/serverless_search @elastic/enterprise-search-frontend

View file

@ -89,7 +89,10 @@
"packages/kbn-management"
],
"monaco": "packages/kbn-monaco/src",
"navigation": "src/plugins/navigation",
"navigation": [
"src/plugins/navigation",
"packages/solution-nav"
],
"links": "src/plugins/links",
"newsfeed": "src/plugins/newsfeed",
"presentationUtil": "src/plugins/presentation_util",

View file

@ -20,7 +20,6 @@ xpack.securitySolutionServerless.productTypes:
]
xpack.securitySolution.offeringSettings: {
sideNavEnabled: false, # Internal security side navigation disabled, the serverless global chrome navigation is used instead
ILMEnabled: false, # Index Lifecycle Management (ILM) functionalities disabled, not supported by serverless Elasticsearch
ESQLEnabled: false, # ES|QL disabled, not supported by serverless Elasticsearch
}

View file

@ -392,10 +392,13 @@
"@kbn/datemath": "link:packages/kbn-datemath",
"@kbn/deeplinks-analytics": "link:packages/deeplinks/analytics",
"@kbn/deeplinks-devtools": "link:packages/deeplinks/devtools",
"@kbn/deeplinks-fleet": "link:packages/deeplinks/fleet",
"@kbn/deeplinks-management": "link:packages/deeplinks/management",
"@kbn/deeplinks-ml": "link:packages/deeplinks/ml",
"@kbn/deeplinks-observability": "link:packages/deeplinks/observability",
"@kbn/deeplinks-search": "link:packages/deeplinks/search",
"@kbn/deeplinks-security": "link:packages/deeplinks/security",
"@kbn/deeplinks-shared": "link:packages/deeplinks/shared",
"@kbn/default-nav-analytics": "link:packages/default-nav/analytics",
"@kbn/default-nav-devtools": "link:packages/default-nav/devtools",
"@kbn/default-nav-management": "link:packages/default-nav/management",

View file

@ -230,6 +230,7 @@ export class ProjectNavigationService {
this.navigationChangeSubscription.unsubscribe();
}
let redirectLocation = location;
this.projectNavigationNavTreeFlattened = {};
this.navigationChangeSubscription = combineLatest([
navTreeDefinition$,
@ -251,7 +252,8 @@ export class ProjectNavigationService {
this.navigationTreeUi$.next(navigationTreeUI);
this.projectNavigationNavTreeFlattened = flattenNav(navigationTree);
this.updateActiveProjectNavigationNodes(location);
this.updateActiveProjectNavigationNodes(redirectLocation);
redirectLocation = undefined; // we don't want to redirect on subsequent changes, only when initiating
},
error: (err) => {
this.logger?.error(err);

View file

@ -29,7 +29,7 @@ export const getSolutionNavSwitcherBreadCrumb = ({
return {
text,
'data-test-subj': 'solutionNavSwitcher',
popoverContent: (
popoverContent: (closePopover) => (
<>
<EuiTitle size="xxxs">
<h3>
@ -49,6 +49,7 @@ export const getSolutionNavSwitcherBreadCrumb = ({
data-test-subj={`solutionNavSwitcher-${id}`}
onClick={() => {
onChange(id, { redirect: true });
closePopover();
}}
/>,
])}

View file

@ -25,6 +25,9 @@ import type {
AppId as ObservabilityApp,
DeepLinkId as ObservabilityLink,
} from '@kbn/deeplinks-observability';
import type { AppId as SecurityApp, DeepLinkId as SecurityLink } from '@kbn/deeplinks-security';
import type { AppId as FleetApp, DeepLinkId as FleetLink } from '@kbn/deeplinks-fleet';
import type { AppId as SharedApp, DeepLinkId as SharedLink } from '@kbn/deeplinks-shared';
import type { ChromeBreadcrumb } from './breadcrumb';
import type { ChromeNavLink } from './nav_links';
@ -37,7 +40,10 @@ export type AppId =
| MlApp
| ManagementApp
| SearchApp
| ObservabilityApp;
| ObservabilityApp
| SecurityApp
| FleetApp
| SharedApp;
/** @public */
export type AppDeepLinkId =
@ -46,7 +52,10 @@ export type AppDeepLinkId =
| MlLink
| ManagementLink
| SearchLink
| ObservabilityLink;
| ObservabilityLink
| SecurityLink
| FleetLink
| SharedLink;
/** @public */
export type CloudLinkId =

View file

@ -20,7 +20,10 @@
"@kbn/deeplinks-management",
"@kbn/deeplinks-search",
"@kbn/deeplinks-observability",
"@kbn/core-application-browser"
"@kbn/core-application-browser",
"@kbn/deeplinks-security",
"@kbn/deeplinks-fleet",
"@kbn/deeplinks-shared"
],
"exclude": [
"target/**/*",

View file

@ -0,0 +1,3 @@
# @kbn/deeplinks-fleet
Empty package generated by @kbn/generate

View file

@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export const FLEET_APP_ID = 'fleet';
export type AppId = typeof FLEET_APP_ID;
export type LinkId =
| 'agents'
| 'policies'
| 'enrollment_tokens'
| 'uninstall_tokens'
| 'data_streams'
| 'settings';
export type DeepLinkId = AppId | `${AppId}:${LinkId}`;

View file

@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export type { LinkId, AppId, DeepLinkId } from './deep_links';

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/packages/deeplinks/fleet'],
};

View file

@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/deeplinks-fleet",
"owner": "@elastic/fleet"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/deeplinks-fleet",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -0,0 +1,19 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}

View file

@ -33,15 +33,22 @@ export type ManagementId =
| 'cases'
| 'cross_cluster_replication'
| 'dataViews'
| 'filesManagement'
| 'license_management'
| 'index_lifecycle_management'
| 'index_management'
| 'ingest_pipelines'
| 'jobsListLink'
| 'maintenanceWindows'
| 'migrate_data'
| 'objects'
| 'pipelines'
| 'remote_clusters'
| 'reporting'
| 'role_mappings'
| 'roles'
| 'rollup_jobs'
| 'search_sessions'
| 'settings'
| 'snapshot_restore'
| 'spaces'
@ -49,6 +56,8 @@ export type ManagementId =
| 'transform'
| 'triggersActions'
| 'triggersActionsConnectors'
| 'upgrade_assistant'
| 'users'
| 'watcher';
export type ManagementDeepLinkId = MonitoringAppId | `${ManagementAppId}:${ManagementId}`;

View file

@ -0,0 +1,3 @@
# @kbn/deeplinks-security
Empty package generated by @kbn/generate

View file

@ -0,0 +1,84 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export enum SecurityPageName {
administration = 'administration',
alerts = 'alerts',
assets = 'assets',
blocklist = 'blocklist',
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All Cases page names must match `CasesDeepLinkId` in x-pack/plugins/cases/public/common/navigation/deep_links.ts
*/
case = 'cases', // must match `CasesDeepLinkId.cases`
caseConfigure = 'cases_configure', // must match `CasesDeepLinkId.casesConfigure`
caseCreate = 'cases_create', // must match `CasesDeepLinkId.casesCreate`
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All cloud security posture page names must match `CloudSecurityPosturePageId` in x-pack/plugins/cloud_security_posture/public/common/navigation/types.ts
*/
cloudSecurityPostureBenchmarks = 'cloud_security_posture-benchmarks',
cloudSecurityPostureDashboard = 'cloud_security_posture-dashboard',
cloudSecurityPostureFindings = 'cloud_security_posture-findings',
cloudSecurityPostureRules = 'cloud_security_posture-rules',
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All cloud defend page names must match `CloudDefendPageId` in x-pack/plugins/cloud_defend/public/common/navigation/types.ts
*/
cloudDefend = 'cloud_defend',
cloudDefendPolicies = 'cloud_defend-policies',
dashboards = 'dashboards',
dataQuality = 'data_quality',
detections = 'detections',
detectionAndResponse = 'detection_response',
endpoints = 'endpoints',
eventFilters = 'event_filters',
exceptions = 'exceptions',
exploreLanding = 'explore',
hostIsolationExceptions = 'host_isolation_exceptions',
hosts = 'hosts',
hostsAnomalies = 'hosts-anomalies',
hostsRisk = 'hosts-risk',
hostsEvents = 'hosts-events',
investigations = 'investigations',
kubernetes = 'kubernetes',
landing = 'get_started',
mlLanding = 'machine_learning-landing', // serverless only
network = 'network',
networkAnomalies = 'network-anomalies',
networkDns = 'network-dns',
networkEvents = 'network-events',
networkHttp = 'network-http',
networkTls = 'network-tls',
noPage = '',
overview = 'overview',
policies = 'policy',
responseActionsHistory = 'response_actions_history',
rules = 'rules',
rulesAdd = 'rules-add',
rulesCreate = 'rules-create',
rulesLanding = 'rules-landing',
sessions = 'sessions',
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All threat intelligence page names must match `TIPageId` in x-pack/plugins/threat_intelligence/public/common/navigation/types.ts
*/
threatIntelligence = 'threat_intelligence',
timelines = 'timelines',
timelinesTemplates = 'timelines-templates',
trustedApps = 'trusted_apps',
uncommonProcesses = 'uncommon_processes',
users = 'users',
usersAnomalies = 'users-anomalies',
usersAuthentications = 'users-authentications',
usersEvents = 'users-events',
usersRisk = 'users-risk',
entityAnalytics = 'entity_analytics',
entityAnalyticsManagement = 'entity_analytics-management',
coverageOverview = 'coverage-overview',
}

View file

@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { SecurityPageName } from './deep_links';
export { SecurityPageName } from './deep_links';
export const SECURITY_APP_ID = 'securitySolutionUI';
export type AppId = typeof SECURITY_APP_ID;
export type LinkId = `${SecurityPageName}`;
export type DeepLinkId = AppId | `${AppId}:${LinkId}`;

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/packages/deeplinks/security'],
};

View file

@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/deeplinks-security",
"owner": "@elastic/security-solution"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/deeplinks-security",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -0,0 +1,19 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}

View file

@ -0,0 +1,3 @@
# @kbn/deeplinks-shared
Empty package generated by @kbn/generate

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export const HOME_APP_ID = 'home';
export type AppId = typeof HOME_APP_ID;
export type DeepLinkId = AppId;

View file

@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export type { AppId, DeepLinkId } from './deep_links';

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/packages/deeplinks/shared'],
};

View file

@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/deeplinks-shared",
"owner": "@elastic/appex-sharedux"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/deeplinks-shared",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -0,0 +1,19 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}

View file

@ -42,7 +42,6 @@ const createSetupContract = (): ManagementSetup => ({
});
const createStartContract = (): ManagementStart => ({
setIsSidebarEnabled: jest.fn(),
setupCardsNavigation: jest.fn(),
});

View file

@ -138,6 +138,12 @@ export class ManagementPlugin
},
});
core.getStartServices().then(([coreStart]) => {
coreStart.chrome
.getChromeStyle$()
.subscribe((style) => this.isSidebarEnabled$.next(style === 'classic'));
});
return {
sections: this.managementSections.setup(),
locator,
@ -160,8 +166,6 @@ export class ManagementPlugin
}
return {
setIsSidebarEnabled: (isSidebarEnabled: boolean) =>
this.isSidebarEnabled$.next(isSidebarEnabled),
setupCardsNavigation: ({ enabled, hideLinksTo, extendCardNavDefinitions }) =>
this.cardsNavigationConfig$.next({ enabled, hideLinksTo, extendCardNavDefinitions }),
};

View file

@ -29,7 +29,6 @@ export interface DefinedSections {
}
export interface ManagementStart {
setIsSidebarEnabled: (enabled: boolean) => void;
setupCardsNavigation: ({
enabled,
hideLinksTo,

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import React from 'react';
import { combineLatest, debounceTime, of, ReplaySubject, takeUntil } from 'rxjs';
import { combineLatest, debounceTime, ReplaySubject, takeUntil } from 'rxjs';
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type {
@ -103,35 +103,6 @@ export class NavigationPublicPlugin
chrome.project.setCloudUrls(cloud);
this.addDefaultSolutionNavigation({ chrome });
this.susbcribeToSolutionNavUiSettings(core);
// Temp. This is temporary to simulate adding a solution nav after bootstrapping
setTimeout(() => {
this.addSolutionNavigation({
id: 'security',
title: 'Security',
icon: 'logoSecurity',
homePage: 'dashboards', // Temp. Wil be updated when all links are registered
navigationTree$: of({
body: [
// Temp. In future work this will be loaded from a package
{
type: 'navGroup',
id: 'security_project_nav',
title: 'Security',
icon: 'logoSecurity',
breadcrumbStatus: 'hidden',
defaultIsCollapsed: false,
children: [
{
link: 'dashboards',
spaceBefore: 'm',
},
],
},
],
}),
});
}, 5000);
}
return {

View file

@ -672,6 +672,8 @@
"@kbn/deeplinks-analytics/*": ["packages/deeplinks/analytics/*"],
"@kbn/deeplinks-devtools": ["packages/deeplinks/devtools"],
"@kbn/deeplinks-devtools/*": ["packages/deeplinks/devtools/*"],
"@kbn/deeplinks-fleet": ["packages/deeplinks/fleet"],
"@kbn/deeplinks-fleet/*": ["packages/deeplinks/fleet/*"],
"@kbn/deeplinks-management": ["packages/deeplinks/management"],
"@kbn/deeplinks-management/*": ["packages/deeplinks/management/*"],
"@kbn/deeplinks-ml": ["packages/deeplinks/ml"],
@ -680,6 +682,10 @@
"@kbn/deeplinks-observability/*": ["packages/deeplinks/observability/*"],
"@kbn/deeplinks-search": ["packages/deeplinks/search"],
"@kbn/deeplinks-search/*": ["packages/deeplinks/search/*"],
"@kbn/deeplinks-security": ["packages/deeplinks/security"],
"@kbn/deeplinks-security/*": ["packages/deeplinks/security/*"],
"@kbn/deeplinks-shared": ["packages/deeplinks/shared"],
"@kbn/deeplinks-shared/*": ["packages/deeplinks/shared/*"],
"@kbn/default-nav-analytics": ["packages/default-nav/analytics"],
"@kbn/default-nav-analytics/*": ["packages/default-nav/analytics/*"],
"@kbn/default-nav-devtools": ["packages/default-nav/devtools"],

View file

@ -7,82 +7,7 @@
export const SECURITY_UI_APP_ID = 'securitySolutionUI' as const;
export enum SecurityPageName {
administration = 'administration',
alerts = 'alerts',
assets = 'assets',
blocklist = 'blocklist',
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All Cases page names must match `CasesDeepLinkId` in x-pack/plugins/cases/public/common/navigation/deep_links.ts
*/
case = 'cases', // must match `CasesDeepLinkId.cases`
caseConfigure = 'cases_configure', // must match `CasesDeepLinkId.casesConfigure`
caseCreate = 'cases_create', // must match `CasesDeepLinkId.casesCreate`
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All cloud security posture page names must match `CloudSecurityPosturePageId` in x-pack/plugins/cloud_security_posture/public/common/navigation/types.ts
*/
cloudSecurityPostureBenchmarks = 'cloud_security_posture-benchmarks',
cloudSecurityPostureDashboard = 'cloud_security_posture-dashboard',
cloudSecurityPostureFindings = 'cloud_security_posture-findings',
cloudSecurityPostureRules = 'cloud_security_posture-rules',
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All cloud defend page names must match `CloudDefendPageId` in x-pack/plugins/cloud_defend/public/common/navigation/types.ts
*/
cloudDefend = 'cloud_defend',
cloudDefendPolicies = 'cloud_defend-policies',
dashboards = 'dashboards',
dataQuality = 'data_quality',
detections = 'detections',
detectionAndResponse = 'detection_response',
endpoints = 'endpoints',
eventFilters = 'event_filters',
exceptions = 'exceptions',
exploreLanding = 'explore',
hostIsolationExceptions = 'host_isolation_exceptions',
hosts = 'hosts',
hostsAnomalies = 'hosts-anomalies',
hostsRisk = 'hosts-risk',
hostsEvents = 'hosts-events',
investigations = 'investigations',
kubernetes = 'kubernetes',
landing = 'get_started',
mlLanding = 'machine_learning-landing', // serverless only
network = 'network',
networkAnomalies = 'network-anomalies',
networkDns = 'network-dns',
networkEvents = 'network-events',
networkHttp = 'network-http',
networkTls = 'network-tls',
noPage = '',
overview = 'overview',
policies = 'policy',
responseActionsHistory = 'response_actions_history',
rules = 'rules',
rulesAdd = 'rules-add',
rulesCreate = 'rules-create',
rulesLanding = 'rules-landing',
sessions = 'sessions',
/*
* Warning: Computed values are not permitted in an enum with string valued members
* All threat intelligence page names must match `TIPageId` in x-pack/plugins/threat_intelligence/public/common/navigation/types.ts
*/
threatIntelligence = 'threat_intelligence',
timelines = 'timelines',
timelinesTemplates = 'timelines-templates',
trustedApps = 'trusted_apps',
uncommonProcesses = 'uncommon_processes',
users = 'users',
usersAnomalies = 'users-anomalies',
usersAuthentications = 'users-authentications',
usersEvents = 'users-events',
usersRisk = 'users-risk',
entityAnalytics = 'entity_analytics',
entityAnalyticsManagement = 'entity_analytics-management',
coverageOverview = 'coverage-overview',
}
export { SecurityPageName } from '@kbn/deeplinks-security';
export enum LinkCategoryType {
title = 'title',

View file

@ -15,6 +15,7 @@
"kbn_references": [
"@kbn/i18n",
"@kbn/core",
"@kbn/deeplinks-security"
],
"exclude": ["target/**/*"]
}

View file

@ -98,6 +98,8 @@ const App: FC<AppProps> = ({ coreStart, deps, appMountParams, isServerless, mlFe
setBreadcrumbs: coreStart.chrome!.setBreadcrumbs,
};
const chromeStyle = useObservable(coreStart.chrome.getChromeStyle$(), 'classic');
const services: StartServices = useMemo(() => {
return {
...coreStart,
@ -165,7 +167,11 @@ const App: FC<AppProps> = ({ coreStart, deps, appMountParams, isServerless, mlFe
<KibanaContextProvider services={services}>
<StorageContextProvider storage={localStorage} storageKeys={ML_STORAGE_KEYS}>
<DatePickerContextProvider {...datePickerDeps}>
<EnabledFeaturesContextProvider isServerless={isServerless} mlFeatures={mlFeatures}>
<EnabledFeaturesContextProvider
isServerless={isServerless}
mlFeatures={mlFeatures}
showMLNavMenu={chromeStyle === 'classic'}
>
<MlRouter pageDeps={pageDeps} />
</EnabledFeaturesContextProvider>
</DatePickerContextProvider>

View file

@ -29,16 +29,18 @@ export const EnabledFeaturesContext = createContext({
interface Props {
isServerless: boolean;
mlFeatures: MlFeatures;
showMLNavMenu?: boolean;
}
export const EnabledFeaturesContextProvider: FC<Props> = ({
children,
isServerless,
showMLNavMenu = true,
mlFeatures,
}) => {
const features: EnabledFeatures = {
showNodeInfo: !isServerless,
showMLNavMenu: !isServerless,
showMLNavMenu,
showLicenseInfo: !isServerless,
isADEnabled: mlFeatures.ad,
isDFAEnabled: mlFeatures.dfa,

View file

@ -39,7 +39,6 @@ export interface ObservabilitySharedStart {
spaces?: SpacesPluginStart;
cases: CasesPublicStart;
guidedOnboarding?: GuidedOnboardingPluginStart;
setIsSidebarEnabled: (isEnabled: boolean) => void;
embeddable: EmbeddableStart;
share: SharePluginStart;
}
@ -65,6 +64,12 @@ export class ObservabilitySharedPlugin implements Plugin {
}
public setup(coreSetup: CoreSetup, pluginsSetup: ObservabilitySharedSetup) {
coreSetup.getStartServices().then(([coreStart]) => {
coreStart.chrome
.getChromeStyle$()
.subscribe((style) => this.isSidebarEnabled$.next(style === 'classic'));
});
return {
locators: this.createLocators(pluginsSetup.share.url),
navigation: {
@ -93,7 +98,6 @@ export class ObservabilitySharedPlugin implements Plugin {
registerSections: this.navigationRegistry.registerSections,
},
updateGlobalNavigation,
setIsSidebarEnabled: (isEnabled: boolean) => this.isSidebarEnabled$.next(isEnabled),
};
}

View file

@ -6,7 +6,7 @@
*/
import { i18n } from '@kbn/i18n';
import { Subject, mergeMap } from 'rxjs';
import { Subject, mergeMap, firstValueFrom } from 'rxjs';
import type * as H from 'history';
import type {
AppMountParameters,
@ -197,11 +197,16 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
// @ts-expect-error
customDataService.query.filterManager._name = 'customFilterManager';
const sideNavEnabled = await this.getIsSidebarEnabled(core);
const services: StartServices = {
...coreStart,
...startPlugins,
...this.contract.getStartServices(),
configSettings: this.configSettings,
configSettings: {
...this.configSettings,
sideNavEnabled,
},
apm,
savedObjectsTagging: savedObjectsTaggingOss.getTaggingApi(),
setHeaderActionMenu: params.setHeaderActionMenu,
@ -574,4 +579,10 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
)
.subscribe();
}
private async getIsSidebarEnabled(core: CoreSetup) {
const [coreStart] = await core.getStartServices();
const chromeStyle = await firstValueFrom(coreStart.chrome.getChromeStyle$());
return chromeStyle === 'classic';
}
}

View file

@ -24,12 +24,11 @@ export const setupNavigation = (
};
export const startNavigation = (services: Services) => {
const { serverless, management } = services;
const { serverless } = services;
serverless.setProjectHome(APP_PATH);
initSideNavigation(services);
enableManagementCardsLanding(services);
management.setIsSidebarEnabled(false);
subscribeBreadcrumbs(services);
};

View file

@ -1,10 +1,7 @@
{
"type": "plugin",
"id": "@kbn/serverless-observability",
"owner": [
"@elastic/appex-sharedux",
"@elastic/obs-ux-management-team"
],
"owner": "@elastic/obs-ux-management-team",
"description": "Serverless customizations for observability.",
"plugin": {
"id": "serverlessObservability",

View file

@ -52,14 +52,12 @@ export class ServerlessObservabilityPlugin
core: CoreStart,
setupDeps: ServerlessObservabilityPublicStartDependencies
): ServerlessObservabilityPublicStart {
const { observabilityShared, serverless, management } = setupDeps;
observabilityShared.setIsSidebarEnabled(false);
const { serverless, management } = setupDeps;
const navigationTree$ = of(navigationTree);
serverless.setProjectHome('/app/observability/landing');
serverless.initNavigation(navigationTree$, { dataTestSubj: 'svlObservabilitySideNav' });
management.setIsSidebarEnabled(false);
management.setupCardsNavigation({
enabled: true,
hideLinksTo: [appIds.RULES],

View file

@ -127,7 +127,6 @@ export class ServerlessSearchPlugin
const navigationTree$ = of(navigationTree);
serverless.initNavigation(navigationTree$, { dataTestSubj: 'svlSearchSideNav' });
management.setIsSidebarEnabled(false);
management.setupCardsNavigation({
enabled: true,
hideLinksTo: [appIds.MAINTENANCE_WINDOWS],

View file

@ -4391,6 +4391,10 @@
version "0.0.0"
uid ""
"@kbn/deeplinks-fleet@link:packages/deeplinks/fleet":
version "0.0.0"
uid ""
"@kbn/deeplinks-management@link:packages/deeplinks/management":
version "0.0.0"
uid ""
@ -4407,6 +4411,14 @@
version "0.0.0"
uid ""
"@kbn/deeplinks-security@link:packages/deeplinks/security":
version "0.0.0"
uid ""
"@kbn/deeplinks-shared@link:packages/deeplinks/shared":
version "0.0.0"
uid ""
"@kbn/default-nav-analytics@link:packages/default-nav/analytics":
version "0.0.0"
uid ""