X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/65128fdb69ac9f7bd2f4653ee1bea95a9ab59559..cd7f6fd81788f459642408df05be2daf214ef437:/src/views/process-panel/process-io-card.tsx diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx index f54fac85d4..7284159ebf 100644 --- a/src/views/process-panel/process-io-card.tsx +++ b/src/views/process-panel/process-io-card.tsx @@ -24,9 +24,10 @@ import { Paper, Grid, Chip, + CircularProgress, } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { CloseIcon, ImageIcon, InfoIcon, InputIcon, ImageOffIcon, OutputIcon } from 'components/icon/icon'; +import { CloseIcon, ImageIcon, InputIcon, ImageOffIcon, OutputIcon, MaximizeIcon } from 'components/icon/icon'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; import { BooleanCommandInputParameter, @@ -63,7 +64,25 @@ 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' | 'collectionLink' | '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: { @@ -82,6 +101,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ paddingTop: theme.spacing.unit * 0.5 }, content: { + height: `calc(100% - ${theme.spacing.unit * 7}px - ${theme.spacing.unit * 1.5}px)`, padding: theme.spacing.unit * 1.0, paddingTop: theme.spacing.unit * 0.5, '&:last-child': { @@ -93,6 +113,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ paddingTop: theme.spacing.unit * 0.5 }, tableWrapper: { + height: `calc(100% - ${theme.spacing.unit * 6}px)`, overflow: 'auto', }, tableRoot: { @@ -100,6 +121,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ '& thead th': { verticalAlign: 'bottom', paddingBottom: '10px', + }, + '& td, & th': { + paddingRight: '25px', } }, paramValue: { @@ -169,7 +193,7 @@ export enum ProcessIOCardType { export interface ProcessIOCardDataProps { process: Process; label: ProcessIOCardType; - params: ProcessIOParameter[]; + params?: ProcessIOParameter[]; raw?: any; mounts?: InputCollectionMount[]; outputUuid?: string; @@ -186,7 +210,7 @@ const mapDispatchToProps = (dispatch: Dispatch): ProcessIOCardActionProps => ({ 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) => { + ({ classes, label, params, raw, mounts, outputUuid, doHidePanel, doMaximizePanel, panelMaximized, panelName, process, navigateTo }: ProcessIOCardProps) => { const [mainProcTabState, setMainProcTabState] = useState(0); const handleMainProcTabChange = (event: React.MouseEvent, value: number) => { setMainProcTabState(value); @@ -215,6 +239,10 @@ export const ProcessIOCard = withStyles(styles)(connect(null, mapDispatchToProps { mainProcess && {setShowImagePreview(!showImagePreview)}}>{showImagePreview ? : } } + { doMaximizePanel && !panelMaximized && + + + } { doHidePanel && @@ -222,52 +250,53 @@ export const ProcessIOCard = withStyles(styles)(connect(null, mapDispatchToProps } /> -
- {mainProcess ? - (<> - {params.length ? - <> - - - - - {mainProcTabState === 0 &&
- -
} - {mainProcTabState === 1 &&
- -
} - : - - - - } - ) : - (<> - {((mounts && mounts.length) || outputUuid) ? - <> - - {label === ProcessIOCardType.INPUT && } - {label === ProcessIOCardType.OUTPUT && } - -
- {label === ProcessIOCardType.INPUT && } - {label === ProcessIOCardType.OUTPUT && <> - {outputUuid && - Output Collection: {navigateTo(outputUuid || "")}}> - {outputUuid} - } - - } -
- : - - - - } - ) - } -
+ {mainProcess ? + (<> + {params === undefined && + + } + {params && params.length > 0 && + <> + + + + + {mainProcTabState === 0 &&
+ +
} + {mainProcTabState === 1 &&
+ +
} + } + {params && params.length === 0 && + + } + ) : + // Subprocess + (<> + {((mounts && mounts.length) || outputUuid) ? + <> + + {label === ProcessIOCardType.INPUT && } + {label === ProcessIOCardType.OUTPUT && } + +
+ {label === ProcessIOCardType.INPUT && } + {label === ProcessIOCardType.OUTPUT && <> + {outputUuid && + Output Collection: {navigateTo(outputUuid || "")}}> + {outputUuid} + } + + } +
+ : + + + + } + ) + }
; } @@ -293,12 +322,13 @@ interface ProcessIOPreviewDataProps { type ProcessIOPreviewProps = ProcessIOPreviewDataProps & WithStyles; const ProcessIOPreview = withStyles(styles)( - ({ classes, data, showImagePreview }: ProcessIOPreviewProps) => - + ({ classes, data, showImagePreview }: ProcessIOPreviewProps) => { + const showLabel = data.some((param: ProcessIOParameter) => param.label); + return
Name - Label + {showLabel && Label} Value Collection @@ -314,7 +344,7 @@ const ProcessIOPreview = withStyles(styles)( {param.id} - {param.label} + {showLabel && {param.label}} {firstVal && } @@ -327,7 +357,7 @@ const ProcessIOPreview = withStyles(styles)( {rest.map((val, i) => ( - + {showLabel && } @@ -341,8 +371,8 @@ const ProcessIOPreview = withStyles(styles)( ; })} -
-); + ; +}); interface ProcessValuePreviewProps { value: ProcessIOValue; @@ -527,9 +557,14 @@ export const getIOParamDisplayValue = (auth: AuthState, input: CommandInputParam } }; +/* + * @returns keep url without keep: prefix + */ const getKeepUrl = (file: File | Directory, pdh?: string): string => { const isKeepUrl = file.location?.startsWith('keep:') || false; - const keepUrl = isKeepUrl ? file.location : pdh ? `keep:${pdh}/${file.location}` : file.location; + const keepUrl = isKeepUrl ? + file.location?.replace('keep:', '') : + pdh ? `${pdh}/${file.location}` : file.location; return keepUrl || ''; }; @@ -543,7 +578,7 @@ const KeepUrlBase = withStyles(styles)(({auth, res, pdh, classes}: KeepUrlProps const keepUrl = getKeepUrl(res, pdh); const pdhUrl = keepUrl ? keepUrl.split('/').slice(0, 1)[0] : ''; // Passing a pdh always returns a relative wb2 collection url - const pdhWbPath = getNavUrl(pdhUrl.replace('keep:', ''), auth); + const pdhWbPath = getNavUrl(pdhUrl, auth); return pdhUrl && pdhWbPath ? {pdhUrl} : <>; @@ -556,18 +591,18 @@ const KeepUrlPath = withStyles(styles)(({auth, res, pdh, classes}: KeepUrlProps const keepUrlPathNav = getKeepNavUrl(auth, res, pdh); return keepUrlPath && keepUrlPathNav ? - handleClick(keepUrlPathNav)}>{keepUrlPath} : + {keepUrlPath} : // Show No value for root collection io that lacks path part ; }); const getKeepNavUrl = (auth: AuthState, file: File | Directory, pdh?: string): string => { - let keepUrl = getKeepUrl(file, pdh).replace('keep:', ''); + let keepUrl = getKeepUrl(file, pdh); return (getInlineFileUrl(`${auth.config.keepWebServiceUrl}/c=${keepUrl}?api_token=${auth.apiToken}`, auth.config.keepWebServiceUrl, auth.config.keepWebInlineServiceUrl)); }; const getImageUrl = (auth: AuthState, file: File, pdh?: string): string => { - const keepUrl = getKeepUrl(file, pdh).replace('keep:', ''); + const keepUrl = getKeepUrl(file, pdh); return getInlineFileUrl(`${auth.config.keepWebServiceUrl}/c=${keepUrl}?api_token=${auth.apiToken}`, auth.config.keepWebServiceUrl, auth.config.keepWebInlineServiceUrl); };