X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f2b031de2183439f8aade2f290cd0e3f95f6438c..70a5f1c7b53088552a7f35252aafdaf5fac11d48:/src/views-components/context-menu/actions/download-collection-file-action.tsx?ds=sidebyside

diff --git a/src/views-components/context-menu/actions/download-collection-file-action.tsx b/src/views-components/context-menu/actions/download-collection-file-action.tsx
index 460e620a..aadc1d11 100644
--- a/src/views-components/context-menu/actions/download-collection-file-action.tsx
+++ b/src/views-components/context-menu/actions/download-collection-file-action.tsx
@@ -7,17 +7,30 @@ import { RootState } from "../../../store/store";
 import { DownloadAction } from "./download-action";
 import { getNodeValue } from "../../../models/tree";
 import { CollectionFileType } from "../../../models/collection-file";
+import { ContextMenuKind } from '../context-menu';
+import { filterCollectionFilesBySelection } from "~/store/collection-panel/collection-panel-files/collection-panel-files-state";
 
 const mapStateToProps = (state: RootState) => {
     const { resource } = state.contextMenu;
-    if (resource) {
+    const currentCollectionUuid = state.collectionPanel.item ? state.collectionPanel.item.uuid : '';
+    if (resource && resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM) {
         const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
         if (file) {
             return {
                 href: file.url,
-                download: file.type === CollectionFileType.DIRECTORY ? undefined : file.name
+                download: file.type === CollectionFileType.DIRECTORY ? undefined : file.name,
+                kind: 'file',
+                currentCollectionUuid
             };
         }
+    } else {
+        const files = filterCollectionFilesBySelection(state.collectionPanelFiles, true);
+        return {
+            href: files.map(file => file.url),
+            download: files.map(file => file.name),
+            kind: 'files',
+            currentCollectionUuid
+        };
     }
     return {};
 };
