[Security Solution][Detections] Alert table status update bug (#87243)
This commit is contained in:
parent
b8d21b1c77
commit
285809e6b5
|
@ -77,7 +77,6 @@ export const updateAlertStatusAction = async ({
|
|||
setEventsLoading({ eventIds: alertIds, isLoading: true });
|
||||
|
||||
const queryObject = query ? { query: JSON.parse(query) } : getUpdateAlertsQuery(alertIds);
|
||||
|
||||
const response = await updateAlertStatus({ query: queryObject, status: selectedStatus });
|
||||
// TODO: Only delete those that were successfully updated from updatedRules
|
||||
setEventsDeleted({ eventIds: alertIds, isDeleted: true });
|
||||
|
|
|
@ -60,9 +60,6 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps> = ({
|
|||
const dispatch = useDispatch();
|
||||
const [, dispatchToaster] = useStateToaster();
|
||||
const [isPopoverOpen, setPopover] = useState(false);
|
||||
const [alertStatus, setAlertStatus] = useState<Status | undefined>(
|
||||
(ecsRowData.signal?.status && (ecsRowData.signal.status[0] as Status)) ?? undefined
|
||||
);
|
||||
const eventId = ecsRowData._id;
|
||||
const ruleId = useMemo(
|
||||
(): string | null =>
|
||||
|
@ -90,6 +87,10 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps> = ({
|
|||
|
||||
const { addWarning } = useAppToasts();
|
||||
|
||||
const alertStatus = useMemo(() => {
|
||||
return ecsRowData.signal?.status && (ecsRowData.signal.status[0] as Status);
|
||||
}, [ecsRowData]);
|
||||
|
||||
const onButtonClick = useCallback(() => {
|
||||
setPopover(!isPopoverOpen);
|
||||
}, [isPopoverOpen]);
|
||||
|
@ -122,9 +123,6 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps> = ({
|
|||
const onAddExceptionConfirm = useCallback(
|
||||
(didCloseAlert: boolean, didBulkCloseAlert) => {
|
||||
closeAddExceptionModal();
|
||||
if (didCloseAlert) {
|
||||
setAlertStatus('closed');
|
||||
}
|
||||
if (timelineId !== TimelineId.active || didBulkCloseAlert) {
|
||||
refetch();
|
||||
}
|
||||
|
@ -154,7 +152,6 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps> = ({
|
|||
}
|
||||
displaySuccessToast(title, dispatchToaster);
|
||||
}
|
||||
setAlertStatus(newStatus);
|
||||
},
|
||||
[dispatchToaster, addWarning]
|
||||
);
|
||||
|
@ -359,10 +356,10 @@ const AlertContextMenuComponent: React.FC<AlertContextMenuProps> = ({
|
|||
return [];
|
||||
}
|
||||
}, [
|
||||
alertStatus,
|
||||
closeAlertActionComponent,
|
||||
inProgressAlertActionComponent,
|
||||
openAlertActionComponent,
|
||||
alertStatus,
|
||||
]);
|
||||
|
||||
const items = useMemo(
|
||||
|
|
Loading…
Reference in a new issue