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][Lens] Check filter action type to hide default filter actions in visualizations #171284

Merged
merged 11 commits into from
Nov 20, 2023

Conversation

semd
Copy link
Contributor

@semd semd commented Nov 15, 2023

Summary

Bug: #171167

The previous implementation solved a different bug using a new shouldShowLegendAction property. This approach had a limitation on the Security Dashboards page since the Security app has no control over the properties passed to the visualization components when they are rendered through portable Dashboards.

This PR fixes the problem by checking if any of the registered actions is a "filter" action type in the visualizations. If customized filter actions are found, the default filter actions hardcoded in the visualizations code are not added, preventing duplication of filter actions.

The specific action type used for the check is the FILTER_CELL_ACTION_TYPE = 'cellAction-filter' constant exported by the @kbn/cell-actions package.

This new approach uses a property stored in the registered actions themselves, so we don't need to pass any extra property to the visualization components, it works transparently. So the shouldShowLegendAction property has also been cleaned.

Demos

Timeline using showTopN visualization:

viz_filter_actions_timeline_demo.mov

Alerts page using Counts table visualization and showTopN visualization

viz_filter_actions_alerts_demo.mov

Portable Dashboard visualizations:

viz_filter_actions_dashboards_demo.mov

Security actions are "compatible" only inside the Security app, in the Lens app the default filter actions are displayed:

lens-actions-screenshot

@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.12.0 labels Nov 15, 2023
@semd semd self-assigned this Nov 15, 2023
@semd semd marked this pull request as ready for review November 16, 2023 12:27
@semd semd requested review from a team as code owners November 16, 2023 12:27
@elasticmachine
Copy link
Contributor

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

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 so much for fixing this, tested locally and LGTM 👍

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Nov 16, 2023
@semd semd requested a review from a team as a code owner November 17, 2023 08:40
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
expressionPartitionVis 161 163 +2
expressionXY 221 223 +2
lens 1135 1137 +2
securitySolution 4692 4691 -1
total +5

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/cell-actions 44 42 -2
expressions 1765 1749 -16
total -18

Async chunks

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

id before after diff
expressionPartitionVis 40.8KB 41.0KB +197.0B
expressionXY 132.1KB 131.4KB -704.0B
lens 1.4MB 1.4MB +72.0B
securitySolution 12.8MB 12.8MB -16.1KB
total -16.6KB

Page load bundle

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

id before after diff
expressions 98.3KB 98.1KB -175.0B
expressionXY 38.7KB 38.7KB -48.0B
total -223.0B
Unknown metric groups

API count

id before after diff
@kbn/cell-actions 62 60 -2
expressions 2224 2208 -16
total -18

History

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

cc @semd

Copy link
Contributor

@drewdaemon drewdaemon left a comment

Choose a reason for hiding this comment

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

This looks good. We can revisit in #169983.

Thank you for also cleaning up the previous shouldShowLegendAction fix!

@semd semd merged commit 9bf7e38 into elastic:main Nov 20, 2023
26 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 20, 2023
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 Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants