16073: Correctly handle processes with no outputs to avoid infinite loading indicatior
authorStephen Smith <stephen@curii.com>
Mon, 17 Oct 2022 20:13:45 +0000 (16:13 -0400)
committerStephen Smith <stephen@curii.com>
Mon, 17 Oct 2022 20:13:45 +0000 (16:13 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/store/process-panel/process-panel-actions.ts
src/store/processes/processes-actions.ts
src/views/process-panel/process-io-card.tsx

index b62a48863cccced282c9cab0041e78eb7eb9b19a..758c3523781971b356d410ba0850604c447d3989 100644 (file)
@@ -63,17 +63,17 @@ export const loadOutputs = (containerRequest: ContainerRequestResource, setOutpu
                 // Fetch outputs from keep
                 const outputFile = files.find((file) => file.name === 'cwl.output.json') as CollectionFile | undefined;
                 let outputData = outputFile ? await services.collectionService.getFileContents(outputFile) : undefined;
-                if ((outputData = JSON.parse(outputData)) && collection.portableDataHash) {
+                if (outputData && (outputData = JSON.parse(outputData)) && collection.portableDataHash) {
                     setOutputs({
                         rawOutputs: outputData,
                         pdh: collection.portableDataHash,
                     });
                 } else {
-                    setOutputs({});
+                    setOutputs({rawOutputs: {}});
                 }
             }
         } catch {
-            setOutputs({});
+            setOutputs({rawOutputs: {}});
         }
     };
 
index 1f672759a085bd339e76b5c659159fec83e46e72..1deb4cb87c2cbc21fa77a94450d8b2566241a672 100644 (file)
@@ -135,12 +135,14 @@ export const reRunProcess = (processUuid: string, workflowUuid: string) =>
 
 /*
  * Fetches raw inputs from containerRequest mounts with fallback to properties
+ * Returns undefined if containerRequest not loaded
+ * Returns [] if inputs not found in mounts or props
  */
 export const getRawInputs = (data: any): CommandInputParameter[] | undefined => {
     if (!data) { return undefined; }
     const mountInput = data.mounts?.[MOUNT_PATH_CWL_INPUT]?.content;
     const propsInput = data.properties?.cwl_input;
-    if (!mountInput && !propsInput) { return undefined; }
+    if (!mountInput && !propsInput) { return []; }
     return (mountInput || propsInput);
 }
 
@@ -166,6 +168,7 @@ export const getInputs = (data: any): CommandInputParameter[] => {
 
 /*
  * Fetches raw outputs from containerRequest properties
+ * Assumes containerRequest is loaded
  */
 export const getRawOutputs = (data: any): CommandInputParameter[] | undefined => {
     if (!data || !data.properties || !data.properties.cwl_output) { return undefined; }
index 94544918fc43f99410ea85b85bb518bc951dc47f..828461281a4aea48206ca7d7a9c6e4f8c0d3c4cc 100644 (file)
@@ -287,7 +287,7 @@ export const ProcessIOCard = withStyles(styles)(connect(null, mapDispatchToProps
                                         <ProcessIORaw data={raw} />
                                     </div>}
                             </>}
-                        {raw && Object.keys(raw).length === 0 && <Grid container item alignItems='center' justify='center'>
+                        {!loading && raw && Object.keys(raw).length === 0 && <Grid container item alignItems='center' justify='center'>
                             <DefaultView messages={["No parameters found"]} />
                         </Grid>}
                     </>) :