-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] New trigger actions for chart legends and table cell actions #146779
Conversation
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
…-ref HEAD~1..HEAD --fix'
.euiDataGridRowCell .euiDataGridRowCell__expandActions .euiDataGridRowCell__actionButtonIcon { | ||
display: none; | ||
|
||
&:first-child, | ||
&:nth-child(2), | ||
&:nth-child(3), | ||
&:last-child { | ||
display: inline-flex; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in favor of visibleCellActions
prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up! 👍
x-pack/plugins/security_solution/public/actions/add_to_timeline/add_to_timeline_action.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/actions/add_to_timeline/data_provider.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/actions/add_to_timeline/data_provider.ts
Show resolved
Hide resolved
…md/kibana into 145708_viz_data_value_actions
Hi @ThomThomson , thanks a lot for taking a look at the PR.
I have tried to follow the existing pattern that
For now, it is only used by Lens, but its purpose is not restricted to it, I tried to make it as generic as possible. It is not tied to Lens, visualization legends or table actions specifically. So, in the future, it can be used by other plugins to show actions for a rendered value. Having that said, I don't have a strong opinion about it, I registered the trigger in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation @semd, as long as the implementation is intended to be generic, the embeddable plugin seems like an okay home for the time being!
LGTM - code review only.
Hi @stephmilovic,
Not dumb at all, I had to dig into the charts code to find that there's a kibana/x-pack/plugins/cases/public/components/markdown_editor/plugins/lens/processor.tsx Line 52 in b80a23e
EDIT: I assume Cases set the I did not realize this flag existed, so right now the AddToTimeline and CopyToClipboard actions are inconsistent with the Filter actions, they should also be hidden inside Cases. I am fixing that. The ideal scenario for us would probably be to display all the actions except for the Filter For/Out inside cases, but we would need more granularity to do so, the Since this PR is adding actions in a general way inside Security, we could keep all actions hidden in Cases by now, and discuss this topic with @paulewing and the Cases team. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding all the tests requested, LGTM!
|
||
const hasCellActions = (columnId?: string) => { | ||
return columnId && !FIELDS_WITHOUT_CELL_ACTIONS.includes(columnId); | ||
}; | ||
|
||
const StyledContent = styled.div<{ $isDetails: boolean }>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌🏾
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change! Everything seems to look and work fine for the tables. Investigations Codeowners LGTM!
…md/kibana into 145708_viz_data_value_actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found only minor nitpicks here and there, nothing major.
Tested locally on Safari and found no regression.
@@ -60,6 +84,12 @@ export const getPartitionVisRenderer: ( | |||
unmountComponentAtNode(domNode); | |||
}); | |||
|
|||
const columnCellValueActions = await getColumnCellValueActions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we combine this with the palette async code below?
@@ -58,8 +58,10 @@ import { ExtendedDataLayerConfig, XYProps, AnnotationLayerConfigResult } from '. | |||
import { DataLayers } from './data_layers'; | |||
import { SplitChart } from './split_chart'; | |||
import { LegendSize } from '@kbn/visualizations-plugin/common'; | |||
import { LayerCellValueActions } from '../types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { LayerCellValueActions } from '../types'; | |
import type { LayerCellValueActions } from '../types'; |
@@ -1335,7 +1336,7 @@ export function isLensEditEvent<T extends LensEditSupportedActions>( | |||
|
|||
export function isLensTableRowContextMenuClickEvent( | |||
event: ExpressionRendererEvent | |||
): event is BrushTriggerEvent { | |||
): event is LensTableRowContextMenuEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
@@ -104,6 +129,11 @@ export const getDatatableRenderer = (dependencies: { | |||
} | |||
} | |||
|
|||
const columnCellValueActions = await getColumnCellValueActions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it be combined with the columnFilterable
one?
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Any counts in public APIs
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @semd |
Summary
Enable XY chart legends and Table cell actions to render dynamically registered "cell value" actions, scoped for Lens embeddables only.
Security Solution actions were created to be displayed in the Lens visualizations rendered.
closes #145708
New Trigger
A new uiActions trigger
CELL_VALUE_TRIGGER
has been created to register these actions. It is used in both TableChart cell actions and XyCharts legend actions to create additional action options.Table cell actions
Actions registered and added to the
CELL_VALUE_TRIGGER
will be appended to the cell actions of the table. The action compatibility is checked for each column.Chart legend actions
The same for XyCharts legends. All actions registered and added to the
CELL_VALUE_TRIGGER
will be appended to the legend actions of the charts. The action compatibility is checked for each series accessor.Filter for & Filter out actions:
The XY and Table charts have the "Filter for & Filter out" actions hardcoded in the components code. They manually check the value is filterable before showing the actions, but the panel items and cell actions are added explicitly for them in the components.
This logic has not changed in this PR, the actions added dynamically using
CELL_VALUE_TRIGGER
are just appended after the "Filter for & Filter out" options.However, "Filter for / Filter out" actions could also be integrated into this pattern, we would only have to register these actions to the
CELL_VALUE_TRIGGER
with the properorder
value, and then remove all hardcoded logic in the components.Security Solution actions
The actions that we have registered from Security Solutions ("Add to timeline" and "Copy to clipboard") will be displayed only when the embeddable is rendered inside Security Solution, this is ensured via the
isCompatible
actions method.Security Solution Filter In/Out bug
There was a CSS rule present in a global Security Solution context, affecting all the
EuiDataGrid
cell actions popovers:kibana/x-pack/plugins/security_solution/public/common/components/page/index.tsx
Lines 124 to 130 in 475e47e
The goal of this rule was to save some vertical space, by hiding the two auto-generated Filter In/Out actions (generally the first two cell actions), so we could show the horizontal Filter In/Out custom buttons added manually to the popover top header.
This CSS rule was causing a bug when rendering Table visualizations (they use
EuiDataGrid
as well), always hiding the two first cell actions in the popover.After discussing this topic with the team, and considering there is an ongoing task to unify the cell actions experience in Security and centralize the implementation (see: #144943), we decided to remove the problematic CSS rule and the custom horizontal Filter buttons, so the auto-generated Filter actions are displayed, this way all tables in Security (alerts, events, and also embedded table charts) will have a unified and consistent UX.
If the cell actions popover grows too much in the future we could apply a "More actions ..." footer option strategy.
Testing
The new actions will be displayed on any embedded Lens object rendered inside Security. A good place to test that is Cases, since we can attach Lens visualizations in the comments. However, Cases explicitly disables all the trigger actions passing
disableTriggers
to the Lens Embeddables.kibana/x-pack/plugins/cases/public/components/markdown_editor/plugins/lens/processor.tsx
Line 52 in b80a23e
The easiest way to test different chart types and tables is to remove/comment the
disableTriggers
prop in the Cases processor component, and then go to a Case and attach different Lens visualizations. All actions should appear in the legends and table cell hover actions.Checklist