X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59caadc58a0b7ffc92fa95c90b16c99a9af6d942..4b8cc1acf54add3e4337b27a7e957a84dc9c07b4:/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 e1c3b943..7fcabcbb 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'; -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 { @@ -87,11 +70,12 @@ export interface ProcessInformationCardDataProps { onContextMenu: (event: React.MouseEvent) => 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 }: ProcessInformationCardProps) => + {console.log(process)} - 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'} /> @@ -134,4 +126,7 @@ export const ProcessInformationCard = withStyles(styles)( -); \ No newline at end of file +); + +const getDescription = (process: Process) => + process.containerRequest.description || '(no-description)';