X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59a7af19f6889e79b1b9a4348e9253f3fa0f50c3..874af8e3cf9cb2e0a0a151f3e024c7bdfe8855f6:/src/store/processes/process-input-actions.ts diff --git a/src/store/processes/process-input-actions.ts b/src/store/processes/process-input-actions.ts index 88624d08..37bfbc5f 100644 --- a/src/store/processes/process-input-actions.ts +++ b/src/store/processes/process-input-actions.ts @@ -5,8 +5,11 @@ import { dialogActions } from '~/store/dialog/dialog-actions'; import { RootState } from '~/store/store'; import { Dispatch } from 'redux'; -import { getProcess } from '~/store/processes/process'; +import { getProcess, Process } from '~/store/processes/process'; import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions'; +import { getWorkflowInputs } from '~/models/workflow'; +import { JSONMount } from '~/models/mount-types'; +import { MOUNT_PATH_CWL_WORKFLOW } from '~/models/process'; export const PROCESS_INPUT_DIALOG_NAME = 'processInputDialog'; @@ -15,10 +18,17 @@ export const openProcessInputDialog = (processUuid: string) => const process = getProcess(processUuid)(getState().resources); if (process) { const data: any = process; - if (data && data.containerRequest.mounts["/var/lib/cwl/workflow.json"] && data.containerRequest.mounts["/var/lib/cwl/workflow.json"].content.$graph.find((a: any) => a.class === 'Workflow' && a.id === '#main') && data.containerRequest.mounts["/var/lib/cwl/workflow.json"].content.$graph.find((a: any) => a.class === 'Workflow' && a.id === '#main').inputs.length > 0) { + const inputs = getInputsFromWFMount(process); + if (inputs && inputs.length > 0) { dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data })); } else { dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'There are no inputs in this process!', kind: SnackbarKind.ERROR })); } } - }; \ No newline at end of file + }; + +const getInputsFromWFMount = (process: Process) => { + if (!process || !process.containerRequest.mounts[MOUNT_PATH_CWL_WORKFLOW] ) { return undefined; } + const mnt = process.containerRequest.mounts[MOUNT_PATH_CWL_WORKFLOW] as JSONMount; + return getWorkflowInputs(mnt.content); +}; \ No newline at end of file