From d9d9a67f9b269bcb9cf597c92c4e999ca308d36e Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Thu, 15 Sep 2022 11:15:32 -0400 Subject: [PATCH 1/1] 16073: Add link to collection in subprocess output collection tab Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- src/views/process-panel/process-io-card.tsx | 37 +++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx index 61007dc6..cc4ac182 100644 --- a/src/views/process-panel/process-io-card.tsx +++ b/src/views/process-panel/process-io-card.tsx @@ -3,6 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import React, { ReactElement, useState } from 'react'; +import { Dispatch } from 'redux'; import { StyleRulesCallback, WithStyles, @@ -60,8 +61,9 @@ import { connect } from 'react-redux'; import { RootState } from 'store/store'; import { ProcessOutputCollectionFiles } from './process-output-collection-files'; import { Process } from 'store/processes/process'; +import { navigateTo } from 'store/navigation/navigation-action'; -type CssRules = 'card' | 'content' | 'title' | 'header' | 'avatar' | 'iconHeader' | 'tableWrapper' | 'tableRoot' | 'paramValue' | 'keepLink' | 'imagePreview' | 'valArray' | 'emptyValue' | 'halfRow' | 'symmetricTabs' | 'imagePlaceholder' | 'rowWithPreview'; +type CssRules = 'card' | 'content' | 'title' | 'header' | 'avatar' | 'iconHeader' | 'tableWrapper' | 'tableRoot' | 'paramValue' | 'keepLink' | 'collectionLink' | 'imagePreview' | 'valArray' | 'emptyValue' | 'halfRow' | 'symmetricTabs' | 'imagePlaceholder' | 'rowWithPreview'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { @@ -111,6 +113,15 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ overflowWrap: 'break-word', cursor: 'pointer', }, + collectionLink: { + margin: '10px', + '& a': { + color: theme.palette.primary.main, + textDecoration: 'none', + overflowWrap: 'break-word', + cursor: 'pointer', + } + }, imagePreview: { maxHeight: '15em', maxWidth: '15em', @@ -164,10 +175,18 @@ export interface ProcessIOCardDataProps { outputUuid?: string; } -type ProcessIOCardProps = ProcessIOCardDataProps & WithStyles & MPVPanelProps; +export interface ProcessIOCardActionProps { + navigateTo: (uuid: string) => void; +} -export const ProcessIOCard = withStyles(styles)( - ({ classes, label, params, raw, mounts, outputUuid, doHidePanel, panelName, process }: ProcessIOCardProps) => { +const mapDispatchToProps = (dispatch: Dispatch): ProcessIOCardActionProps => ({ + navigateTo: (uuid) => dispatch(navigateTo(uuid)), +}); + +type ProcessIOCardProps = ProcessIOCardDataProps & ProcessIOCardActionProps & WithStyles & MPVPanelProps; + +export const ProcessIOCard = withStyles(styles)(connect(null, mapDispatchToProps)( + ({ classes, label, params, raw, mounts, outputUuid, doHidePanel, panelName, process, navigateTo }: ProcessIOCardProps) => { const [mainProcTabState, setMainProcTabState] = useState(0); const handleMainProcTabChange = (event: React.MouseEvent, value: number) => { setMainProcTabState(value); @@ -232,7 +251,13 @@ export const ProcessIOCard = withStyles(styles)(
{label === ProcessIOCardType.INPUT && } - {label === ProcessIOCardType.OUTPUT && } + {label === ProcessIOCardType.OUTPUT && <> + {outputUuid && + Output Collection: {navigateTo(outputUuid)}}> + {outputUuid} + } + + }
) } @@ -240,7 +265,7 @@ export const ProcessIOCard = withStyles(styles)( ; } -); +)); export type ProcessIOValue = { display: ReactElement; -- 2.30.2