Skip to content

Commit

Permalink
[Security Solution][Exceptions] - Add back exceptions export success …
Browse files Browse the repository at this point in the history
…toast (#131952)

Addresses #88449

It appears that the success toaster code was deleted at some point as the text for the toaster was already there just not in use. Simple fix to add back in. Added check for toaster to existing cypress test.
  • Loading branch information
yctercero authored May 12, 2022
1 parent e267d2e commit 1f91501
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from '../../screens/exceptions';
import { createExceptionList } from '../../tasks/api_calls/exceptions';
import { esArchiverResetKibana } from '../../tasks/es_archiver';
import { TOASTER } from '../../screens/alerts_detection_rules';

const getExceptionList1 = () => ({
...getExceptionList(),
Expand Down Expand Up @@ -79,11 +80,14 @@ describe('Exceptions Table', () => {
waitForExceptionsTableToBeLoaded();
exportExceptionList();

cy.wait('@export').then(({ response }) =>
cy
.wrap(response?.body)
.should('eql', expectedExportedExceptionList(this.exceptionListResponse))
);
cy.wait('@export').then(({ response }) => {
cy.wrap(response?.body).should(
'eql',
expectedExportedExceptionList(this.exceptionListResponse)
);

cy.get(TOASTER).should('have.text', 'Exception list export success');
});
});

it('Filters exception lists on search', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const ExceptionListsTable = React.memo(() => {
const [exportingListIds, setExportingListIds] = useState<string[]>([]);
const [exportDownload, setExportDownload] = useState<{ name?: string; blob?: Blob }>({});
const { navigateToUrl } = application;
const { addError } = useAppToasts();
const { addError, addSuccess } = useAppToasts();

const handleDeleteSuccess = useCallback(
(listId?: string) => () => {
Expand Down Expand Up @@ -165,9 +165,10 @@ export const ExceptionListsTable = React.memo(() => {
const handleExportSuccess = useCallback(
(listId: string) =>
(blob: Blob): void => {
addSuccess(i18n.EXCEPTION_EXPORT_SUCCESS);
setExportDownload({ name: listId, blob });
},
[]
[addSuccess]
);

const handleExportError = useCallback(
Expand Down

0 comments on commit 1f91501

Please sign in to comment.