From ffc9666a04b0cef18a15571c1a0f4fdc41e87b75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kuty=C5=82a?= Date: Sun, 18 Oct 2020 16:03:00 +0200 Subject: [PATCH] 16812: Reverted changes in download action, fixed keep links MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- .../context-menu/actions/download-action.tsx | 4 ++-- .../download-collection-file-action.tsx | 5 ++--- .../actions/file-viewer-action.tsx | 20 ++++++++++++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/views-components/context-menu/actions/download-action.tsx b/src/views-components/context-menu/actions/download-action.tsx index 224d4308..7468954f 100644 --- a/src/views-components/context-menu/actions/download-action.tsx +++ b/src/views-components/context-menu/actions/download-action.tsx @@ -47,7 +47,7 @@ export const DownloadAction = (props: { href?: any, download?: any, onClick?: () return props.href || props.kind === 'files' ? props.kind === 'files' ? createZip(props.href, props.download) : undefined}> @@ -61,4 +61,4 @@ export const DownloadAction = (props: { href?: any, download?: any, onClick?: () : null; -}; +}; \ No newline at end of file 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 437b22ed..7849109d 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 @@ -8,7 +8,6 @@ import { DownloadAction } from "./download-action"; import { getNodeValue } from "../../../models/tree"; 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; @@ -17,7 +16,7 @@ const mapStateToProps = (state: RootState) => { const file = getNodeValue(resource.uuid)(state.collectionPanelFiles); if (file) { return { - href: sanitizeToken(file.url, true), + href: file.url, kind: 'file', currentCollectionUuid }; @@ -25,7 +24,7 @@ const mapStateToProps = (state: RootState) => { } else { const files = filterCollectionFilesBySelection(state.collectionPanelFiles, true); return { - href: files.map(file => sanitizeToken(file.url, true)), + href: files.map(file => file.url), kind: 'files', currentCollectionUuid }; diff --git a/src/views-components/context-menu/actions/file-viewer-action.tsx b/src/views-components/context-menu/actions/file-viewer-action.tsx index 9af2ef92..a631424e 100644 --- a/src/views-components/context-menu/actions/file-viewer-action.tsx +++ b/src/views-components/context-menu/actions/file-viewer-action.tsx @@ -3,16 +3,22 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from "react"; +import { connect } from 'react-redux'; import { ListItemIcon, ListItemText, ListItem } from "@material-ui/core"; import { OpenIcon } from "~/components/icon/icon"; import { sanitizeToken } from "./helpers"; +import { RootState } from "~/store/store"; -export const FileViewerAction = (props: { href?: any, download?: any, onClick?: () => void, kind?: string, currentCollectionUuid?: string; }) => { +export const FileViewerAction = (props: any) => { + const { + keepWebServiceUrl, + keepWebInlineServiceUrl, + } = props; return props.href ? @@ -21,8 +27,16 @@ export const FileViewerAction = (props: { href?: any, download?: any, onClick?: Open in new tab - + : null; }; + +const mapStateToProps = ({ auth }: RootState): any => ({ + keepWebServiceUrl: auth.config.keepWebServiceUrl, + keepWebInlineServiceUrl: auth.config.keepWebInlineServiceUrl, +}); + + +export default connect(mapStateToProps, null)(FileViewerAction); -- 2.30.2