[arvados-workbench2] updated: 2.5.0-61-g10d5becc

git repository hosting git at public.arvados.org
Thu Feb 16 23:46:00 UTC 2023


Summary of changes:
 src/store/processes/process.ts                   | 22 ++++++++++++++++++++++
 src/views/process-panel/process-details-card.tsx | 19 ++++---------------
 2 files changed, 26 insertions(+), 15 deletions(-)

       via  10d5becc49f4b673d3abfbe8ea9d5f253a24f08b (commit)
      from  9e72f76ee0bbc453c0367fc74da36d1469016a3e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 10d5becc49f4b673d3abfbe8ea9d5f253a24f08b
Author: Stephen Smith <stephen at curii.com>
Date:   Thu Feb 16 18:45:34 2023 -0500

    20000: Move process action checks into helper functions
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/store/processes/process.ts b/src/store/processes/process.ts
index d7fd3aa2..ad0a14c7 100644
--- a/src/store/processes/process.ts
+++ b/src/store/processes/process.ts
@@ -161,6 +161,28 @@ export const getProcessStatus = ({ containerRequest, container }: Process): Proc
     }
 };
 
+export const isProcessRunnable = ({ containerRequest }: Process): boolean => (
+    containerRequest.state === ContainerRequestState.UNCOMMITTED
+);
+
+export const isProcessResumable = ({ containerRequest, container }: Process): boolean => (
+    containerRequest.state === ContainerRequestState.COMMITTED &&
+    containerRequest.priority === 0 &&
+    // Don't show run button when container is present & running or cancelled
+    !(container && (container.state === ContainerState.RUNNING ||
+                            container.state === ContainerState.CANCELLED ||
+                            container.state === ContainerState.COMPLETE))
+);
+
+export const isProcessCancelable = ({ containerRequest, container }: Process): boolean => (
+    containerRequest.priority !== null &&
+    containerRequest.priority > 0 &&
+    container !== undefined &&
+        (container.state === ContainerState.QUEUED ||
+        container.state === ContainerState.LOCKED ||
+        container.state === ContainerState.RUNNING)
+);
+
 const isSubprocess = (containerUuid: string) => (resource: Resource) =>
     resource.kind === ResourceKind.CONTAINER_REQUEST
     && (resource as ContainerRequestResource).requestingContainerUuid === containerUuid;
diff --git a/src/views/process-panel/process-details-card.tsx b/src/views/process-panel/process-details-card.tsx
index b8990b2f..15728eb6 100644
--- a/src/views/process-panel/process-details-card.tsx
+++ b/src/views/process-panel/process-details-card.tsx
@@ -17,12 +17,10 @@ import {
 } from '@material-ui/core';
 import { ArvadosTheme } from 'common/custom-theme';
 import { CloseIcon, MoreOptionsIcon, ProcessIcon, StartIcon, StopIcon } from 'components/icon/icon';
-import { Process } from 'store/processes/process';
+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' | 'actionButton';
@@ -85,13 +83,9 @@ type ProcessDetailsCardProps = ProcessDetailsCardDataProps & WithStyles<CssRules
 export const ProcessDetailsCard = withStyles(styles)(
     ({ cancelProcess, startProcess, resumeOnHoldWorkflow, onContextMenu, classes, process, doHidePanel, panelName }: ProcessDetailsCardProps) => {
         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;
         }
 
@@ -129,12 +123,7 @@ export const ProcessDetailsCard = withStyles(styles)(
                                 <StartIcon />
                                 Run
                             </Button>}
-                        {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 &&
+                        {isProcessCancelable(process) &&
                             <Button
                                 data-cy="process-cancel-button"
                                 variant="outlined"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list