X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/32e3370febf2e29c45e27065cdc14a883775f261..02fe86a56f080ed1d5770ad6c6856a15f50ab508:/src/views-components/process-input-dialog/process-input-dialog.tsx

diff --git a/src/views-components/process-input-dialog/process-input-dialog.tsx b/src/views-components/process-input-dialog/process-input-dialog.tsx
index 4ba7fd70..a2d59407 100644
--- a/src/views-components/process-input-dialog/process-input-dialog.tsx
+++ b/src/views-components/process-input-dialog/process-input-dialog.tsx
@@ -8,6 +8,8 @@ import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { withDialog } from "~/store/dialog/with-dialog";
 import { PROCESS_INPUT_DIALOG_NAME } from '~/store/processes/process-input-actions';
 import { RunProcessInputsForm } from "~/views/run-process-panel/run-process-inputs-form";
+import { MOUNT_PATH_CWL_WORKFLOW, MOUNT_PATH_CWL_INPUT } from "~/models/process";
+import { getWorkflowInputs } from "~/models/workflow";
 
 export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
     (props: WithDialogProps<any>) =>
@@ -31,52 +33,18 @@ export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
         </Dialog>
 );
 
-const getInputs = (data: any) =>
-    data && data.mounts.varLibCwlWorkflowJson ? data.mounts.varLibCwlWorkflowJson.content.graph[1].inputs.map((it: any) => (
-        { type: it.type, id: it.id, label: it.label, value: getInputValue(it.id, data.mounts.varLibCwlCwlInputJson.content), disabled: true }
-    )) : [];
-
-const getInputValue = (id: string, data: any) => {
-    switch (id) {
-        case "#main/example_flag":
-            return data.exampleFlag;
-        case "#main/example_directory":
-            return data.exampleDirectory;
-        case "#main/example_double":
-            return data.exampleDouble;
-        case "#main/example_file":
-            return data.exampleFile;
-        case "#main/example_float":
-            return data.exampleFloat;
-        case "#main/example_int":
-            return data.exampleInt;
-        case "#main/example_long":
-            return data.exampleLong;
-        case "#main/example_null":
-            return data.exampleNull;
-        case "#main/example_string":
-            return data.exampleString;
-        case "#main/enum_type":
-            return data.enumType;
-        case "#main/multiple_collections":
-            return data.multipleCollections;
-        case "#main/example_string_array":
-            return data.exampleStringArray;
-        case "#main/example_int_array":
-            return data.exampleIntArray;
-        case "#main/example_float_array":
-            return data.exampleFloatArray;
-        case "#main/multiple_files":
-            return data.multipleFiles;
-        case "#main/collection":
-            return data.collection;
-        case "#main/optional_file_missing_label":
-            return data.optionalFileMissingLabel;
-        case "#main/optional_file":
-            return data.optionalFile;
-        case "#main/single_file":
-            return data.singleFile;
-        default:
-            return data.exampleString;
-    }
-};
\ No newline at end of file
+const getInputs = (data: any) => {
+    if (!data || !data.mounts || !data.mounts[MOUNT_PATH_CWL_WORKFLOW]) { return []; }
+    const inputs = getWorkflowInputs(data.mounts[MOUNT_PATH_CWL_WORKFLOW].content);
+    return inputs ? inputs.map(
+        (it: any) => (
+            {
+                type: it.type,
+                id: it.id,
+                label: it.label,
+                value: data.mounts[MOUNT_PATH_CWL_INPUT].content[it.id],
+                disabled: true
+            }
+        )
+    ) : [];
+};
