From 55728d1b35d6f0616ad2500d014b5e72bfdc0fdd Mon Sep 17 00:00:00 2001 From: Arnei Date: Thu, 19 Mar 2026 09:49:47 +0100 Subject: [PATCH] Show upload OR schedule workflows in Create Event No matter if you were upload or scheduling a new event, the "Create Event" modal would always offer you all workflows tagged with either "upload" or "schedule" (or both). This patch changes it so that if you are uploading, you only get workflows tagged with "upload". And if you are scheduling, you only get workflows tagged with "schedule". --- .../ModalTabsAndPages/NewProcessingPage.tsx | 9 ++++++--- src/slices/workflowSlice.ts | 14 +++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/events/partials/ModalTabsAndPages/NewProcessingPage.tsx b/src/components/events/partials/ModalTabsAndPages/NewProcessingPage.tsx index 5057995381..4cf30ad41b 100644 --- a/src/components/events/partials/ModalTabsAndPages/NewProcessingPage.tsx +++ b/src/components/events/partials/ModalTabsAndPages/NewProcessingPage.tsx @@ -35,9 +35,12 @@ const NewProcessingPage = ({ useEffect(() => { // Load workflow definitions for selecting - dispatch(fetchWorkflowDef("default")); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + if (formik.values.sourceMode !== "UPLOAD") { + dispatch(fetchWorkflowDef("new-event-schedule")); + } else { + dispatch(fetchWorkflowDef("new-event-upload")); + } + }, [dispatch, formik.values.sourceMode]); // Preselect the first item useEffect(() => { diff --git a/src/slices/workflowSlice.ts b/src/slices/workflowSlice.ts index 957db6e9a2..b7cc78ea8a 100644 --- a/src/slices/workflowSlice.ts +++ b/src/slices/workflowSlice.ts @@ -53,7 +53,9 @@ const initialState: WorkflowState = { }; // fetch workflow definitions from server -export const fetchWorkflowDef = createAppAsyncThunk("workflow/fetchWorkflowDef", async (type: string) => { +export const fetchWorkflowDef = createAppAsyncThunk("workflow/fetchWorkflowDef", async ( + type: "tasks" | "delete-event" | "event-details" | "new-event-upload" | "new-event-schedule" | "default", +) => { type NewProcessing = { default_workflow_id: string, workflows: Workflow[], @@ -78,6 +80,16 @@ export const fetchWorkflowDef = createAppAsyncThunk("workflow/fetchWorkflowDef", tags: "schedule", }; break; + case "new-event-upload": + urlParams = { + tags: "upload", + }; + break; + case "new-event-schedule": + urlParams = { + tags: "schedule", + }; + break; default: { urlParams = { tags: "upload,schedule",