From 7e7d0ab455b9e37de66a2d311419454159a4b193 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Thu, 13 Dec 2018 15:35:21 +0100 Subject: [PATCH] Add file viewer icon customization Feature #13540 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- public/file-viewers-example.json | 3 ++- src/models/file-viewers-config.ts | 5 +++++ .../context-menu/actions/file-viewer-actions.tsx | 10 ++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public/file-viewers-example.json b/public/file-viewers-example.json index 7c8aefcb..27adb70b 100644 --- a/public/file-viewers-example.json +++ b/public/file-viewers-example.json @@ -6,7 +6,8 @@ ".zip" ], "url": "https://doc.arvados.org", - "filePathParam": "filePath" + "filePathParam": "filePath", + "iconUrl": "https://material.io/tools/icons/static/icons/baseline-next_week-24px.svg" }, { "name": "Collection browser", diff --git a/src/models/file-viewers-config.ts b/src/models/file-viewers-config.ts index 5c23dd49..e95116ba 100644 --- a/src/models/file-viewers-config.ts +++ b/src/models/file-viewers-config.ts @@ -39,4 +39,9 @@ export interface FileViewer { * `https://bam-viewer.com?filePath=/path/to/file` */ filePathParam: string; + + /** + * Icon that will display next to a label + */ + iconUrl?: string; } diff --git a/src/views-components/context-menu/actions/file-viewer-actions.tsx b/src/views-components/context-menu/actions/file-viewer-actions.tsx index f1a46952..961e1828 100644 --- a/src/views-components/context-menu/actions/file-viewer-actions.tsx +++ b/src/views-components/context-menu/actions/file-viewer-actions.tsx @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from "react"; -import { ListItemText, ListItem, ListItemIcon } from "@material-ui/core"; +import { ListItemText, ListItem, ListItemIcon, Icon } from "@material-ui/core"; import { RootState } from '~/store/store'; import { getNodeValue } from '~/models/tree'; import { CollectionDirectory, CollectionFile, CollectionFileType } from '~/models/collection-file'; @@ -65,7 +65,13 @@ export const FileViewerActions = connect(mapStateToProps)( onClick={onClick} target='_blank'> - + { + viewer.iconUrl + ? + + + : + } {viewer.name} -- 2.30.2