X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0f433d72c1af64a6359478da2edb8c9f589d579b..7c6d47d766b7b37463281387d8badbfe18522d09:/src/views/process-panel/process-details-card.tsx diff --git a/src/views/process-panel/process-details-card.tsx b/src/views/process-panel/process-details-card.tsx index 18610781..5cca904a 100644 --- a/src/views/process-panel/process-details-card.tsx +++ b/src/views/process-panel/process-details-card.tsx @@ -12,19 +12,34 @@ import { IconButton, CardContent, Tooltip, + Typography, + Chip, } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { CloseIcon } from 'components/icon/icon'; -import { Process } from 'store/processes/process'; +import { CloseIcon, MoreOptionsIcon, ProcessIcon } from 'components/icon/icon'; +import { Process, getProcessStatus, getProcessStatusColor } from 'store/processes/process'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; import { ProcessDetailsAttributes } from './process-details-attributes'; +import { ContainerState } from 'models/container'; -type CssRules = 'card' | 'content' | 'title'; +type CssRules = 'card' | 'content' | 'title' | 'header' | 'cancelButton' | 'chip' | 'avatar' | 'iconHeader'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { height: '100%' }, + header: { + paddingTop: theme.spacing.unit, + paddingBottom: theme.spacing.unit, + }, + iconHeader: { + fontSize: '1.875rem', + color: theme.customs.colors.green700, + }, + avatar: { + alignSelf: 'flex-start', + paddingTop: theme.spacing.unit * 0.5 + }, content: { '&:last-child': { paddingBottom: theme.spacing.unit * 2, @@ -34,30 +49,80 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ overflow: 'hidden', paddingTop: theme.spacing.unit * 0.5 }, + cancelButton: { + paddingRight: theme.spacing.unit * 2, + fontSize: '14px', + color: theme.customs.colors.red900, + "&:hover": { + cursor: 'pointer' + } + }, + chip: { + height: theme.spacing.unit * 3, + width: theme.spacing.unit * 12, + color: theme.palette.common.white, + fontSize: '0.875rem', + borderRadius: theme.spacing.unit * 0.625, + }, }); export interface ProcessDetailsCardDataProps { process: Process; + cancelProcess: (uuid: string) => void; + onContextMenu: (event: React.MouseEvent) => void; } -type ProcessDetailsCardProps = ProcessDetailsCardDataProps & WithStyles & MPVPanelProps; +type ProcessDetailsCardProps = ProcessDetailsCardDataProps & WithStyles & MPVPanelProps; -export const ProcessDetailsCard = withStyles(styles)( - ({ classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => { +export const ProcessDetailsCard = withStyles(styles, {withTheme: true})( + ({ theme, cancelProcess, onContextMenu, classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => { return } + title={ + + + {process.containerRequest.name} + + + } + subheader={ + + + {getDescription(process)} + + } + action={ +
+ {process.container && process.container.state === ContainerState.RUNNING && + cancelProcess(process.containerRequest.uuid)}>Cancel} + + + onContextMenu(event)}> + + + + { doHidePanel && - } /> + } +
+ } /> - +
; } ); +const getDescription = (process: Process) => + process.containerRequest.description || '(no-description)';