X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/23180724fefb8b4b31e2c07e711101367942f721..1e1abe6a0146d3f31836334a7e5880e349afed24:/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 b67622d390..37bfbc5f24 100644 --- a/src/store/processes/process-input-actions.ts +++ b/src/store/processes/process-input-actions.ts @@ -6,6 +6,10 @@ import { dialogActions } from '~/store/dialog/dialog-actions'; import { RootState } from '~/store/store'; import { Dispatch } from 'redux'; 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'; @@ -13,7 +17,18 @@ export const openProcessInputDialog = (processUuid: string) => (dispatch: Dispatch, getState: () => RootState) => { const process = getProcess(processUuid)(getState().resources); if (process) { - const data: Process = process; - dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data })); + const data: any = process; + 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