From 56ee320c152daa4c45197218e1bdeda2f0582258 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Wed, 8 May 2024 17:45:25 +0200 Subject: [PATCH] :sparkles: [#4269] Allow static vars to be used as DMN input parameters --- .../form_design/logic/actions/dmn/DMNParametersForm.js | 9 ++------- .../form_design/logic/actions/dmn/VariableMapping.js | 5 +++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/openforms/js/components/admin/form_design/logic/actions/dmn/DMNParametersForm.js b/src/openforms/js/components/admin/form_design/logic/actions/dmn/DMNParametersForm.js index 5ac5244c1b..c93acd3b58 100644 --- a/src/openforms/js/components/admin/form_design/logic/actions/dmn/DMNParametersForm.js +++ b/src/openforms/js/components/admin/form_design/logic/actions/dmn/DMNParametersForm.js @@ -1,10 +1,9 @@ import {parseExpression} from 'feelin'; import {useFormikContext} from 'formik'; -import React, {useContext} from 'react'; +import React from 'react'; import {FormattedMessage} from 'react-intl'; import {useAsync} from 'react-use'; -import {FormContext} from 'components/admin/form_design/Context'; import {DMN_DECISION_DEFINITIONS_PARAMS_LIST} from 'components/admin/form_design/constants'; import {get} from 'utils/fetch'; @@ -104,7 +103,6 @@ const DMNParametersForm = () => { const { values: {pluginId, decisionDefinitionId, decisionDefinitionVersion}, } = useFormikContext(); - const {formVariables} = useContext(FormContext); const {loading, value: dmnParams = EMPTY_DMN_PARAMS} = useAsync(async () => { if (!pluginId || !decisionDefinitionId) { @@ -131,8 +129,6 @@ const DMNParametersForm = () => { }; }, [pluginId, decisionDefinitionId, decisionDefinitionVersion]); - const variablesChoices = formVariables.map(variable => [variable.key, variable.name]); - return (
@@ -144,8 +140,8 @@ const DMNParametersForm = () => {
@@ -155,7 +151,6 @@ const DMNParametersForm = () => {
diff --git a/src/openforms/js/components/admin/form_design/logic/actions/dmn/VariableMapping.js b/src/openforms/js/components/admin/form_design/logic/actions/dmn/VariableMapping.js index cf6a6c824c..dbaf721dc0 100644 --- a/src/openforms/js/components/admin/form_design/logic/actions/dmn/VariableMapping.js +++ b/src/openforms/js/components/admin/form_design/logic/actions/dmn/VariableMapping.js @@ -9,7 +9,7 @@ import Field from 'components/admin/forms/Field'; import Select from 'components/admin/forms/Select'; import VariableSelection from 'components/admin/forms/VariableSelection'; -const VariableMapping = ({loading, mappingName, formVariables, dmnVariables}) => { +const VariableMapping = ({loading, mappingName, dmnVariables, includeStaticVariables = false}) => { const intl = useIntl(); const {getFieldProps, values} = useFormikContext(); @@ -51,6 +51,7 @@ const VariableMapping = ({loading, mappingName, formVariables, dmnVariables}) => > VariableMapping.propTypes = { loading: PropTypes.bool, mappingName: PropTypes.string, - formVariables: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)), + includeStaticVariables: PropTypes.bool, dmnVariables: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)), };