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.

OK, I have this removed in this PR: https://github.com/elastic/kibana/pull/147261/files

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 to angorayc/kibana that referenced this pull request Jan 10, 2023
commit fc3b886
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 10 14:02:01 2023 +0000

    replace alerts by severity table with lens

commit a1464c2
Merge: e0bdf32 076d60d
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 10 12:41:36 2023 +0000

    Merge branch 'histogram-with-lens' of github.com:angorayc/kibana into histogram-with-lens

commit e0bdf32
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 10 12:40:45 2023 +0000

    replace donut on alerts page

commit 076d60d
Merge: f5cb4e0 09e10b8
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 10 11:53:38 2023 +0000

    Merge branch 'main' of github.com:elastic/kibana into histogram-with-lens

commit f5cb4e0
Merge: 119dbe7 010f93b
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 10 11:15:40 2023 +0000

    Merge branch 'histogram-with-lens' of github.com:angorayc/kibana into histogram-with-lens

commit 09e10b8
Author: Angela Chuang <6295984+angorayc@users.noreply.github.com>
Date:   Tue Jan 10 11:13:21 2023 +0000

    [SecuritySolution] Replace donuts with Lens (elastic#148519)

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

commit ef2faad
Author: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>
Date:   Tue Jan 10 10:39:50 2023 +0100

    [Infrastructure UI]: Add feedback button for hosts page (elastic#148555)

    ## 📓 Summary

    Closes elastic#148379

    This PR replaces the existing link to get feedback on the forum with a
    button that brings on a form with predefined questions on the Hosts
    page.

    ## 🧪 Testing

    Navigate to the `Hosts`view and click the top-right button saying "_Tell
    us what you think!_".

    <img width="1502" alt="solution"
    src="https://user-images.githubusercontent.com/34506779/211347429-c8f338c3-8bb0-4304-8b58-6d140e301554.png">

    Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
    Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>

commit 5c8b6f2
Author: James Gowdy <jgowdy@elastic.co>
Date:   Tue Jan 10 09:33:56 2023 +0000

    [ML] Fix modal titles (elastic#147855)

    An EUI change has caused modal titles to no longer be implicitly wrapped
    in a header tag.
    This change adds a `h2` to all  modal titles.

    **Old**
    <img width="824" alt="image"
    src="https://user-images.githubusercontent.com/22172091/208673148-3da918c4-f1d7-48c5-8afd-022b912b49fc.png">

    **New**
    <img width="857" alt="image"
    src="https://user-images.githubusercontent.com/22172091/208673087-1b8cba03-504b-4505-ac65-0fcfcce4b99b.png">

commit 010f93b
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 8 15:15:43 2022 +0000

    render histogram with lens

commit 119dbe7
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Sun Jan 8 10:02:57 2023 +0000

    fix types

commit 0891f07
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Sat Jan 7 23:39:27 2023 +0000

    unit test

commit d2023fa
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Sat Jan 7 23:32:23 2023 +0000

    fetch session id only when vis inabled

commit 82b4ddb
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Sat Jan 7 22:38:44 2023 +0000

    refetch

commit d896cb0
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Sat Jan 7 19:47:18 2023 +0000

    remove eslint comment

commit d619b30
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Sat Jan 7 19:19:41 2023 +0000

    unit tests

commit 075ef5f
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Jan 5 15:46:55 2023 +0000

    styling

commit 4d4a5cf
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Jan 5 15:16:54 2023 +0000

    update snapshot

commit aead88e
Merge: a91bf4f 1c5febb
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Jan 5 14:51:07 2023 +0000

    Merge branch 'histogram-with-lens' of github.com:angorayc/kibana into histogram-with-lens

commit a91bf4f
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Jan 5 14:50:39 2023 +0000

    update snapshot

commit 29da009
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Jan 5 14:42:32 2023 +0000

    fix types

commit 1c18042
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Jan 5 12:47:56 2023 +0000

    styling

commit 1c5febb
Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date:   Tue Jan 3 17:43:29 2023 +0000

    [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

commit 73e17de
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 3 17:38:29 2023 +0000

    pass extra filters to Lens

commit 789c0c8
Merge: dfb9e8f 0c8c4d7
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 3 17:14:34 2023 +0000

    Merge branch 'main' of github.com:elastic/kibana into histogram-with-lens

commit dfb9e8f
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Jan 3 15:48:36 2023 +0000

    render rule preview with lens

commit c753bd8
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Fri Dec 30 16:02:53 2022 +0000

    add total alerts count

commit 785712e
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 29 18:26:50 2022 +0000

    replace alerts donut charts

commit c31b77d
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Wed Dec 28 11:08:34 2022 +0000

    fix unit tests

commit 7dbc50d
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Fri Dec 23 14:02:52 2022 +0000

    add unit tests

commit 1b50b16
Merge: 55f0cf2 03ddae8
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 14:15:02 2022 +0000

    Merge branch 'main' of github.com:elastic/kibana into histogram-with-lens

commit 55f0cf2
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 14:14:45 2022 +0000

    update snapshots

commit 153f139
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 12:46:22 2022 +0000

    add unit tests

commit da58b26
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 12:13:17 2022 +0000

    rename props

commit 26da70b
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 12:12:53 2022 +0000

    update events chart

commit 445cb99
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 11:44:13 2022 +0000

    clean up

commit 761998f
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 22 11:05:57 2022 +0000

    fix unit tests

commit 5fc4ece
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Wed Dec 21 17:36:39 2022 +0000

    fix types

commit 73424d7
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Wed Dec 21 17:01:40 2022 +0000

    add no data prompt

commit 0b18236
Merge: a07eefe 5f5291d
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Dec 20 17:07:17 2022 +0000

    Merge branch 'histogram-with-lens' of github.com:angorayc/kibana into histogram-with-lens

commit a07eefe
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Dec 20 17:06:32 2022 +0000

    extra actions

commit 84dce3f
Merge: b68afd1 53e42eb
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Dec 20 16:12:24 2022 +0000

    Merge branch 'main' of github.com:elastic/kibana into histogram-with-lens

commit 5f5291d
Author: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date:   Tue Dec 20 15:21:19 2022 +0000

    [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

commit b68afd1
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Tue Dec 20 15:15:31 2022 +0000

    replace alerts histograms with Lens

commit 7b39762
Merge: 6376733 3192372
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Fri Dec 16 09:58:19 2022 +0000

    Merge branch 'main' of github.com:elastic/kibana into histogram-with-lens

commit 6376733
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Fri Dec 16 09:58:15 2022 +0000

    replace alert histograms with lens

commit 62bd659
Author: Angela Chuang <yi-chun.chuang@elastic.co>
Date:   Thu Dec 8 15:15:43 2022 +0000

    render histogram with lens
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