Skip to content

Commit 55728d1

Browse files
committed
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".
1 parent 47bf603 commit 55728d1

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/components/events/partials/ModalTabsAndPages/NewProcessingPage.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ const NewProcessingPage = <T extends RequiredFormProps>({
3535

3636
useEffect(() => {
3737
// Load workflow definitions for selecting
38-
dispatch(fetchWorkflowDef("default"));
39-
// eslint-disable-next-line react-hooks/exhaustive-deps
40-
}, []);
38+
if (formik.values.sourceMode !== "UPLOAD") {
39+
dispatch(fetchWorkflowDef("new-event-schedule"));
40+
} else {
41+
dispatch(fetchWorkflowDef("new-event-upload"));
42+
}
43+
}, [dispatch, formik.values.sourceMode]);
4144

4245
// Preselect the first item
4346
useEffect(() => {

src/slices/workflowSlice.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ const initialState: WorkflowState = {
5353
};
5454

5555
// fetch workflow definitions from server
56-
export const fetchWorkflowDef = createAppAsyncThunk("workflow/fetchWorkflowDef", async (type: string) => {
56+
export const fetchWorkflowDef = createAppAsyncThunk("workflow/fetchWorkflowDef", async (
57+
type: "tasks" | "delete-event" | "event-details" | "new-event-upload" | "new-event-schedule" | "default",
58+
) => {
5759
type NewProcessing = {
5860
default_workflow_id: string,
5961
workflows: Workflow[],
@@ -78,6 +80,16 @@ export const fetchWorkflowDef = createAppAsyncThunk("workflow/fetchWorkflowDef",
7880
tags: "schedule",
7981
};
8082
break;
83+
case "new-event-upload":
84+
urlParams = {
85+
tags: "upload",
86+
};
87+
break;
88+
case "new-event-schedule":
89+
urlParams = {
90+
tags: "schedule",
91+
};
92+
break;
8193
default: {
8294
urlParams = {
8395
tags: "upload,schedule",

0 commit comments

Comments
 (0)