Skip to content
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

[Security Solution] Side navigation package #152924

Merged
merged 19 commits into from
Mar 10, 2023

Conversation

semd
Copy link
Contributor

@semd semd commented Mar 8, 2023

Summary

Security navigation moved to its own package.
This migration is needed in order to reuse the same component for the navigation in the Serverless Security plugin PoC

previous location: x-pack/plugins/security_solution/public/common/components/navigation/solution_grouped_nav
new location: packages/kbn-security-solution-side-nav

Implementation changes:

  • Custom icons removed in favor of new EUI iconType.
  • Custom SideNavItem (for "Get Started" item) removed in favor of more configuration properties.
  • Generic nomenclature.
  • Header banner offset special case logic extracted from the navigation component, new panelTopOffset prop added to customize the top position of the floating panel.

Screenshot

Solution_side_nav

Test

yarn storybook security_solution_side_nav

Checklist

Delete any items that are not applicable to this PR.

@semd semd added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team:Threat Hunting:Explore v8.8.0 labels Mar 8, 2023
@semd semd self-assigned this Mar 8, 2023
@semd semd marked this pull request as ready for review March 9, 2023 13:02
@semd semd requested review from a team as code owners March 9, 2023 13:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@clintandrewhall
Copy link
Contributor

I can review in depth, but outright I would recommend scoping this side nav component to security, for now: @kbn/security-solution-side-nav.

You can also place it in a scoped directory: packages/security_solution/side_nav.

The biggest reason is it is fairly specific to security, at least at the moment. It will prevent confusion with components like *PageLayout.

Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/dev/storybook/aliases.ts LGTM

Copy link
Contributor

@angorayc angorayc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving this to a package 👍

@semd semd requested a review from clintandrewhall March 9, 2023 15:37
Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments on general structure... I can demonstrate with this with a pull, if you like.

I would just be sure to replace solutionSideNav with securitySolutionSideNav wherever necessary.

.i18nrc.json Outdated Show resolved Hide resolved
@@ -0,0 +1,50 @@
## Security Solution Side Nav
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would consider packages/security_solution/side_nav to make it easier to find/organize.

@@ -0,0 +1,9 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would consider creating a package for security storybooks - packages/security_solution/storybook, @kbn/security-solution-storybook.

It also makes it easier to group all of your storybook stories into a single storybook.

see: https://github.com/elastic/kibana/tree/main/packages/shared-ux/storybook/config

import { css } from '@emotion/react';
import { EuiBetaBadge, useEuiTheme } from '@elastic/eui';

export const BETA_LABEL = i18n.translate('solutionSideNav.betaBadge.label', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
export const BETA_LABEL = i18n.translate('solutionSideNav.betaBadge.label', {
export const BETA_LABEL = i18n.translate('securitySolutionSideNav.betaBadge.label', {

Co-authored-by: Clint Andrew Hall <[email protected]>
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3752 3751 -1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/security-solution-side-nav - 30 +30

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 15.7MB 15.7MB -2.7KB
Unknown metric groups

API count

id before after diff
@kbn/security-solution-side-nav - 30 +30
@kbn/security-solution-storybook-config - 2 +2
total +32

async chunk count

id before after diff
securitySolution 42 43 +1

ESLint disabled in files

id before after diff
@kbn/security-solution-side-nav - 1 +1
@kbn/security-solution-storybook-config - 1 +1
total +2

ESLint disabled line counts

id before after diff
@kbn/security-solution-side-nav - 1 +1
securitySolution 428 429 +1
total +2

Total ESLint disabled count

id before after diff
@kbn/security-solution-side-nav - 2 +2
@kbn/security-solution-storybook-config - 1 +1
securitySolution 505 506 +1
total +4

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @semd

@semd semd merged commit 2fa877b into elastic:main Mar 10, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 10, 2023
bmorelli25 pushed a commit to bmorelli25/kibana that referenced this pull request Mar 10, 2023
## Summary

Security navigation moved to its own package.
This migration is needed in order to reuse the same component for the
navigation in the Serverless Security plugin
[PoC](elastic#152172)

previous location:
`x-pack/plugins/security_solution/public/common/components/navigation/solution_grouped_nav`
new location: `packages/kbn-security-solution-side-nav`

Implementation changes:

- Custom icons removed in favor of new EUI `iconType`.
- Custom `SideNavItem` (for "Get Started" item) removed in favor of more
configuration properties.
- Generic nomenclature.
- Header banner offset special case logic extracted from the navigation
component, new `panelTopOffset` prop added to customize the top position
of the floating panel.

### Screenshot


![Solution_side_nav](https://user-images.githubusercontent.com/17747913/224022078-2c6b6d20-8f9d-4917-bd6e-800a596ed718.png)

## Test

`yarn storybook security_solution_side_nav`

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Clint Andrew Hall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:build-storybooks release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants