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

Add 'inventory' item to Security navigation menu #204373

Merged
merged 2 commits into from
Dec 23, 2024

Conversation

albertoblaz
Copy link
Contributor

@albertoblaz albertoblaz commented Dec 16, 2024

Summary

Closes #201706.

Add 'inventory' item to Security navigation menu (either when the sidebar is expanded and the full navigation menu is shown or when the sidebar is collapsed and only the Security menu is visible).

Changeset details

  • Render 'inventory' item and enable /app/security/asset_inventory route both conditionally based on feature flag
  • Async loading/rendering of AssetInventory main page from within SecuritySolution plugin
    • Delete unnecessary boilerplate existing in AssetInventory

Out of scope

  • AssetInventory nav sub-menu is skipped until more concrete requirements are defined on what to do with them

How to test

Activate the feature flag by adding this line to your local kibana.dev.yml:

xpack.securitySolution.enableExperimental: ['assetInventoryStoreEnabled']

Screenshots

Full menu (expanded mode) Screenshot 2024-12-16 at 13 12 45
Only Security menu (collapsed mode) Screenshot 2024-12-16 at 13 12 33
AssetInventory loaded async from within Security Solution Screenshot 2024-12-16 at 17 23 01

Checklist

  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Risks

No risks. Navigation item will be added if and only if feature flag is enabled, which shouldn't happen for end users until development is completed.

@albertoblaz albertoblaz added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related labels Dec 16, 2024
@albertoblaz albertoblaz self-assigned this Dec 16, 2024
@albertoblaz albertoblaz force-pushed the asset-inv-nav-menu branch 3 times, most recently from 83dc7b1 to 73fe3bd Compare December 17, 2024 09:36
@albertoblaz albertoblaz marked this pull request as ready for review December 17, 2024 09:36
@albertoblaz albertoblaz requested review from a team as code owners December 17, 2024 09:36
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

@ashokaditya ashokaditya requested review from dasansol92 and removed request for ashokaditya December 17, 2024 09:54
@albertoblaz albertoblaz added the backport:skip This commit does not require backporting label Dec 17, 2024
@albertoblaz albertoblaz marked this pull request as draft December 17, 2024 11:00
@albertoblaz albertoblaz force-pushed the asset-inv-nav-menu branch 2 times, most recently from 346c865 to 05e75f5 Compare December 17, 2024 15:56
@albertoblaz albertoblaz marked this pull request as ready for review December 18, 2024 15:27
Copy link
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

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

LGTM

@albertoblaz albertoblaz enabled auto-merge (squash) December 18, 2024 17:22
Copy link
Contributor

@kapral18 kapral18 left a comment

Choose a reason for hiding this comment

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

LGTM

@albertoblaz
Copy link
Contributor Author

@elasticmachine merge upstream


