19700: Use correct type and check for process raw input data
[arvados-workbench2.git] / src / views / run-process-panel / run-process-panel.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from 'redux';
6 import { connect } from 'react-redux';
7 import { RootState } from 'store/store';
8 import { RunProcessPanelRootDataProps, RunProcessPanelRootActionProps, RunProcessPanelRoot } from 'views/run-process-panel/run-process-panel-root';
9 import { goToStep, runProcess, searchWorkflows, openSetWorkflowDialog } from 'store/run-process-panel/run-process-panel-actions';
10 import { WorkflowResource } from 'models/workflow';
11
12 const mapStateToProps = ({ runProcessPanel }: RootState): RunProcessPanelRootDataProps => {
13     return {
14         workflows: runProcessPanel.searchWorkflows,
15         currentStep: runProcessPanel.currentStep,
16         selectedWorkflow: runProcessPanel.selectedWorkflow
17     };
18 };
19
20 const mapDispatchToProps = (dispatch: Dispatch): RunProcessPanelRootActionProps => ({
21     onSetStep: (step: number) => {
22         dispatch<any>(goToStep(step));
23     },
24     onSetWorkflow: (workflow: WorkflowResource) => {
25         dispatch<any>(openSetWorkflowDialog(workflow));
26     },
27     runProcess: () => {
28         dispatch<any>(runProcess);
29     },
30     onSearch: (term: string) => {
31         dispatch<any>(searchWorkflows(term));
32     }
33 });
34
35 export const RunProcessPanel = connect(mapStateToProps, mapDispatchToProps)(RunProcessPanelRoot);