X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e7af6c00434d5eb34c72ac714cfd450052185762..6a9ed65ed717080ce933718436038b5c4dec2a74:/src/views/process-panel/process-subprocesses-card.tsx diff --git a/src/views/process-panel/process-subprocesses-card.tsx b/src/views/process-panel/process-subprocesses-card.tsx index 17c44246..7a1901f1 100644 --- a/src/views/process-panel/process-subprocesses-card.tsx +++ b/src/views/process-panel/process-subprocesses-card.tsx @@ -7,14 +7,14 @@ import { StyleRulesCallback, WithStyles, withStyles, Card, CardHeader, IconButton, CardContent, Typography, Tooltip } from '@material-ui/core'; -import * as classnames from "classnames"; import { ArvadosTheme } from '~/common/custom-theme'; import { MoreOptionsIcon } from '~/components/icon/icon'; import { DetailsAttribute } from '~/components/details-attribute/details-attribute'; -import { getBackgroundColorStatus } from '~/views/process-panel/process-panel-root'; +import { Process, getProcessStatus, getProcessRuntime } from '~/store/processes/process'; +import { formatTime } from '~/common/formatters'; +import { getProcessStatusColor } from '~/store/processes/process'; -export type CssRules = 'label' | 'value' | 'title' | 'content' | 'action' | 'options' | 'status' | 'rightSideHeader' | 'titleHeader' - | 'header' | 'headerActive' | 'headerCompleted' | 'headerQueued' | 'headerFailed' | 'headerCanceled'; +export type CssRules = 'label' | 'value' | 'title' | 'content' | 'action' | 'options' | 'status' | 'rightSideHeader' | 'titleHeader' | 'header' | 'moreOptions'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ label: { @@ -56,59 +56,56 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ paddingTop: 0, paddingBottom: 0, }, - 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, - }, + moreOptions: { + position: 'absolute' + } }); +export interface SubprocessItemProps { + title: string; + status: string; + runtime?: string; +} + export interface ProcessSubprocessesCardDataProps { onContextMenu: (event: React.MouseEvent) => void; - items: any; + subprocess: Process; } -type ProcessSubprocessesCardProps = ProcessSubprocessesCardDataProps & WithStyles; +type ProcessSubprocessesCardProps = ProcessSubprocessesCardDataProps & WithStyles; -export const ProcessSubprocessesCard = withStyles(styles)( - ({ classes, onContextMenu, items }: ProcessSubprocessesCardProps) => { +export const ProcessSubprocessesCard = withStyles(styles, { withTheme: true })( + ({ classes, onContextMenu, subprocess, theme }: ProcessSubprocessesCardProps) => { return - {items.status} + {getProcessStatus(subprocess)} - onContextMenu(event)}> - - + + + + + } title={ - + - {items.title} + {subprocess.containerRequest.name} } /> + label="Runtime" value={formatTime(getProcessRuntime(subprocess))} /> ; - }); \ No newline at end of file + });