-
Notifications
You must be signed in to change notification settings - Fork 8k
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][Alert table] Fix alert table refresh with bulk action #183674
[Security Solution][Alert table] Fix alert table refresh with bulk action #183674
Conversation
/ci |
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
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.
desk tested and the fix works perfectly! I left a couple of small comments on the code
.../plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_table_state.tsx
Outdated
Show resolved
Hide resolved
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.
@christineweng, Left one comment. Let me know what you think. If needed, we can discuss it offline as well.
@@ -286,6 +292,7 @@ export const AlertsTableComponent: FC<DetectionEngineAlertTableProps> = ({ | |||
showSortSelector: !isEventRenderedView, | |||
}, | |||
dynamicRowHeight: isEventRenderedView, | |||
customRefetch, |
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.
Do you think, instead of passing a new prop to trigger actions table, we can make use of onUpdate
prop?
We can may be trigger customRefetch
everytime the table is updated? But I think there might be cases which it will get into infinite render loop.
Alternatively, I would ask you to take a look at below file. It creates bulk actions and passes to the Alert Table. May be here we can call global query refetch
directly. This might keep refetch
responsibilities well separated and we will probably avoid unintended re-renders.
Lines 59 to 65 in b0f8ee7
export const getBulkActionHook = | |
(tableId: TableId): AlertsTableConfigurationRegistry['useBulkActions'] => | |
(query, refresh) => { | |
const { from, to } = useGlobalTime(); | |
const filters = useMemo(() => { | |
return getFiltersForDSLQuery(query); |
Let me know what 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.
@logeekal thank you for pointing me to this file! i have moved the logic to this hook and under alert actions. it should refresh the global queries only when alert status changes
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
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.
Okay so Code looks good and Desk Testing works great. Thank you very much for making these changes.
Consider adding at least one cypress tests, may be for KPIs visualization which will make sure that this issue does not occur again.
Good call. I realized we don't have a lot of cypress coverage for the KPI charts.. created a ticket for it |
Summary
Currently components outside of alert table do not refresh after changing status with bulk action. This PR adds global query refresh in bulk actions
No grouping
Screen.Recording.2024-05-16.at.2.32.14.PM.mov
Grouping
Screen.Recording.2024-05-16.at.2.33.09.PM.mov