Merge pull request #11 from sartography/feature/use-xml-element-body-for-business-rule-task

use xml element body rather than attribute for business rule task
This commit is contained in:
Kevin Burnett 2022-08-23 18:06:41 +00:00 committed by GitHub
commit b6bca44c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import {useService } from 'bpmn-js-properties-panel'; import {useService } from 'bpmn-js-properties-panel';
import { TextFieldEntry } from '@bpmn-io/properties-panel'; import { TextFieldEntry } from '@bpmn-io/properties-panel';
const SPIFF_PROP = "spiffworkflow:calledDecision" const SPIFF_PROP = "spiffworkflow:calledDecisionId"
/** /**
* A generic properties' editor for text input. * A generic properties' editor for text input.
@ -12,7 +12,7 @@ const SPIFF_PROP = "spiffworkflow:calledDecision"
* *
<bpmn:businessRuleTask id="Activity_0t218za"> <bpmn:businessRuleTask id="Activity_0t218za">
<bpmn:extensionElements> <bpmn:extensionElements>
<spiffworkflow:calledDecision decisionId="my_id" /> <spiffworkflow:calledDecisionId>my_id</spiffworkflow:calledDecisionId>
</bpmn:extensionElements> </bpmn:extensionElements>
</bpmn:businessRuleTask> </bpmn:businessRuleTask>
* *

View File

@ -27,12 +27,12 @@
] ]
}, },
{ {
"name": "calledDecision", "name": "calledDecisionId",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
"name": "decisionId", "name": "decisionId",
"isAttr": true, "isBody": true,
"type": "String" "type": "String"
} }
] ]

5
package-lock.json generated
View File

@ -1,11 +1,12 @@
{ {
"name": "bpmn-js-spiffworkflow", "name": "bpmn-js-spiffworkflow",
"version": "0.0.7", "version": "0.0.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "0.0.7", "name": "bpmn-js-spiffworkflow",
"version": "0.0.8",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"bpmn-js": "^9.2.2", "bpmn-js": "^9.2.2",

View File

@ -39,7 +39,7 @@ describe('Business Rule Properties Panel', function() {
expect(textInput).to.exist; expect(textInput).to.exist;
}); });
it('should update the spiffworkflow:calledDecision tag when you modify the called decision text input', async function() { it('should update the spiffworkflow:calledDecisionId tag when you modify the called decision text input', async function() {
// IF - a script tag is selected, and you change the script in the properties panel // IF - a script tag is selected, and you change the script in the properties panel
const businessRuleTask = await expectSelected('business_rule_task'); const businessRuleTask = await expectSelected('business_rule_task');
@ -54,4 +54,17 @@ describe('Business Rule Properties Panel', function() {
expect(element.decisionId).to.equal('wonderful'); expect(element.decisionId).to.equal('wonderful');
}); });
it('should load up the xml and the value for the called decision should match the xml', async function() {
const businessRuleTask = await expectSelected('business_rule_task');
let entry = findEntry('extension_called_decision', getPropertiesPanel());
const textInput = domQuery('input', entry);
expect(textInput.value).to.equal('test_decision');
// THEN - the script tag in the BPMN Business object / XML is updated as well.
let businessObject = getBusinessObject(businessRuleTask);
expect(businessObject.extensionElements).to.exist;
let element = businessObject.extensionElements.values[0];
expect(element.decisionId).to.equal('test_decision');
});
}); });

View File

@ -65,7 +65,7 @@
<bpmn:sequenceFlow id="Flow_1lu1qyz" sourceRef="business_rule_task" targetRef="Event_14wzv4j" /> <bpmn:sequenceFlow id="Flow_1lu1qyz" sourceRef="business_rule_task" targetRef="Event_14wzv4j" />
<bpmn:businessRuleTask id="business_rule_task"> <bpmn:businessRuleTask id="business_rule_task">
<bpmn:extensionElements> <bpmn:extensionElements>
<spiffworkflow:calledDecision decisionId="test_decision" /> <spiffworkflow:calledDecisionId>test_decision</spiffworkflow:calledDecisionId>
</bpmn:extensionElements> </bpmn:extensionElements>
<bpmn:incoming>Flow_132laxn</bpmn:incoming> <bpmn:incoming>Flow_132laxn</bpmn:incoming>
<bpmn:outgoing>Flow_1lu1qyz</bpmn:outgoing> <bpmn:outgoing>Flow_1lu1qyz</bpmn:outgoing>