From 1f915017fccdc449cada1172914ae4b3aa05952c Mon Sep 17 00:00:00 2001 From: Yara Tercero Date: Thu, 12 May 2022 11:25:06 -0700 Subject: [PATCH] [Security Solution][Exceptions] - Add back exceptions export success 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. --- .../exceptions/exceptions_table.spec.ts | 14 +++++++++----- .../rules/all/exceptions/exceptions_table.tsx | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/exceptions_table.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/exceptions_table.spec.ts index d3bd4d210378b..b037c4f6d62ce 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/exceptions_table.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/exceptions_table.spec.ts @@ -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(), @@ -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', () => { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx index 72984a8bcbe92..0d01872a904e3 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx @@ -96,7 +96,7 @@ export const ExceptionListsTable = React.memo(() => { const [exportingListIds, setExportingListIds] = useState([]); const [exportDownload, setExportDownload] = useState<{ name?: string; blob?: Blob }>({}); const { navigateToUrl } = application; - const { addError } = useAppToasts(); + const { addError, addSuccess } = useAppToasts(); const handleDeleteSuccess = useCallback( (listId?: string) => () => { @@ -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(