refs #14815-remove-the-limit-of-subprocess-in-a-process-view
[arvados.git] / src / store / processes / process-input-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { dialogActions } from '~/store/dialog/dialog-actions';
6 import { RootState } from '~/store/store';
7 import { Dispatch } from 'redux';
8 import { getProcess } from '~/store/processes/process';
9 import {snackbarActions, SnackbarKind} from '~/store/snackbar/snackbar-actions';
10
11 export const PROCESS_INPUT_DIALOG_NAME = 'processInputDialog';
12
13 export const openProcessInputDialog = (processUuid: string) =>
14     (dispatch: Dispatch<any>, getState: () => RootState) => {
15         const process = getProcess(processUuid)(getState().resources);
16         if (process) {
17             const data: any = process;
18             if (data && data.containerRequest.mounts.varLibCwlWorkflowJson && data.containerRequest.mounts.varLibCwlWorkflowJson.content.graph[1] && data.containerRequest.mounts.varLibCwlWorkflowJson.content.graph[1].inputs.length > 0) {
19                 dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
20             } else {
21                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'There are no inputs in this process!', kind: SnackbarKind.ERROR }));
22             }
23         }
24     };