Skip to content

Commit

Permalink
[Stateful sidenav] Add deeplink definitions & hide page side nav (#17…
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga authored Mar 20, 2024
1 parent be9ad68 commit 37dee75
Show file tree
Hide file tree
Showing 46 changed files with 392 additions and 134 deletions.
5 changes: 4 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion config/serverless.security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export class ProjectNavigationService {
this.navigationChangeSubscription.unsubscribe();
}

let redirectLocation = location;
this.projectNavigationNavTreeFlattened = {};
this.navigationChangeSubscription = combineLatest([
navTreeDefinition$,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const getSolutionNavSwitcherBreadCrumb = ({
return {
text,
'data-test-subj': 'solutionNavSwitcher',
popoverContent: (
popoverContent: (closePopover) => (
<>
<EuiTitle size="xxxs">
<h3>
Expand All @@ -49,6 +49,7 @@ export const getSolutionNavSwitcherBreadCrumb = ({
data-test-subj={`solutionNavSwitcher-${id}`}
onClick={() => {
onChange(id, { redirect: true });
closePopover();
}}
/>,
])}
Expand Down
13 changes: 11 additions & 2 deletions packages/core/chrome/core-chrome-browser/src/project_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -37,7 +40,10 @@ export type AppId =
| MlApp
| ManagementApp
| SearchApp
| ObservabilityApp;
| ObservabilityApp
| SecurityApp
| FleetApp
| SharedApp;

/** @public */
export type AppDeepLinkId =
Expand All @@ -46,7 +52,10 @@ export type AppDeepLinkId =
| MlLink
| ManagementLink
| SearchLink
| ObservabilityLink;
| ObservabilityLink
| SecurityLink
| FleetLink
| SharedLink;

/** @public */
export type CloudLinkId =
Expand Down
5 changes: 4 additions & 1 deletion packages/core/chrome/core-chrome-browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*",
Expand Down
3 changes: 3 additions & 0 deletions packages/deeplinks/fleet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/deeplinks-fleet

Empty package generated by @kbn/generate
21 changes: 21 additions & 0 deletions packages/deeplinks/fleet/deep_links.ts
Original file line number Diff line number Diff line change
@@ -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}`;
9 changes: 9 additions & 0 deletions packages/deeplinks/fleet/index.ts
Original file line number Diff line number Diff line change
@@ -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';
13 changes: 13 additions & 0 deletions packages/deeplinks/fleet/jest.config.js
Original file line number Diff line number Diff line change
@@ -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'],
};
5 changes: 5 additions & 0 deletions packages/deeplinks/fleet/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/deeplinks-fleet",
"owner": "@elastic/fleet"
}
6 changes: 6 additions & 0 deletions packages/deeplinks/fleet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/deeplinks-fleet",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
19 changes: 19 additions & 0 deletions packages/deeplinks/fleet/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}
9 changes: 9 additions & 0 deletions packages/deeplinks/management/deep_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,31 @@ 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'
| 'tags'
| 'transform'
| 'triggersActions'
| 'triggersActionsConnectors'
| 'upgrade_assistant'
| 'users'
| 'watcher';

export type ManagementDeepLinkId = MonitoringAppId | `${ManagementAppId}:${ManagementId}`;
Expand Down
3 changes: 3 additions & 0 deletions packages/deeplinks/security/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/deeplinks-security

Empty package generated by @kbn/generate
84 changes: 84 additions & 0 deletions packages/deeplinks/security/deep_links.ts
Original file line number Diff line number Diff line change
@@ -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',
}
19 changes: 19 additions & 0 deletions packages/deeplinks/security/index.ts
Original file line number Diff line number Diff line change
@@ -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}`;
13 changes: 13 additions & 0 deletions packages/deeplinks/security/jest.config.js
Original file line number Diff line number Diff line change
@@ -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'],
};
5 changes: 5 additions & 0 deletions packages/deeplinks/security/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/deeplinks-security",
"owner": "@elastic/security-solution"
}
6 changes: 6 additions & 0 deletions packages/deeplinks/security/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/deeplinks-security",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
Loading

0 comments on commit 37dee75

Please sign in to comment.