From bf838639f590b5d6cfffbb5c2f02e6899b754b13 Mon Sep 17 00:00:00 2001 From: Arnei Date: Wed, 18 Dec 2024 11:29:13 +0100 Subject: [PATCH] Fix workflow selection for scheduled events When changing a workflow for a scheduled event in the event details, the selected workflow would not be saved. This patch fixes that. --- .../EventDetailsWorkflowTab.tsx | 27 ++----------------- src/slices/eventDetailsSlice.ts | 21 --------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx b/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx index 58daad3acb..963a95ce41 100644 --- a/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx +++ b/src/components/events/partials/ModalTabsAndPages/EventDetailsWorkflowTab.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from "react"; -import { Formik, FormikErrors } from "formik"; +import { Formik } from "formik"; import { deletingWorkflow as getDeletingWorkflow, getBaseWorkflow, @@ -14,7 +14,6 @@ import Notifications from "../../../shared/Notifications"; import RenderWorkflowConfig from "../wizards/RenderWorkflowConfig"; import { getUserInformation } from "../../../../selectors/userInfoSelectors"; import { hasAccess, parseBooleanInObject } from "../../../../utils/utils"; -import { setDefaultConfig } from "../../../../utils/workflowPanelUtils"; import DropDown from "../../../shared/DropDown"; import { useAppDispatch, useAppSelector } from "../../../../store"; import { @@ -24,7 +23,6 @@ import { saveWorkflowConfig, setModalWorkflowId, setModalWorkflowTabHierarchy, - updateWorkflow, } from "../../../../slices/eventDetailsSlice"; import { removeNotificationWizardForm } from "../../../../slices/notificationSlice"; import { renderValidDate } from "../../../../utils/dateUtils"; @@ -96,20 +94,6 @@ const EventDetailsWorkflowTab = ({ return true; }; - const changeWorkflow = (value: string, changeFormikValue: (field: string, value: unknown) => Promise>) => { - let currentConfiguration = {}; - - if (value === baseWorkflow.workflowId) { - currentConfiguration = parseBooleanInObject(baseWorkflow.configuration as { [key: string]: any }); - } else { - currentConfiguration = setDefaultConfig(workflowDefinitions, value); - } - - changeFormikValue("configuration", currentConfiguration); - changeFormikValue("workflowDefinition", value); - dispatch(updateWorkflow(value)); - }; - const setInitialValues = () => { let initialConfig = undefined; @@ -357,10 +341,7 @@ const EventDetailsWorkflowTab = ({ required={true} handleChange={(element) => { if (element) { - changeWorkflow( - element.value, - formik.setFieldValue - ) + formik.setFieldValue("workflowDefinition", element.value) } }} placeholder={ @@ -453,10 +434,6 @@ const EventDetailsWorkflowTab = ({