Don't inject configurations using element templates, if user provides no value
See original GitHub issueIs your feature request related to a problem? Please describe
The user raising this issue, uses the element templates feature to let users easily configure elements.
Notice that element templates allow to configure whether a custom input field is allowed to be empty or not (via the notEmpty
constraint).
Now in some cases the users of the templated elements, leave custom input fields empty (which does not create an issue in the propPanel UI, since notEmpty
was not set). However, this then makes in many cases the process not deployable, since the respective injected element, is not configured valid.
Concrete example:
- Have a field injections template (notice that the 2nd field injection does not have
notEmpty
set)
{
"$schema": "https://unpkg.com/@camunda/element-templates-json-schema@0.4.0/resources/schema.json",
"name": "Field Injections",
"id": "com.camunda.example.FieldInjections",
"appliesTo": [
"bpmn:ServiceTask"
],
"properties": [
{
"label": "Field Injection String",
"type": "String",
"value": "My Field Injection Value",
"binding": {
"type": "camunda:field",
"name": "fieldInjectionString",
"expression": false
},
"constraints": {
"notEmpty": true
}
},
{
"label": "Field Injection Expression",
"type": "String",
"value": "${fieldInjectionExpression}",
"editable": false,
"binding": {
"type": "camunda:field",
"name": "fieldInjectionExpression",
"expression": true
}
}
]
}
- Apply the template
- Leave the 2nd custom field empty
- => You can now not deploy this process, because still two field injections were set in the XML, but the second one is not configured with a value.
Describe the solution you’d like
In the example case described above, it would be great if the second field injection would not be part of the XML (if the user leaves the respective custom input empty). This could be implemented in two ways:
A) always don’t insert elements, if the respective inputs are left blank
B) don’t insert elements, if the respective inputs are left blank and an additional flag was set (e.g., optional
)
Describe alternatives you’ve considered
See solutions.
Additional context
Raised via https://jira.camunda.com/browse/SUPPORT-12176 Related to https://github.com/bpmn-io/bpmn-js-properties-panel/issues/559
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
So I looked at this again. While it would work (see https://github.com/bpmn-io/bpmn-js-properties-panel/commit/3adfaf4d8b34f5c585b3473cd3366d6c52a7bc38 for example), it indeed is a lot of work to refactor for all existing Camunda Platform bindings.
I propose to introduce optional for the currently starting Camunda Cloud implementation (if we find time).
I can ensure that via the schema 👍