-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Integrate default shared-ux left navigation (#167127
) ## Summary Main ticket: #166545 This PR integrates the shared-ux `DefaultNavigation` component in the Security Solution project for serverless. These changes do not replace the original Security left navigation yet, which is still the navigation component displayed by default. In order to render the shared-ux `DefaultNavigation` this experimental flag should be enabled: `xpack.securitySolutionServerless.enableExperimental: ['platformNavEnabled']` <img width="223" alt="Captura de pantalla 2023-09-25 a les 14 00 49" src="https://github.com/elastic/kibana/assets/17747913/91f247ce-ad9c-4093-a0f7-dbca63164b4a"> ## Implementation - Security navigation is still the default. Please enable the `platformNavEnabled` experimental flag to render the shared navigation. - We have two different formatters from the security navigation links config to the navigation tree required in serverless: - ChromeNavigationTree: registered directly to the serverless plugin for the breadcrumbs to work when the navigation is customized with the Security-specific nav. It will be removed after the migration to the shared nav. - NavigationTree: the format the shared nav uses, it already registers the chromeNavigationTree for the breadcrumbs to the serverless plugin by itself. - Security plugin `deepLinks` needed to be formatted differently to make this shared navigation work, since the `navLinkStatus: hidden` prevents the links from being processed and displayed, this has been solved via the `setDeepLinksFormatter` exposed on the plugin setup contract. --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
be7f34e
commit 6393a91
Showing
37 changed files
with
1,156 additions
and
404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { SolutionSideNavPanel } from './src/solution_side_nav_panel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
x-pack/plugins/security_solution_serverless/common/experimental_features.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import type { ExperimentalFeatures as GenericExperimentalFeatures } from '@kbn/security-solution-plugin/common'; | ||
|
||
export type ServerlessExperimentalFeatures = Record< | ||
keyof typeof allowedExperimentalValues, | ||
boolean | ||
>; | ||
|
||
/** | ||
* A list of allowed values that can be used in `xpack.securitySolutionServerless.enableExperimental`. | ||
* This object is then used to validate and parse the value entered. | ||
*/ | ||
export const allowedExperimentalValues = Object.freeze({ | ||
/** | ||
* Enables the use of the of the product navigation from shared-ux package in the Security Solution app | ||
*/ | ||
platformNavEnabled: false, | ||
}); | ||
|
||
type ServerlessExperimentalConfigKeys = Array<keyof ServerlessExperimentalFeatures>; | ||
type Mutable<T> = { -readonly [P in keyof T]: T[P] }; | ||
|
||
const allowedKeys = Object.keys( | ||
allowedExperimentalValues | ||
) as Readonly<ServerlessExperimentalConfigKeys>; | ||
|
||
export type ExperimentalFeatures = ServerlessExperimentalFeatures & GenericExperimentalFeatures; | ||
/** | ||
* Parses the string value used in `xpack.securitySolutionServerless.enableExperimental` kibana configuration, | ||
* which should be a string of values delimited by a comma (`,`) | ||
* The generic experimental features are merged with the serverless values to ensure they are available | ||
* | ||
* @param configValue | ||
* @throws SecuritySolutionInvalidExperimentalValue | ||
*/ | ||
export const parseExperimentalConfigValue = ( | ||
configValue: string[], | ||
genericExperimentalFeatures: GenericExperimentalFeatures | ||
): { features: ExperimentalFeatures; invalid: string[]; duplicated: string[] } => { | ||
const enabledFeatures: Mutable<Partial<ExperimentalFeatures>> = {}; | ||
const invalidKeys: string[] = []; | ||
const duplicatedKeys: string[] = []; | ||
|
||
for (const value of configValue) { | ||
if (genericExperimentalFeatures[value as keyof GenericExperimentalFeatures] != null) { | ||
duplicatedKeys.push(value); | ||
} else if (!allowedKeys.includes(value as keyof ServerlessExperimentalFeatures)) { | ||
invalidKeys.push(value); | ||
} else { | ||
enabledFeatures[value as keyof ServerlessExperimentalFeatures] = true; | ||
} | ||
} | ||
|
||
return { | ||
features: { | ||
...genericExperimentalFeatures, | ||
...allowedExperimentalValues, | ||
...enabledFeatures, | ||
}, | ||
invalid: invalidKeys, | ||
duplicated: duplicatedKeys, | ||
}; | ||
}; | ||
|
||
export const getExperimentalAllowedValues = (): string[] => [...allowedKeys]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.