-
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][Detection Alerts] Fixes follow-up alert refresh bugs #112169
Changes from all commits
e7941de
92ced82
0878902
62a905f
68bb7c4
acbe509
b570bb0
8c03277
ebd6140
374c023
9239483
8cf6f6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import { indexOf } from 'lodash'; | |
import { connect, ConnectedProps } from 'react-redux'; | ||
import { ExceptionListType } from '@kbn/securitysolution-io-ts-list-types'; | ||
import { get } from 'lodash/fp'; | ||
import { useRouteSpy } from '../../../../common/utils/route/use_route_spy'; | ||
import { buildGetAlertByIdQuery } from '../../../../common/components/exceptions/helpers'; | ||
import { EventsTdContent } from '../../../../timelines/components/timeline/styles'; | ||
import { DEFAULT_ICON_BUTTON_WIDTH } from '../../../../timelines/components/timeline/helpers'; | ||
|
@@ -63,6 +64,7 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps & PropsFromRedux | |
timelineQuery, | ||
}) => { | ||
const [isPopoverOpen, setPopover] = useState(false); | ||
const [routeProps] = useRouteSpy(); | ||
|
||
const afterItemSelection = useCallback(() => { | ||
setPopover(false); | ||
|
@@ -112,10 +114,13 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps & PropsFromRedux | |
const refetchAll = useCallback(() => { | ||
if (timelineId === TimelineId.active) { | ||
refetchQuery([timelineQuery]); | ||
if (routeProps.pageName === 'alerts') { | ||
refetchQuery(globalQuery); | ||
} | ||
Comment on lines
+117
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! I had explicitly tried closing an alert from within timeline elsewhere in the app to see if we'd still refetch, haha! 😅 🚀 🥮 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you could use https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/common/constants.ts#L72 instead of this string JUST IN CASE it ever changes |
||
} else { | ||
refetchQuery(globalQuery); | ||
} | ||
}, [timelineId, globalQuery, timelineQuery]); | ||
}, [timelineId, globalQuery, timelineQuery, routeProps]); | ||
|
||
const { | ||
exceptionModalType, | ||
|
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.
Is there a case for verifying the
Trend
histogram has refreshed as well? No explicit counts visible in that component, so we'd need a separate method for verification here -- perhaps setup test to only have one alert and then verifyRule Name
is no longer in legend? Or could hover on a bar and verify counts in tooltip (though may be tough to sort out the flake)?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.
Same comment goes for
opening
/closing
specs below.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.
it doesn't verify the trend histogram yet, I was looking at some possible ways to do that since the data isn't as neat from a css selector standpoint for cypress. I think having the one alert would be a good way to do that, though, I'll add it to the test case here and in the other relevant files 👍