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

[SecuritySolution] Replace donuts with Lens #148519

Merged
merged 9 commits into from
Jan 10, 2023
Merged

Conversation

angorayc
Copy link
Contributor

@angorayc angorayc commented Jan 9, 2023

Summary

This pr is a part of #147261: Replace donut charts with Lens:
This is behind feature flag chartEmbeddablesEnabled

Items to verify:

  1. If the queries and filters from the global search box are applied.
  2. If the correct alert index is applied by different spaced.
  3. Visualization actions working correctly.

Detection and Response dashboard:
Screenshot 2023-01-09 at 09 21 56

Host details:
Screenshot 2023-01-09 at 09 21 38

User details:
Screenshot 2023-01-09 at 09 21 19

Network details:
Screenshot 2023-01-09 at 09 20 47

Known issues:

  1. Not showing legend for alerts donut charts at the moment: There is a logic in Lens that it doesn't show the legend item if its value is zero. - It doesn't show the legend item if its value is zero #149681
  2. JS warnings triggered by incorrect state changed. Fixed by [Security Solution] Resolve JS warnings triggered by incorrect state changed #148552
  3. No label in the donut by default when open in Lens - Lens doesn't support displaying a label in the middle of the donut chart by default, so it is currently available in Security Solution. - [Lens] An option to display title / subtitle for charts #149675
  4. Applying filters or extra action while clicking the donut is not available at the moment. - [Lens][Embeddable] Provide a way to override default action on trigger #149027
  5. Page crashes after editing the filter applied from a Lens Embeddable - [SecuritySolution] Page crashes after editing the filter applied from a Lens Embeddable. #148710

Checklist

Delete any items that are not applicable to this PR.

@angorayc angorayc added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore v8.7.0 labels Jan 9, 2023
@angorayc angorayc marked this pull request as ready for review January 9, 2023 19:42
@angorayc angorayc requested review from a team as code owners January 9, 2023 19:42
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

label={STATUS_OPEN}
title={<ChartLabel count={openCount} />}
totalCount={openCount}
isChartEmbeddablesEnabled={isChartEmbeddablesEnabled}
Copy link
Contributor

Choose a reason for hiding this comment

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

if isChartEmbeddablesEnabled is true though, this component wouldnt render as As AlertDonutEmbeddable would :P. Same for the instances below it. I think you can remove the prop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@jamster10 jamster10 left a comment

Choose a reason for hiding this comment

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

Hey @angorayc this looks great. I went through the code as well as tested the build and it all looks good.

Some questions:
It looks like youre trying to swap out all usage of DonutCharts in favour of lens embeddables, leaving the only usage of DonutChart on the Alerts page and Risk score. Is that because of the lack of legend?

Also, am i right in assuming the default behaviour for lens embeddable clicks is to add a filter. Is that something we can plug in to? Curious because it has ramifications for something I was working on- routing to the Alert page on click from the donut charts on the Explore pages.

