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 { setWorkflow, SET_WORKFLOW_DIALOG } from 'store/run-process-panel/run-process-panel-actions';
9 import { ConfirmationDialog } from "components/confirmation-dialog/confirmation-dialog";
10 import { withDialog, WithDialogProps } from "store/dialog/with-dialog";
11 import { WorkflowResource } from 'models/workflow';
13 const mapStateToProps = (state: RootState, props: WithDialogProps<{ workflow: WorkflowResource }>) => ({
14 workflow: props.data.workflow
17 const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
18 onConfirm: (workflow: WorkflowResource) => {
20 dispatch<any>(setWorkflow(workflow));
25 stateProps: { workflow: WorkflowResource },
26 dispatchProps: { onConfirm: (workflow: WorkflowResource) => void },
27 props: WithDialogProps<{ workflow: WorkflowResource }>) => ({
28 onConfirm: () => dispatchProps.onConfirm(stateProps.workflow),
32 export const [ChangeWorkflowDialog] = [ConfirmationDialog]
33 .map(connect(mapStateToProps, mapDispatchToProps, mergeProps) as any)
34 .map(withDialog(SET_WORKFLOW_DIALOG));