X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/215d0b7a7e1f69765c5f2a1139e52d8c427066eb..f6f88d9ca9cdeeeebfadcfe999789bfb9f69e5c6:/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 b09b499e1c..37f01dd701 100644 --- a/src/views/process-panel/process-details-card.tsx +++ b/src/views/process-panel/process-details-card.tsx @@ -13,16 +13,17 @@ import { CardContent, Tooltip, Typography, + Button, } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { CloseIcon, MoreOptionsIcon, ProcessIcon } from 'components/icon/icon'; -import { Process } from 'store/processes/process'; +import { CloseIcon, MoreVerticalIcon, ProcessIcon, StartIcon, StopIcon } from 'components/icon/icon'; +import { Process, isProcessRunnable, isProcessResumable, isProcessCancelable } from 'store/processes/process'; import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view'; import { ProcessDetailsAttributes } from './process-details-attributes'; import { ProcessStatus } from 'views-components/data-explorer/renderers'; -import { ContainerState } from 'models/container'; +import classNames from 'classnames'; -type CssRules = 'card' | 'content' | 'title' | 'header' | 'cancelButton' | 'avatar' | 'iconHeader'; +type CssRules = 'card' | 'content' | 'title' | 'header' | 'cancelButton' | 'avatar' | 'iconHeader' | 'actionButton'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { @@ -52,26 +53,42 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ paddingTop: theme.spacing.unit * 0.5, color: theme.customs.colors.green700, }, + actionButton: { + padding: "0px 5px 0 0", + marginRight: "5px", + fontSize: '0.78rem', + }, cancelButton: { - paddingRight: theme.spacing.unit * 2, - fontSize: '14px', - color: theme.customs.colors.red900, - "&:hover": { - cursor: 'pointer' - } + color: theme.palette.common.white, + backgroundColor: theme.customs.colors.red900, + '&:hover': { + backgroundColor: theme.customs.colors.red900, + }, + '& svg': { + fontSize: '22px', + }, }, }); export interface ProcessDetailsCardDataProps { process: Process; cancelProcess: (uuid: string) => void; + startProcess: (uuid: string) => void; + resumeOnHoldWorkflow: (uuid: string) => void; onContextMenu: (event: React.MouseEvent) => void; } type ProcessDetailsCardProps = ProcessDetailsCardDataProps & WithStyles & MPVPanelProps; export const ProcessDetailsCard = withStyles(styles)( - ({ cancelProcess, onContextMenu, classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => { + ({ cancelProcess, startProcess, resumeOnHoldWorkflow, onContextMenu, classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => { + let runAction: ((uuid: string) => void) | undefined = undefined; + if (isProcessRunnable(process)) { + runAction = startProcess; + } else if (isProcessResumable(process)) { + runAction = resumeOnHoldWorkflow; + } + return } action={
- {process.container && process.container.state === ContainerState.RUNNING && - cancelProcess(process.containerRequest.uuid)}>Cancel} + {runAction !== undefined && + } + {isProcessCancelable(process) && + } onContextMenu(event)}> - + - { doHidePanel && - - - } + {doHidePanel && + + + }
} />