X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/a54f5270f980d4c2c6143b6654fb96a57b7bf46c..f6daa8a9318d5d7bec1cb173d8897cfcb9826157:/src/views/process-panel/process-information-card.tsx diff --git a/src/views/process-panel/process-information-card.tsx b/src/views/process-panel/process-information-card.tsx index a50490c9..1f42db6b 100644 --- a/src/views/process-panel/process-information-card.tsx +++ b/src/views/process-panel/process-information-card.tsx @@ -10,19 +10,24 @@ import { import { ArvadosTheme } from '~/common/custom-theme'; import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon'; import { DetailsAttribute } from '~/components/details-attribute/details-attribute'; +import { Process } from '~/store/processes/process'; +import { getProcessStatus, getProcessStatusColor } from '~/store/processes/process'; +import { formatDate } from '~/common/formatters'; +import { openWorkflow } from "~/store/process-panel/process-panel-actions"; -type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'chip' | 'headerText' | 'link' | 'content' | 'title' | 'avatar'; +type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'chip' | 'link' | 'content' | 'title' | 'avatar'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { - marginBottom: theme.spacing.unit * 2 + height: '100%' }, iconHeader: { fontSize: '1.875rem', color: theme.customs.colors.green700, }, avatar: { - alignSelf: 'flex-start' + alignSelf: 'flex-start', + paddingTop: theme.spacing.unit * 0.5 }, label: { display: 'flex', @@ -45,75 +50,98 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ chip: { height: theme.spacing.unit * 3, width: theme.spacing.unit * 12, - backgroundColor: theme.customs.colors.green700, color: theme.palette.common.white, fontSize: '0.875rem', borderRadius: theme.spacing.unit * 0.625, }, - headerText: { - fontSize: '0.875rem', - marginLeft: theme.spacing.unit * 3, - }, content: { '&:last-child': { paddingBottom: theme.spacing.unit * 2, - paddingTop: '0px' } }, title: { - overflow: 'hidden' + overflow: 'hidden', + paddingTop: theme.spacing.unit * 0.5 } }); export interface ProcessInformationCardDataProps { - item: any; + process: Process; onContextMenu: (event: React.MouseEvent) => void; + openProcessInputDialog: (uuid: string) => void; + navigateToOutput: (uuid: string) => void; + navigateToWorkflow: (uuid: string) => void; } -type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles; +type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles; -export const ProcessInformationCard = withStyles(styles)( - ({ classes, onContextMenu }: ProcessInformationCardProps) => - +export const ProcessInformationCard = withStyles(styles, { withTheme: true })( + ({ classes, process, onContextMenu, theme, openProcessInputDialog, navigateToOutput, navigateToWorkflow }: ProcessInformationCardProps) => { + const { container } = process; + const startedAt = container ? formatDate(container.startedAt) : 'N/A'; + const finishedAt = container ? formatDate(container.finishedAt) : 'N/A'; + return } + avatar={} action={
- - onContextMenu(event)}> - - + + + onContextMenu(event)}> + + +
} title={ - - - Pipeline template that generates a config file from a template + + + {process.containerRequest.name} } - subheader="(no-description)" /> + subheader={ + + + {getDescription(process)} + + }/> + label='From' + value={process.container ? formatDate(startedAt) : 'N/A'}/> - + label='To' + value={process.container ? formatDate(finishedAt) : 'N/A'}/> + {process.containerRequest.properties.templateUuid && + navigateToWorkflow(process.containerRequest.properties.templateUuid)} + />} - - + navigateToOutput(process.containerRequest.outputUuid!)}> + + + openProcessInputDialog(process.containerRequest.uuid)}> + + -
-); \ No newline at end of file +
; + } +); + +const getDescription = (process: Process) => + process.containerRequest.description || '(no-description)';