19294: Add tooltip to participant select chip with username/email/uuid
[arvados.git] / src / views-components / process-input-dialog / process-input-dialog.tsx
index 1650c902db0adacde3b85b7f69c81be8d25dfa07..9a186884027295420d258ae7e6b56482f2f75dd8 100644 (file)
@@ -2,12 +2,14 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from "react";
+import React from "react";
 import { Dialog, DialogActions, Button, CardHeader, DialogContent } from '@material-ui/core';
-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 { 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,16 +33,17 @@ export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
         </Dialog>
 );
 
-const getInputs = (data: any) =>
-    data && data.mounts["/var/lib/cwl/workflow.json"] ? data.mounts["/var/lib/cwl/workflow.json"].content.$graph.find(
-        (a: any) => a.id === '#main').inputs.map(
-            (it: any) => (
-                {
-                    type: it.type,
-                    id: it.id,
-                    label: it.label,
-                    value: data.mounts["/var/lib/cwl/cwl.input.json"].content[it.id],
-                    disabled: true
-                }
-            )
-        ) : [];
+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.split('/').pop()] || [],
+                disabled: true
+            }))
+        : [];
+};