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

[Cloud Security] [Vulnerabilities] Add grouping capabilities #174413

Merged

Conversation

opauloh
Copy link
Contributor

@opauloh opauloh commented Jan 6, 2024

Summary

It closes #165788 and #169050 and #174119

This PR adds the following changes to the Findings -> Vulnerabilities page:

  • Replaced the DataGrid component with the new CloudSecurityDataTable component
  • Added the new Grouping component with custom default renderers

It also introduced the following changes:

  • Added context for DataView for easier reuse of the dataView methods.
  • Refactored the Misconfigurations component to consume the dataView context
  • added FTR tests for the Vulnerabilities page
  • dropped Flyout navigation support (will be readded in the future)

Screenshots

image

image

Recording

Screen.Recording.2024-01-09.at.12.09.57.PM.mov
Screen.Recording.2024-01-09.at.12.09.04.PM.mov

@opauloh opauloh marked this pull request as ready for review January 9, 2024 20:08
@opauloh opauloh requested a review from a team as a code owner January 9, 2024 20:08
@elasticmachine
Copy link
Contributor

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

@maxcold
Copy link
Contributor

maxcold commented Jan 10, 2024

Tested in local, one problem I found is that the grouping is preserved when switching between Misconfigurations and Vulnerabilities. I'm not sure if it is expected behavior plus it broke the UI in the case when I chose "group be k8s cluster" and navigated to vulnerabilities
Screenshot 2024-01-10 at 17 05 40

Copy link
Contributor

@maxcold maxcold left a comment

Choose a reason for hiding this comment

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

started with the review, found couple of skipped tests and commented out code. Will continue tomorrow

@@ -93,15 +93,15 @@ describe('<VulnerabilityFindingFlyout/>', () => {
});
});

it('should allow pagination with next', async () => {
it.skip('should allow pagination with next', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the reason for skipping? do you plan to unskip in the context of this PR or do you see it as a tech debt?

Copy link
Contributor Author

@opauloh opauloh Jan 10, 2024

Choose a reason for hiding this comment

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

Exactly, I skipped those tests because there's a plan to re-enable them later once #168619 is resolved. I added a TODO comment now on the skipped tests so we can know when to re-enable them.

x-pack/plugins/cloud_security_posture/server/plugin.ts Outdated Show resolved Hide resolved
@opauloh
Copy link
Contributor Author

opauloh commented Jan 10, 2024

Tested in local, one problem I found is that the grouping is preserved when switching between Misconfigurations and Vulnerabilities. I'm not sure if it is expected behavior plus it broke the UI in the case when I chose "group be k8s cluster" and navigated to vulnerabilities Screenshot 2024-01-10 at 17 05 40

Thanks for catching this, I split the keys and enforced to prevent unintentionally sharing the local storage by adding a groupingLocalStorageKey prop to the useCloudSecurityGrouping hook

@opauloh opauloh requested a review from maxcold January 10, 2024 23:55
Copy link
Contributor

@maxcold maxcold left a comment

Choose a reason for hiding this comment

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

lgtm overall, there are a couple of things I want to clarify before approving

/**
* Return first non-null value. If the field contains an array, this will return the first value that isn't null. If the field isn't an array it'll be returned unless it's null.
*/
export function firstNonNullValue<T>(valueOrCollection: ECSField<T>): T | undefined {
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 this exists for findings as well. Worth sharing the code between the two?

Copy link
Contributor

Choose a reason for hiding this comment

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

and maybe it's true for some of the components in this file as well, the ones which are not specific for vulnerabilties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was a great idea, I ended up sharing the common components and utils in the cloud_security_grouping folder

@opauloh opauloh requested a review from maxcold January 12, 2024 05:34
@maxcold
Copy link
Contributor

maxcold commented Jan 12, 2024

Approving, but there is one comment unanswered about the code duplication in the latest_vulnerabilities_group_renderer.tsx #174413 (comment) . Pls check that before merging

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Serverless Osquery Cypress Tests #6 / App Features for Enpoint Complete PLI response actions should be available response actions should be available

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cloudSecurityPosture 407 391 -16

Async chunks

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

id before after diff
cloudSecurityPosture 415.5KB 372.9KB -42.6KB

History

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

@opauloh opauloh merged commit c348925 into elastic:main Jan 13, 2024
20 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 13, 2024
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…#174413)

## Summary

It closes elastic#165788 and elastic#169050 and elastic#174119

This PR adds the following changes to the Findings -> Vulnerabilities
page:

- Replaced the DataGrid component with the new CloudSecurityDataTable
component
- Added the new Grouping component with custom default renderers

It also introduced the following changes:
- Added context for DataView for easier reuse of the `dataView` methods.
- Refactored the Misconfigurations component to consume the `dataView`
context
- added FTR tests for the Vulnerabilities page
- dropped Flyout navigation support (will be readded in the future)


## Screenshots


![image](https://github.com/elastic/kibana/assets/19270322/c6cb7871-ce99-4c33-a615-142aaba63ec9)


![image](https://github.com/elastic/kibana/assets/19270322/ead3358f-7300-489b-b26d-5a37cc99e01d)

## Recording



https://github.com/elastic/kibana/assets/19270322/a47be0cf-2849-424d-b19a-d65cb6f502a8



https://github.com/elastic/kibana/assets/19270322/fa395488-7a22-476e-a50e-d0f0e28429e1

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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 v8.13.0
Projects
None yet
5 participants