+export const loadPresets = (workflowUuid: string) =>
+ async (dispatch: Dispatch<any>, _: () => RootState, { workflowService }: ServiceRepository) => {
+ const { items } = await workflowService.presets(workflowUuid);
+ dispatch(runProcessPanelActions.SET_WORKFLOW_PRESETS(items));
+ };
+
+export const selectPreset = (preset: WorkflowResource) =>
+ (dispatch: Dispatch<any>) => {
+ dispatch(runProcessPanelActions.SELECT_WORKFLOW_PRESET(preset));
+ const inputs = getWorkflowInputs(parseWorkflowDefinition(preset)) || [];
+ const values = inputs.reduce((values, input) => ({
+ ...values,
+ [input.id]: input.default,
+ }), {});
+ dispatch(initialize(RUN_PROCESS_INPUTS_FORM, values));
+ };
+