X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b71cb584942873132af6df8bc65ae28e35f13065..4e46cf6d5000e931ddd1607e40087571664a8a11:/src/views/process-panel/process-details-card.tsx?ds=sidebyside diff --git a/src/views/process-panel/process-details-card.tsx b/src/views/process-panel/process-details-card.tsx index 6ee576b552..37f01dd701 100644 --- a/src/views/process-panel/process-details-card.tsx +++ b/src/views/process-panel/process-details-card.tsx @@ -16,15 +16,14 @@ import { Button, } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { CloseIcon, MoreOptionsIcon, ProcessIcon, StartIcon } 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 { ContainerRequestState } from 'models/container-request'; +import classNames from 'classnames'; -type CssRules = 'card' | 'content' | 'title' | 'header' | 'cancelButton' | 'avatar' | 'iconHeader' | 'runButton'; +type CssRules = 'card' | 'content' | 'title' | 'header' | 'cancelButton' | 'avatar' | 'iconHeader' | 'actionButton'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { @@ -54,17 +53,20 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ paddingTop: theme.spacing.unit * 0.5, color: theme.customs.colors.green700, }, - cancelButton: { - paddingRight: theme.spacing.unit * 2, - fontSize: '14px', - color: theme.customs.colors.red900, - "&:hover": { - cursor: 'pointer' - } - }, - runButton: { + actionButton: { padding: "0px 5px 0 0", marginRight: "5px", + fontSize: '0.78rem', + }, + cancelButton: { + color: theme.palette.common.white, + backgroundColor: theme.customs.colors.red900, + '&:hover': { + backgroundColor: theme.customs.colors.red900, + }, + '& svg': { + fontSize: '22px', + }, }, }); @@ -81,13 +83,9 @@ type ProcessDetailsCardProps = ProcessDetailsCardDataProps & WithStyles { let runAction: ((uuid: string) => void) | undefined = undefined; - if (process.containerRequest.state === ContainerRequestState.UNCOMMITTED) { + if (isProcessRunnable(process)) { runAction = startProcess; - } else if (process.containerRequest.state === ContainerRequestState.COMMITTED && - process.containerRequest.priority === 0 && - // Don't show run button when container is present & running or cancelled - !(process.container && (process.container.state === ContainerState.RUNNING || - process.container.state === ContainerState.CANCELLED))) { + } else if (isProcessResumable(process)) { runAction = resumeOnHoldWorkflow; } @@ -116,33 +114,38 @@ export const ProcessDetailsCard = withStyles(styles)(
{runAction !== undefined && } - {process.container && - (process.container.state === ContainerState.QUEUED || - process.container.state === ContainerState.LOCKED || - process.container.state === ContainerState.RUNNING) && - process.containerRequest.priority !== null && - process.containerRequest.priority > 0 && - cancelProcess(process.containerRequest.uuid)}>Cancel} + {isProcessCancelable(process) && + } onContextMenu(event)}> - + - { doHidePanel && - - - } + {doHidePanel && + + + }
} />