X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/59caadc58a0b7ffc92fa95c90b16c99a9af6d942..2cfcee1b9b63ab14a493992f1f81e1f71546fa38:/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 e1c3b94345..9e8b783f50 100644 --- a/src/views/process-panel/process-information-card.tsx +++ b/src/views/process-panel/process-information-card.tsx @@ -7,20 +7,19 @@ import { StyleRulesCallback, WithStyles, withStyles, Card, CardHeader, IconButton, CardContent, Grid, Chip, Typography, Tooltip } from '@material-ui/core'; -import * as classnames from "classnames"; 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 } from '~/store/processes/process'; -import { getStatusColor } from '~/views/process-panel/process-panel-root'; +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' | 'link' | 'content' | 'title' | 'avatar' - | 'headerActive' | 'headerCompleted' | 'headerQueued' | 'headerFailed' | 'headerCanceled'; +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', @@ -58,39 +57,26 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ content: { '&:last-child': { paddingBottom: theme.spacing.unit * 2, - paddingTop: '0px' } }, title: { overflow: 'hidden', paddingTop: theme.spacing.unit * 0.5 - }, - headerActive: { - backgroundColor: theme.customs.colors.blue500, - }, - headerCompleted: { - backgroundColor: theme.customs.colors.green700, - }, - headerQueued: { - backgroundColor: theme.customs.colors.grey500, - }, - headerFailed: { - backgroundColor: theme.customs.colors.red900, - }, - headerCanceled: { - backgroundColor: theme.customs.colors.red900, - }, + } }); export interface ProcessInformationCardDataProps { 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, process, onContextMenu }: ProcessInformationCardProps) => +export const ProcessInformationCard = withStyles(styles, { withTheme: true })( + ({ classes, process, onContextMenu, theme, openProcessInputDialog, navigateToOutput, navigateToWorkflow }: ProcessInformationCardProps) => - onContextMenu(event)}> - - + className={classes.chip} + style={{backgroundColor: getProcessStatusColor(getProcessStatus(process), theme as ArvadosTheme)}} /> + + onContextMenu(event)}> + + + } title={ - - - {process.containerRequest.name} + + + {process.containerRequest.name} } - subheader={process.containerRequest.description} /> + subheader={ + + + {getDescription(process)} + + } /> + label='From' + value={process.container ? formatDate(process.container.startedAt!) : 'N/A'} /> - + label='To' + value={process.container ? formatDate(process.container.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)';