[RAM] Fix bulk action for o11y for 7.17 (#126686)

* fix bulk action for o11y

* review I

* discuss it more with Devin

* clean up
This commit is contained in:
Xavier Mouligneau 2022-03-03 15:31:53 -05:00 committed by GitHub
parent 9c45883bb4
commit 8f277d4677
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 100 additions and 13 deletions

View file

@ -49,7 +49,7 @@ const FullWidthFlexGroup = styled(EuiFlexGroup)<{ $visible: boolean }>`
`;
export const EVENTS_VIEWER_HEADER_HEIGHT = 90; // px
const STANDALONE_ID = 'standalone-t-grid';
export const STANDALONE_ID = 'standalone-t-grid';
const EMPTY_DATA_PROVIDERS: DataProvider[] = [];
const TitleText = styled.span`

View file

@ -45,11 +45,11 @@ export const useUpdateAlertsStatus = (
body: JSON.stringify({ status, query }),
});
} else {
const { body } = await http.post<{ body: estypes.UpdateByQueryResponse }>(
const response = await http.post<estypes.UpdateByQueryResponse>(
RAC_ALERTS_BULK_UPDATE_URL,
{ body: JSON.stringify({ index, status, query }) }
);
return body;
return response;
}
},
};

View file

@ -12,6 +12,7 @@ import * as i18n from '../components/t_grid/translations';
import type { AlertStatus, StatusBulkActionsProps } from '../../common/types/timeline';
import { useUpdateAlertsStatus } from '../container/use_update_alerts';
import { useAppToasts } from './use_app_toasts';
import { STANDALONE_ID } from '../components/t_grid/standalone';
export const getUpdateAlertsQuery = (eventIds: Readonly<string[]>) => {
return { bool: { filter: { terms: { _id: eventIds } } } };
@ -28,7 +29,7 @@ export const useStatusBulkActionItems = ({
onUpdateFailure,
timelineId,
}: StatusBulkActionsProps) => {
const { updateAlertStatus } = useUpdateAlertsStatus(timelineId != null);
const { updateAlertStatus } = useUpdateAlertsStatus(timelineId !== STANDALONE_ID);
const { addSuccess, addError, addWarning } = useAppToasts();
const onAlertStatusUpdateSuccess = useCallback(