[Security Solution] [Exceptions] fixes download from list details page (#150933)

## Summary

Fixes: https://github.com/elastic/kibana/issues/148139

When exporting a shared exception list from that lists' detailed view,
the exported file would not have the `.ndjson` extension appended to it.
I think we should update this to be a single hook used between the two
views.
This commit is contained in:
Devin W. Hurley 2023-02-13 09:29:58 -05:00 committed by GitHub
parent 39197628d2
commit 2749e95fe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -190,6 +190,10 @@ export const useListDetailsView = (exceptionListId: string) => {
[list, exportExceptionList, handleErrorStatus, toasts]
);
const handleOnDownload = useCallback(() => {
setExportedList(undefined);
}, []);
// #region DeleteList
const handleDeleteSuccess = useCallback(
@ -366,6 +370,7 @@ export const useListDetailsView = (exceptionListId: string) => {
canUserEditList,
linkedRules,
exportedList,
handleOnDownload,
viewerStatus,
showManageRulesFlyout,
headerBackOptions,

View file

@ -39,6 +39,7 @@ export const ListsDetailViewComponent: FC = () => {
listId,
linkedRules,
exportedList,
handleOnDownload,
viewerStatus,
listName,
listDescription,
@ -91,7 +92,7 @@ export const ListsDetailViewComponent: FC = () => {
onManageRules={onManageRules}
/>
<AutoDownload blob={exportedList} name={listId} />
<AutoDownload blob={exportedList} name={`${listId}.ndjson`} onDownload={handleOnDownload} />
<ListWithSearch list={list} refreshExceptions={refreshExceptions} isReadOnly={isReadOnly} />
<ReferenceErrorModal
cancelText={i18n.REFERENCE_MODAL_CANCEL_BUTTON}
@ -126,6 +127,7 @@ export const ListsDetailViewComponent: FC = () => {
canUserEditList,
disableManageButton,
exportedList,
handleOnDownload,
headerBackOptions,
invalidListId,
isLoading,