From 3e467c1a87339c399f63db00b15bf34ac8781e31 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Mon, 17 Oct 2022 16:13:45 -0400 Subject: [PATCH] 16073: Correctly handle processes with no outputs to avoid infinite loading indicatior Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- src/store/process-panel/process-panel-actions.ts | 6 +++--- src/store/processes/processes-actions.ts | 5 ++++- src/views/process-panel/process-io-card.tsx | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/store/process-panel/process-panel-actions.ts b/src/store/process-panel/process-panel-actions.ts index b62a4886..758c3523 100644 --- a/src/store/process-panel/process-panel-actions.ts +++ b/src/store/process-panel/process-panel-actions.ts @@ -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: {}}); } }; diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts index 1f672759..1deb4cb8 100644 --- a/src/store/processes/processes-actions.ts +++ b/src/store/processes/processes-actions.ts @@ -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; } diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx index 94544918..82846128 100644 --- a/src/views/process-panel/process-io-card.tsx +++ b/src/views/process-panel/process-io-card.tsx @@ -287,7 +287,7 @@ export const ProcessIOCard = withStyles(styles)(connect(null, mapDispatchToProps } } - {raw && Object.keys(raw).length === 0 && + {!loading && raw && Object.keys(raw).length === 0 && } ) : -- 2.30.2