return (
<SecuritySolutionPageWrapper noPadding>
{assetInventory.getAssetInventoryPage({})}
Copy link
Contributor

@angorayc angorayc Dec 23, 2024

Choose a reason for hiding this comment

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

Would it make more sense to make it just {assetInventory.getAssetInventoryPage()} here?

Are we able to assembled the param AppPluginStartDependencies the function needs in x-pack/solutions/security/plugins/asset_inventory/public/plugin.ts, so we don't need to provided it as a param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you, though this is just temporary because we are not passing in any dependency for now


export const routes: SecuritySubPluginRoutes = [
{
path: ExperimentalFeaturesService.get().assetInventoryStoreEnabled ? ASSET_INVENTORY_PATH : [],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just put path: ASSET_INVENTORY_PATH, here,
I believe the feature flag should have been taken into account via experimentalKey in x-pack/solutions/security/plugins/security_solution/public/asset_inventory/links.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@angorayc Doesn't experimentalKey only affect the link's visibility based on the flag? Here we wanted to prevent users from accessing the plugin's page by manually entering the URL. If you confirm we still don't need to do that, I can remove it ofc

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, SecurityRoutePageWrapper takes care of that. You can test the page stays unaccessible without this check when the flag is off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@semd I forgot auto-merge was enabled, but will take care of that for sure!

<EuiPageTemplate.Header>
<EuiTitle size="l">
<h1>
<FormattedMessage id="assetInventory.allAssets" defaultMessage="All Assets" />
Copy link
Contributor

@angorayc angorayc Dec 23, 2024

Choose a reason for hiding this comment

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

We have an existing assets page on the serverless version:
Screenshot 2024-12-23 at 17 31 17

I guess this is a temporary place holder title, but I'd recommend making this header more specific to avoid confusion in the future:
Screenshot 2024-12-23 at 17 17 02

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I can bring it up in the next UX weekly meeting. I'm just following this Figma mockup.

Screenshot 2024-12-23 at 18 42 38

@albertoblaz albertoblaz merged commit 6d5be74 into elastic:main Dec 23, 2024
8 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
assetInventory 17 6 -11
securitySolution 6479 6483 +4
total -7

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
assetInventory 6 8 +2

Async chunks

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

id before after diff
assetInventory 1.2KB 817.0B -382.0B
securitySolution 21.4MB 21.4MB +1.0KB
total +657.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
assetInventory 0 1 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
assetInventory 3.1KB 3.3KB +179.0B
securitySolution 88.0KB 88.2KB +169.0B
securitySolutionEss 11.8KB 11.8KB +35.0B
securitySolutionServerless 26.4KB 26.4KB +35.0B
total +418.0B
Unknown metric groups

API count

id before after diff
assetInventory 6 8 +2

References to deprecated APIs

id before after diff
assetInventory 1 0 -1

History

cc @albertoblaz

return (
<SecuritySolutionPageWrapper noPadding>
{assetInventory.getAssetInventoryPage({})}
<SpyRoute pageName={SecurityPageName.assetInventory} />
Copy link
Contributor

Choose a reason for hiding this comment

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

That's good, but SecurityRoutePageWrapper already adds the SpyRoute implicitly, no need to add it again :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@semd Didn't know that either, thanks a lot. Will take care of that in a follow-up PR


export const routes: SecuritySubPluginRoutes = [
{
path: ExperimentalFeaturesService.get().assetInventoryStoreEnabled ? ASSET_INVENTORY_PATH : [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, SecurityRoutePageWrapper takes care of that. You can test the page stays unaccessible without this check when the flag is off

@albertoblaz albertoblaz deleted the asset-inv-nav-menu branch December 30, 2024 11:06
stratoula pushed a commit to stratoula/kibana that referenced this pull request Jan 2, 2025
## Summary

Add 'inventory' item to Security navigation menu (either when the
sidebar is expanded and the full navigation menu is shown or when the
sidebar is collapsed and only the Security menu is visible).

### Changeset details

- Render 'inventory' item and enable `/app/security/asset_inventory`
route both conditionally based on feature flag
- Async loading/rendering of AssetInventory main page from within
SecuritySolution plugin
  - Delete unnecessary boilerplate existing in AssetInventory

### Out of scope
- AssetInventory nav sub-menu is skipped until more concrete
requirements are defined on what to do with them

### How to test

Activate the feature flag by adding this line to your local
`kibana.dev.yml`:

```yml
xpack.securitySolution.enableExperimental: ['assetInventoryStoreEnabled']
```

### Screenshots

<details><summary>Full menu (expanded mode)</summary>
<img width="240" alt="Screenshot 2024-12-16 at 13 12 45"
src="https://github.com/user-attachments/assets/f0939f38-5be6-481b-ace1-07f46f3622ae"
/>
</details> 

<details><summary>Only Security menu (collapsed mode)</summary>
<img width="256" alt="Screenshot 2024-12-16 at 13 12 33"
src="https://github.com/user-attachments/assets/b0bd62f0-5cea-4b7b-a731-3a53be362192"
/>
</details> 

<details><summary>AssetInventory loaded async from within Security
Solution</summary>
<img width="1640" alt="Screenshot 2024-12-16 at 17 23 01"
src="https://github.com/user-attachments/assets/b84716c9-6b18-4225-bf71-62c8ef07b302"
/>
</details> 

### Checklist

- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Risks

No risks. Navigation item will be added if and only if feature flag is
enabled, which shouldn't happen for end users until development is
completed.
benakansara pushed a commit to benakansara/kibana that referenced this pull request Jan 2, 2025
## Summary

Add 'inventory' item to Security navigation menu (either when the
sidebar is expanded and the full navigation menu is shown or when the
sidebar is collapsed and only the Security menu is visible).

### Changeset details

- Render 'inventory' item and enable `/app/security/asset_inventory`
route both conditionally based on feature flag
- Async loading/rendering of AssetInventory main page from within
SecuritySolution plugin
  - Delete unnecessary boilerplate existing in AssetInventory

### Out of scope
- AssetInventory nav sub-menu is skipped until more concrete
requirements are defined on what to do with them

### How to test

Activate the feature flag by adding this line to your local
`kibana.dev.yml`:

```yml
xpack.securitySolution.enableExperimental: ['assetInventoryStoreEnabled']
```

### Screenshots

<details><summary>Full menu (expanded mode)</summary>
<img width="240" alt="Screenshot 2024-12-16 at 13 12 45"
src="https://github.com/user-attachments/assets/f0939f38-5be6-481b-ace1-07f46f3622ae"
/>
</details> 

<details><summary>Only Security menu (collapsed mode)</summary>
<img width="256" alt="Screenshot 2024-12-16 at 13 12 33"
src="https://github.com/user-attachments/assets/b0bd62f0-5cea-4b7b-a731-3a53be362192"
/>
</details> 

<details><summary>AssetInventory loaded async from within Security
Solution</summary>
<img width="1640" alt="Screenshot 2024-12-16 at 17 23 01"
src="https://github.com/user-attachments/assets/b84716c9-6b18-4225-bf71-62c8ef07b302"
/>
</details> 

### Checklist

- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Risks

No risks. Navigation item will be added if and only if feature flag is
enabled, which shouldn't happen for end users until development is
completed.
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 13, 2025
## Summary

Add 'inventory' item to Security navigation menu (either when the
sidebar is expanded and the full navigation menu is shown or when the
sidebar is collapsed and only the Security menu is visible).

### Changeset details

- Render 'inventory' item and enable `/app/security/asset_inventory`
route both conditionally based on feature flag
- Async loading/rendering of AssetInventory main page from within
SecuritySolution plugin
  - Delete unnecessary boilerplate existing in AssetInventory

### Out of scope
- AssetInventory nav sub-menu is skipped until more concrete
requirements are defined on what to do with them

### How to test

Activate the feature flag by adding this line to your local
`kibana.dev.yml`:

```yml
xpack.securitySolution.enableExperimental: ['assetInventoryStoreEnabled']
```

### Screenshots

<details><summary>Full menu (expanded mode)</summary>
<img width="240" alt="Screenshot 2024-12-16 at 13 12 45"
src="https://github.com/user-attachments/assets/f0939f38-5be6-481b-ace1-07f46f3622ae"
/>
</details> 

<details><summary>Only Security menu (collapsed mode)</summary>
<img width="256" alt="Screenshot 2024-12-16 at 13 12 33"
src="https://github.com/user-attachments/assets/b0bd62f0-5cea-4b7b-a731-3a53be362192"
/>
</details> 

<details><summary>AssetInventory loaded async from within Security
Solution</summary>
<img width="1640" alt="Screenshot 2024-12-16 at 17 23 01"
src="https://github.com/user-attachments/assets/b84716c9-6b18-4225-bf71-62c8ef07b302"
/>
</details> 

### Checklist

- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Risks

No risks. Navigation item will be added if and only if feature flag is
enabled, which shouldn't happen for end users until development is
completed.
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 release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add New Security Navigation Menu "Inventory"
9 participants