From: Lucas Di Pentima Date: Fri, 23 Oct 2020 15:17:31 +0000 (-0300) Subject: 17018: Fixes the bug adding checks for readonly context menu type. X-Git-Tag: 2.1.1~6^2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/fd44760652570645bb40ff9445bb5b9305a7fa1c?hp=fbaa1cdd31a8066e81a1114be2237ffdfdcbe910 17018: Fixes the bug adding checks for readonly context menu type. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx b/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx index f6038b80..4fc11fb2 100644 --- a/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx +++ b/src/views-components/context-menu/actions/collection-copy-to-clipboard-action.tsx @@ -12,7 +12,9 @@ const mapStateToProps = (state: RootState) => { const { resource } = state.contextMenu; const currentCollectionUuid = state.collectionPanel.item ? state.collectionPanel.item.uuid : ''; const { keepWebServiceUrl } = state.auth.config; - if (resource && resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM) { + if (resource && ( + resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM || + resource.menuKind === ContextMenuKind.READONLY_COLLECTION_FILES_ITEM)) { const file = getNodeValue(resource.uuid)(state.collectionPanelFiles); if (file) { return { @@ -21,10 +23,8 @@ const mapStateToProps = (state: RootState) => { currentCollectionUuid }; } - } else { - return ; } - return ; + return {}; }; export const CollectionCopyToClipboardAction = connect(mapStateToProps)(CopyToClipboardAction); diff --git a/src/views-components/context-menu/actions/collection-file-viewer-action.tsx b/src/views-components/context-menu/actions/collection-file-viewer-action.tsx index f75da238..dfc9d14a 100644 --- a/src/views-components/context-menu/actions/collection-file-viewer-action.tsx +++ b/src/views-components/context-menu/actions/collection-file-viewer-action.tsx @@ -11,7 +11,9 @@ import { ContextMenuKind } from '~/views-components/context-menu/context-menu'; const mapStateToProps = (state: RootState) => { const { resource } = state.contextMenu; const currentCollectionUuid = state.collectionPanel.item ? state.collectionPanel.item.uuid : ''; - if (resource && resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM) { + if (resource && ( + resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM || + resource.menuKind === ContextMenuKind.READONLY_COLLECTION_FILES_ITEM)) { const file = getNodeValue(resource.uuid)(state.collectionPanelFiles); if (file) { return { @@ -20,10 +22,8 @@ const mapStateToProps = (state: RootState) => { currentCollectionUuid }; } - } else { - return; } - return; + return {}; }; export const CollectionFileViewerAction = connect(mapStateToProps)(FileViewerAction); 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 3e4e4a0b..e1986d3c 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 @@ -13,7 +13,9 @@ import { sanitizeToken } from "./helpers"; const mapStateToProps = (state: RootState) => { const { resource } = state.contextMenu; const currentCollectionUuid = state.collectionPanel.item ? state.collectionPanel.item.uuid : ''; - if (resource && resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM) { + if (resource && ( + resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM || + resource.menuKind === ContextMenuKind.READONLY_COLLECTION_FILES_ITEM)) { const file = getNodeValue(resource.uuid)(state.collectionPanelFiles); if (file) { return {