Skip to content

Commit

Permalink
[8.7] [Security Solution] [Exceptions] fixes download from list detai…
Browse files Browse the repository at this point in the history
…ls page (elastic#150933) (elastic#151015)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Security Solution] [Exceptions] fixes download from list details
page (elastic#150933)](elastic#150933)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Devin W.
Hurley","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-02-13T14:29:58Z","message":"[Security
Solution] [Exceptions] fixes download from list details page
(elastic#150933)\n\n## Summary\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/148139\r\n\r\nWhen exporting a
shared exception list from that lists' detailed view,\r\nthe exported
file would not have the `.ndjson` extension appended to it.\r\nI think
we should update this to be a single hook used between the
two\r\nviews.","sha":"2749e95fe0a5f0d1617129765eb3b84ea0cec097","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["review","release_note:skip","Feature:Rule
Exceptions","Team:Security Solution
Platform","v8.7.0","v8.8.0"],"number":150933,"url":"https://github.com/elastic/kibana/pull/150933","mergeCommit":{"message":"[Security
Solution] [Exceptions] fixes download from list details page
(elastic#150933)\n\n## Summary\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/148139\r\n\r\nWhen exporting a
shared exception list from that lists' detailed view,\r\nthe exported
file would not have the `.ndjson` extension appended to it.\r\nI think
we should update this to be a single hook used between the
two\r\nviews.","sha":"2749e95fe0a5f0d1617129765eb3b84ea0cec097"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150933","number":150933,"mergeCommit":{"message":"[Security
Solution] [Exceptions] fixes download from list details page
(elastic#150933)\n\n## Summary\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/148139\r\n\r\nWhen exporting a
shared exception list from that lists' detailed view,\r\nthe exported
file would not have the `.ndjson` extension appended to it.\r\nI think
we should update this to be a single hook used between the
two\r\nviews.","sha":"2749e95fe0a5f0d1617129765eb3b84ea0cec097"}}]}]
BACKPORT-->

Co-authored-by: Devin W. Hurley <[email protected]>
  • Loading branch information
kibanamachine and dhurley14 authored Feb 13, 2023
1 parent 74de86d commit d956a94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ export const useListDetailsView = (exceptionListId: string) => {
[list, exportExceptionList, handleErrorStatus, toasts]
);

const handleOnDownload = useCallback(() => {
setExportedList(undefined);
}, []);

// #region DeleteList

const handleDeleteSuccess = useCallback(
Expand Down Expand Up @@ -366,6 +370,7 @@ export const useListDetailsView = (exceptionListId: string) => {
canUserEditList,
linkedRules,
exportedList,
handleOnDownload,
viewerStatus,
showManageRulesFlyout,
headerBackOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const ListsDetailViewComponent: FC = () => {
listId,
linkedRules,
exportedList,
handleOnDownload,
viewerStatus,
listName,
listDescription,
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -126,6 +127,7 @@ export const ListsDetailViewComponent: FC = () => {
canUserEditList,
disableManageButton,
exportedList,
handleOnDownload,
headerBackOptions,
invalidListId,
isLoading,
Expand Down

0 comments on commit d956a94

Please sign in to comment.