1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
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';
12 const mapStateToProps = ({ runProcessPanel }: RootState): RunProcessPanelRootDataProps => {
14 workflows: runProcessPanel.searchWorkflows,
15 currentStep: runProcessPanel.currentStep,
16 selectedWorkflow: runProcessPanel.selectedWorkflow
20 const mapDispatchToProps = (dispatch: Dispatch): RunProcessPanelRootActionProps => ({
21 onSetStep: (step: number) => {
22 dispatch<any>(goToStep(step));
24 onSetWorkflow: (workflow: WorkflowResource) => {
25 dispatch<any>(openSetWorkflowDialog(workflow));
28 dispatch<any>(runProcess);
30 onSearch: (term: string) => {
31 dispatch<any>(searchWorkflows(term));
35 export const RunProcessPanel = connect(mapStateToProps, mapDispatchToProps)(RunProcessPanelRoot);