16073: Display process io params from props, hide preview when lacking workflow mount
[arvados-workbench2.git] / src / store / processes / processes-actions.ts
index eb04ed676f7644026cb8462760b47c064336dc87..1f672759a085bd339e76b5c659159fec83e46e72 100644 (file)
@@ -133,13 +133,22 @@ export const reRunProcess = (processUuid: string, workflowUuid: string) =>
         }
     };
 
+/*
+ * Fetches raw inputs from containerRequest mounts with fallback to properties
+ */
 export const getRawInputs = (data: any): CommandInputParameter[] | undefined => {
-    if (!data || !data.mounts || !data.mounts[MOUNT_PATH_CWL_INPUT]) { return undefined; }
-    return (data.mounts[MOUNT_PATH_CWL_INPUT].content);
+    if (!data) { return undefined; }
+    const mountInput = data.mounts?.[MOUNT_PATH_CWL_INPUT]?.content;
+    const propsInput = data.properties?.cwl_input;
+    if (!mountInput && !propsInput) { return undefined; }
+    return (mountInput || propsInput);
 }
 
 export const getInputs = (data: any): CommandInputParameter[] => {
     if (!data || !data.mounts || !data.mounts[MOUNT_PATH_CWL_WORKFLOW]) { return []; }
+    const content  = getRawInputs(data) as any;
+    if (!content) { return []; }
+
     const inputs = getWorkflowInputs(data.mounts[MOUNT_PATH_CWL_WORKFLOW].content);
     return inputs ? inputs.map(
         (it: any) => (
@@ -147,14 +156,22 @@ export const getInputs = (data: any): CommandInputParameter[] => {
                 type: it.type,
                 id: it.id,
                 label: it.label,
-                default: data.mounts[MOUNT_PATH_CWL_INPUT].content[it.id],
-                value: data.mounts[MOUNT_PATH_CWL_INPUT].content[it.id.split('/').pop()] || [],
+                default: content[it.id],
+                value: content[it.id.split('/').pop()] || [],
                 doc: it.doc
             }
         )
     ) : [];
 };
 
+/*
+ * Fetches raw outputs from containerRequest properties
+ */
+export const getRawOutputs = (data: any): CommandInputParameter[] | undefined => {
+    if (!data || !data.properties || !data.properties.cwl_output) { return undefined; }
+    return (data.properties.cwl_output);
+}
+
 export type InputCollectionMount = {
     path: string;
     pdh: string;