X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e7af6c00434d5eb34c72ac714cfd450052185762..1534032e710b57106297576edb28e84b652a76f0:/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 acc1d8f2..fea94b90 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 { getBackgroundColorStatus } from '~/views/process-panel/process-panel-root'; +import { getProcessStatus, getProcessStatusColor } from '../../store/processes/process'; +import { formatDate } from '~/common/formatters'; -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,28 +57,12 @@ 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 { @@ -89,8 +72,8 @@ export interface ProcessInformationCardDataProps { type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles; -export const ProcessInformationCard = withStyles(styles)( - ({ classes, process, onContextMenu }: ProcessInformationCardProps) => +export const ProcessInformationCard = withStyles(styles, { withTheme: true })( + ({ classes, process, onContextMenu, theme }: ProcessInformationCardProps) => + 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'} /> @@ -134,4 +125,7 @@ export const ProcessInformationCard = withStyles(styles)( -); \ No newline at end of file +); + +const getDescription = (process: Process) => + process.containerRequest.description || '(no-description)';