Finally, it looks like the bug Steph fixed might impact [useRefetchByRestartingSession](https://github.com/elastic/kibana/blob/ee27615e644cf391b7b04ea44f1d3fc88bf6031c/x-pack/plugins/security_solution/public/explore/containers/use_refetch_by_session.tsx) I dont think in an adverse way though.

@kibanamachine kibanamachine requested a review from a team as a code owner January 10, 2023 09:10
@angorayc
Copy link
Contributor Author

Hey @angorayc this looks great. I went through the code as well as tested the build and it all looks good.

Some questions: It looks like youre trying to swap out all usage of DonutCharts in favour of lens embeddables, leaving the only usage of DonutChart on the Alerts page and Risk score. Is that because of the lack of legend?

Because this PR has lots of files changed already, so I'd like to replace them in a follow up PR.

Also, am i right in assuming the default behaviour for lens embeddable clicks is to add a filter. Is that something we can plug in to? Curious because it has ramifications for something I was working on- routing to the Alert page on click from the donut charts on the Explore pages.

Yup, should be able to do that. I'll put it on the list.

Finally, it looks like the bug Steph fixed might impact [useRefetchByRestartingSession](https://github.com/elastic/kibana/blob/ee27615e644cf391b7b04ea44f1d3fc88bf6031c/x-pack/plugins/security_solution/public/explore/containers/use_refetch_by_session.tsx) I dont think in an adverse way though.

Thanks for the heads up, I'm looking to that with Steph.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3462 3466 +4

Async chunks

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

id before after diff
securitySolution 12.7MB 12.7MB +39.1KB

History

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

cc @angorayc

Copy link
Contributor

@dasansol92 dasansol92 left a comment

Choose a reason for hiding this comment

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

Only checked linter changes on x-pack/plugins/security_solution/public/management/cypress/tsconfig.json

@@ -22,6 +22,8 @@
"path": "../../../tsconfig.json",
"force": true
},
"@kbn/security-plugin"
"@kbn/security-plugin",
Copy link
Contributor

Choose a reason for hiding this comment

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

Approving linter changes from management folder

@angorayc angorayc merged commit 09e10b8 into elastic:main Jan 10, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 10, 2023
angorayc added a commit that referenced this pull request Jan 12, 2023
…changed (#148552)

## Summary

Found these js warning after replacing charts with Lens in
#148519:
<img width="1671" alt="Screenshot 2023-01-09 at 15 31 17"
src="https://user-images.githubusercontent.com/6295984/211345750-8c4e67ee-bf96-49d2-8bb2-0f71e5f9bcd2.png">

Wrap `search.session.start()` with useEffect to avoid incorrect state
changed.



### Checklist

Delete any items that are not applicable to this PR.


- [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

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
jennypavlova pushed a commit to jennypavlova/kibana that referenced this pull request Jan 13, 2023
## Summary

This pr is a part of elastic#147261:
Replace donut charts with Lens:
This is behind feature flag `chartEmbeddablesEnabled `

Items to verify:
1. If the queries and filters from the global search box are applied.
2. If the correct alert index is applied by different spaced.
3. Visualization actions working correctly.

Detection and Response dashboard:
<img width="1662" alt="Screenshot 2023-01-09 at 09 21 56"
src="https://user-images.githubusercontent.com/6295984/211275765-8177e9bd-3623-4bb2-b1d9-8a3044d523a0.png">

Host details:
<img width="1666" alt="Screenshot 2023-01-09 at 09 21 38"
src="https://user-images.githubusercontent.com/6295984/211275770-be95353f-4d1b-410a-b7bf-b232692af1ab.png">

User details:
<img width="1662" alt="Screenshot 2023-01-09 at 09 21 19"
src="https://user-images.githubusercontent.com/6295984/211275773-dd0bcaaf-58e6-404b-b010-d1c464cbd101.png">

Network details:
<img width="1663" alt="Screenshot 2023-01-09 at 09 20 47"
src="https://user-images.githubusercontent.com/6295984/211275775-0fd39ac3-e977-44bd-bd40-304463dce613.png">

Known issues:
1. Not showing legend for alerts donut charts at the moment: There is a
logic in Lens that it doesn't show the legend item if its value is zero.
4. JS warnings triggered by incorrect state changed. Fixed by
elastic#148552
5. No label in the donut by default when open in Lens - Lens doesn't
support displaying a label in the middle of the donut chart by default,
so it is currently available in Security Solution.
6. Applying filters or extra action while clicking the donut is not
available atm



### Checklist

Delete any items that are not applicable to this PR.


- [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

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
jennypavlova pushed a commit to jennypavlova/kibana that referenced this pull request Jan 13, 2023
…changed (elastic#148552)

## Summary

Found these js warning after replacing charts with Lens in
elastic#148519:
<img width="1671" alt="Screenshot 2023-01-09 at 15 31 17"
src="https://user-images.githubusercontent.com/6295984/211345750-8c4e67ee-bf96-49d2-8bb2-0f71e5f9bcd2.png">

Wrap `search.session.start()` with useEffect to avoid incorrect state
changed.



### Checklist

Delete any items that are not applicable to this PR.


- [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

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
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: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants