From 058ff5e0af422bca471ebf3e1df79fed4c5e9e2d Mon Sep 17 00:00:00 2001 From: Arnei Date: Wed, 6 Nov 2024 11:33:30 +0100 Subject: [PATCH 1/2] Fix wf config values not showing for scheduled events When looking at the workflow tab of a scheduled event, the workflow configuration for the workflow would always display default values, regardless of what was initially set. This should fix that. --- .../partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx | 2 -- src/slices/eventDetailsSlice.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx b/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx index 628378d27e..58daad3acb 100644 --- a/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx +++ b/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx @@ -113,8 +113,6 @@ const EventDetailsWorkflowTab = ({ const setInitialValues = () => { let initialConfig = undefined; - // TODO: Scheduled events are missing configuration for their workflow - // Figure out why the config is missing if (baseWorkflow.configuration) { initialConfig = parseBooleanInObject(baseWorkflow.configuration); } diff --git a/src/slices/eventDetailsSlice.ts b/src/slices/eventDetailsSlice.ts index 7b628b5cef..cd2a20e4b9 100644 --- a/src/slices/eventDetailsSlice.ts +++ b/src/slices/eventDetailsSlice.ts @@ -1314,7 +1314,7 @@ export const fetchWorkflows = createAppAsyncThunk('eventDetails/fetchWorkflows', workflow: { workflowId: workflowsData.workflowId, description: undefined, - configuration: undefined + configuration: workflowsData.configuration, }, scheduling: true, entries: [], From d7fd7be61591efb42f3581c71eb487631480777d Mon Sep 17 00:00:00 2001 From: Arnei Date: Mon, 11 Nov 2024 12:41:37 +0100 Subject: [PATCH 2/2] Stringify workflow configuration values Opencast was throwing an error because it expects all workflow config values to be strings. No idea wether that makes sense or not, but this should change our PUT request to give Opencast what it expects. --- src/slices/eventDetailsSlice.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/slices/eventDetailsSlice.ts b/src/slices/eventDetailsSlice.ts index cd2a20e4b9..2378bbb078 100644 --- a/src/slices/eventDetailsSlice.ts +++ b/src/slices/eventDetailsSlice.ts @@ -1830,7 +1830,8 @@ export const saveWorkflowConfig = createAppAsyncThunk('eventDetails/saveWorkflow let header = getHttpHeaders(); let data = new URLSearchParams(); - data.append("configuration", JSON.stringify(jsonData)); + // Scheduler service in Opencast expects values to be strings, so we convert them here + data.append("configuration", JSON.stringify(jsonData, (k, v) => v && typeof v === 'object' ? v : '' + v)); axios .put(`/admin-ng/event/${eventId}/workflows`, data, header)