Merge branch '19715-preserve-url-autologout' into main. Closes #19715
[arvados.git] / src / store / workflow-panel / workflow-panel-actions.ts
index 7c90fa6bb290fbfd6f58aa16f96b2876effc0b88..66a15a9ee09be464022b9d0f969b087823dd12e1 100644 (file)
@@ -9,16 +9,22 @@ import { bindDataExplorerActions } from 'store/data-explorer/data-explorer-actio
 import { propertiesActions } from 'store/properties/properties-actions';
 import { getProperty } from 'store/properties/properties';
 import { navigateToRunProcess } from 'store/navigation/navigation-action';
-import { goToStep, runProcessPanelActions, loadPresets, getWorkflowRunnerSettings } from 'store/run-process-panel/run-process-panel-actions';
+import {
+    goToStep,
+    runProcessPanelActions,
+    loadPresets,
+    getWorkflowRunnerSettings
+} from 'store/run-process-panel/run-process-panel-actions';
 import { snackbarActions } from 'store/snackbar/snackbar-actions';
 import { initialize } from 'redux-form';
 import { RUN_PROCESS_BASIC_FORM } from 'views/run-process-panel/run-process-basic-form';
 import { RUN_PROCESS_INPUTS_FORM } from 'views/run-process-panel/run-process-inputs-form';
 import { RUN_PROCESS_ADVANCED_FORM } from 'views/run-process-panel/run-process-advanced-form';
-import { getResource, ResourcesState } from 'store/resources/resources';
+import { getResource } from 'store/resources/resources';
 import { ProjectResource } from 'models/project';
 import { UserResource } from 'models/user';
 import { getUserUuid } from "common/getuser";
+import { getWorkflowInputs, parseWorkflowDefinition } from 'models/workflow';
 
 export const WORKFLOW_PANEL_ID = "workflowPanel";
 const UUID_PREFIX_PROPERTY_NAME = 'uuidPrefix';
@@ -69,6 +75,18 @@ export const openRunProcess = (workflowUuid: string, ownerUuid?: string, name?:
 
             dispatch(initialize(RUN_PROCESS_BASIC_FORM, { name, owner }));
 
+            const definition = parseWorkflowDefinition(workflow);
+            if (definition) {
+                const inputs = getWorkflowInputs(definition);
+                if (inputs) {
+                    const values = inputs.reduce((values, input) => ({
+                        ...values,
+                        [input.id]: input.default,
+                    }), {});
+                    dispatch(initialize(RUN_PROCESS_INPUTS_FORM, values));
+                }
+            }
+
             if (inputObj) {
                 dispatch(initialize(RUN_PROCESS_INPUTS_FORM, inputObj));
             }