projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '16719-collection-version-basic-ui'
[arvados-workbench2.git]
/
src
/
views-components
/
context-menu
/
actions
/
download-collection-file-action.tsx
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 460e620a1662e8e0897ccab5467e699d93d41d7d..3e4e4a0ba7929418ebc80694768716eb072d4c4d 100644
(file)
--- a/
src/views-components/context-menu/actions/download-collection-file-action.tsx
+++ b/
src/views-components/context-menu/actions/download-collection-file-action.tsx
@@
-6,18
+6,29
@@
import { connect } from "react-redux";
import { RootState } from "../../../store/store";
import { DownloadAction } from "./download-action";
import { getNodeValue } from "../../../models/tree";
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";
+import { sanitizeToken } from "./helpers";
const mapStateToProps = (state: RootState) => {
const { resource } = state.contextMenu;
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 {
const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
if (file) {
return {
- href: file.url,
- download: file.type === CollectionFileType.DIRECTORY ? undefined : file.name
+ href: sanitizeToken(file.url, true),
+ kind: 'file',
+ currentCollectionUuid
};
}
};
}
+ } else {
+ const files = filterCollectionFilesBySelection(state.collectionPanelFiles, true);
+ return {
+ href: files.map(file => file.url),
+ kind: 'files',
+ currentCollectionUuid
+ };
}
return {};
};
}
return {};
};