From f9869f1e9f7e2c03ce06ed9d51b9b841e110152e Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:19:59 +0100 Subject: [PATCH] [#4031] Add a confirm popup when switching to v2 options --- .../objectsapi/ObjectsApiOptionsFormFields.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js b/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js index c412888a0e..e0f52518ad 100644 --- a/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js +++ b/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js @@ -21,6 +21,13 @@ const Wrapper = ({children}) => ( const ObjectsApiOptionsFormFields = ({index, name, schema, formData, onChange}) => { const intl = useIntl(); + const v1SwitchMessage = intl.formatMessage({ + defaultMessage: `Switching to the legacy registration options will remove the existing variables mapping. + Are you sure you want to continue? + `, + description: 'Objects API registration backend: v1 switch warning message', + }); + const v2SwitchMessage = intl.formatMessage({ defaultMessage: `Switching to the new registration options will remove the existing JSON templates. You will also not be able to save the form until the variables are correctly mapped. @@ -33,6 +40,12 @@ const ObjectsApiOptionsFormFields = ({index, name, schema, formData, onChange}) const changeVersion = v => { const realVersion = v + 1; + + if (realVersion === 1) { + const confirmV1Switch = window.confirm(v1SwitchMessage); + if (!confirmV1Switch) return; + } + if (realVersion === 2) { const confirmV2Switch = window.confirm(v2SwitchMessage); if (!confirmV2Switch) return;