X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0eaad7ee985d2534e030e2d2839392435c33bba2..4b961d16b8f8ef8afbd13697a79fe4684acd0416:/src/views-components/process-input-dialog/process-input-dialog.tsx?ds=sidebyside

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 a639fa88..edb4bc68 100644
--- a/src/views-components/process-input-dialog/process-input-dialog.tsx
+++ b/src/views-components/process-input-dialog/process-input-dialog.tsx
@@ -22,7 +22,7 @@ export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
             </DialogContent>
             <DialogActions>
                 <Button
-                    variant='flat'
+                    variant='text'
                     color='primary'
                     onClick={props.closeDialog}>
                     Close
@@ -32,51 +32,16 @@ export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
 );
 
 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: getValue(it.id, data.mounts.varLibCwlCwlInputJson.content), disabled: true }
+    data && data.mounts.varLibCwlWorkflowJson ? data.mounts.varLibCwlWorkflowJson.content.graph.filter((a: any) => a.class === 'Workflow')[0].inputs.map((it: any) => (
+        { type: it.type, id: it.id, label: it.label, value: getInputValue(it.id, data.mounts.varLibCwlCwlInputJson.content), disabled: true }
     )) : [];
 
-const getValue = (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;
-    }
+const snakeToCamel = (s: string) => {
+    const a = s.split('/');
+    return a[1].replace(/(\_\w)/g, (m: string) => m[1].toUpperCase());
+};
+
+export const getInputValue = (id: string, data: any) => {
+    const a = snakeToCamel(id);
+    return data[a];
 };
\ No newline at end of file
