1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from 'redux';
6 import { unionize, ofType, UnionOf } from "~/common/unionize";
7 import { ServiceRepository } from "~/services/services";
8 import { RootState } from '~/store/store';
9 import { WorkflowResource } from '~/models/workflow';
11 export const runProcessPanelActions = unionize({
12 SET_CURRENT_STEP: ofType<number>(),
13 SET_WORKFLOWS: ofType<WorkflowResource[]>(),
14 SET_SELECTED_WORKFLOW: ofType<WorkflowResource>(),
17 export interface RunProcessSecondStepDataFormProps {
22 export const RUN_PROCESS_SECOND_STEP_FORM_NAME = 'runProcessSecondStepFormName';
24 export type RunProcessPanelAction = UnionOf<typeof runProcessPanelActions>;
26 export const loadRunProcessPanel = () =>
27 async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
29 const response = await services.workflowService.list();
30 dispatch(runProcessPanelActions.SET_WORKFLOWS(response.items));
36 export const setWorkflow = (workflow: WorkflowResource) =>
37 async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
38 dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
41 export const goToStep = (step: number) => runProcessPanelActions.SET_CURRENT_STEP(step);