Skip to content

Commit

Permalink
feat(element-templates): use the configured property name for executi…
Browse files Browse the repository at this point in the history
…on listener binding
  • Loading branch information
AlexanderSkrock authored and barmac committed Oct 12, 2023
1 parent 7a9a7a7 commit decbaba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/element-templates/CreateHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,27 @@ export function createCamundaOut(binding, value, bpmnFactory) {
*
* @return {ModdleElement}
*/
export function createCamundaExecutionListenerScript(binding, value, bpmnFactory) {
export function createCamundaExecutionListener(binding, value, bpmnFactory) {
const {
event,
name,
scriptFormat
} = binding;

let parameterValue,
parameterDefinition;

if (scriptFormat) {
parameterDefinition = bpmnFactory.create('camunda:Script', {
scriptFormat,
value
return bpmnFactory.create('camunda:ExecutionListener', {
event,
script: bpmnFactory.create('camunda:Script', {
scriptFormat,
value
})
});
} else {
parameterValue = value;
}

const boundPropertyName = name || 'value';
return bpmnFactory.create('camunda:ExecutionListener', {
event,
value: parameterValue,
script: parameterDefinition
[boundPropertyName]: value
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/element-templates/cmd/ChangeElementTemplateHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import handleLegacyScopes from '../util/handleLegacyScopes';

import {
createCamundaExecutionListenerScript,
createCamundaExecutionListener,
createCamundaFieldInjection,
createCamundaIn,
createCamundaInWithBusinessKey,
Expand Down Expand Up @@ -253,7 +253,7 @@ export default class ChangeElementTemplateHandler {
const newBinding = newProperty.binding,
propertyValue = newProperty.value;

return createCamundaExecutionListenerScript(newBinding, propertyValue, bpmnFactory);
return createCamundaExecutionListener(newBinding, propertyValue, bpmnFactory);
});

commandStack.execute('element.updateModdleProperties', {
Expand Down

0 comments on commit decbaba

Please sign in to comment.