Merge pull request #42 from sartography/bugfix/lowercase-overridden-tags

make sure tags with extensions are written to xml correctly
This commit is contained in:
Dan Funk 2023-08-31 10:28:41 -04:00 committed by GitHub
commit d62f021e3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 61 additions and 58 deletions

View File

@ -148,7 +148,7 @@ function getTextFieldForExtension(eventDetails, label, description, catching) {
const debounce = useService('debounceInput'); const debounce = useService('debounceInput');
const translate = useService('translate'); const translate = useService('translate');
const root = getRoot(element.businessObject); const root = getRoot(element.businessObject);
const extensionName = (catching) ? 'spiffworkflow:variableName' : 'spiffworkflow:payloadExpression'; const extensionName = (catching) ? 'spiffworkflow:VariableName' : 'spiffworkflow:PayloadExpression';
const getEvent = () => { const getEvent = () => {
const eventDef = element.businessObject.eventDefinitions.find(v => v.$type == eventDefType); const eventDef = element.businessObject.eventDefinitions.find(v => v.$type == eventDefType);

View File

@ -1,5 +1,5 @@
const SPIFF_PARENT_PROP = 'spiffworkflow:properties'; const SPIFF_PARENT_PROP = 'spiffworkflow:Properties';
const SPIFF_PROP = 'spiffworkflow:property'; const SPIFF_PROP = 'spiffworkflow:Property';
const PREFIX = 'spiffworkflow:'; const PREFIX = 'spiffworkflow:';
/** /**

View File

@ -268,14 +268,14 @@ function createBusinessRuleGroup(element, translate, moddle, commandStack) {
commandStack, commandStack,
component: SpiffExtensionSelect, component: SpiffExtensionSelect,
optionType: OPTION_TYPE.dmn_files, optionType: OPTION_TYPE.dmn_files,
name: 'spiffworkflow:calledDecisionId', name: 'spiffworkflow:CalledDecisionId',
label: translate('Select Decision Table'), label: translate('Select Decision Table'),
description: translate('Select a decision table from the list'), description: translate('Select a decision table from the list'),
}, },
{ {
element, element,
component: SpiffExtensionLaunchButton, component: SpiffExtensionLaunchButton,
name: 'spiffworkflow:calledDecisionId', name: 'spiffworkflow:CalledDecisionId',
label: translate('Launch Editor'), label: translate('Launch Editor'),
event: 'spiff.dmn.edit', event: 'spiff.dmn.edit',
description: translate('Modify the Decision Table'), description: translate('Modify the Decision Table'),
@ -306,7 +306,7 @@ function createUserInstructionsGroup (
moddle, moddle,
commandStack, commandStack,
component: SpiffExtensionTextArea, component: SpiffExtensionTextArea,
name: 'spiffworkflow:instructionsForEndUser', name: 'spiffworkflow:InstructionsForEndUser',
label: 'Instructions', label: 'Instructions',
description: 'Displayed above user forms or when this task is executing.', description: 'Displayed above user forms or when this task is executing.',
}, },
@ -315,7 +315,7 @@ function createUserInstructionsGroup (
moddle, moddle,
commandStack, commandStack,
component: SpiffExtensionLaunchButton, component: SpiffExtensionLaunchButton,
name: 'spiffworkflow:instructionsForEndUser', name: 'spiffworkflow:InstructionsForEndUser',
label: translate('Launch Editor'), label: translate('Launch Editor'),
event: 'spiff.markdown.edit', event: 'spiff.markdown.edit',
listenEvent: 'spiff.markdown.update', listenEvent: 'spiff.markdown.update',
@ -347,7 +347,7 @@ function createAllowGuestGroup (
moddle, moddle,
commandStack, commandStack,
component: SpiffExtensionCheckboxEntry, component: SpiffExtensionCheckboxEntry,
name: 'spiffworkflow:allowGuest', name: 'spiffworkflow:AllowGuest',
label: 'Guest can complete this task', label: 'Guest can complete this task',
description: 'Allow a guest user to complete this task without logging in. They will not be allowed to do anything but submit this task. If another task directly follows it that allows guest access, they could also complete that task.', description: 'Allow a guest user to complete this task without logging in. They will not be allowed to do anything but submit this task. If another task directly follows it that allows guest access, they could also complete that task.',
}, },
@ -356,7 +356,7 @@ function createAllowGuestGroup (
moddle, moddle,
commandStack, commandStack,
component: SpiffExtensionTextArea, component: SpiffExtensionTextArea,
name: 'spiffworkflow:guestConfirmation', name: 'spiffworkflow:GuestConfirmation',
label: 'Guest confirmation', label: 'Guest confirmation',
description: 'This is markdown that is displayed to the user after they complete the task. If this is filled out then the user will not be able to complete additional tasks without a new link to the next task.', description: 'This is markdown that is displayed to the user after they complete the task. If this is filled out then the user will not be able to complete additional tasks without a new link to the next task.',
}, },
@ -365,7 +365,7 @@ function createAllowGuestGroup (
moddle, moddle,
commandStack, commandStack,
component: SpiffExtensionLaunchButton, component: SpiffExtensionLaunchButton,
name: 'spiffworkflow:guestConfirmation', name: 'spiffworkflow:GuestConfirmation',
label: translate('Launch Editor'), label: translate('Launch Editor'),
event: 'spiff.markdown.edit', event: 'spiff.markdown.edit',
listenEvent: 'spiff.markdown.update', listenEvent: 'spiff.markdown.update',
@ -400,7 +400,7 @@ function createSignalButtonGroup (
moddle, moddle,
commandStack, commandStack,
component: SpiffExtensionTextInput, component: SpiffExtensionTextInput,
name: 'spiffworkflow:signalButtonLabel', name: 'spiffworkflow:SignalButtonLabel',
label: 'Button Label', label: 'Button Label',
description: description description: description
}, },

View File

@ -16,7 +16,7 @@ const getScriptUnitTestsModdleElement = (shapeElement) => {
return bizObj.extensionElements return bizObj.extensionElements
.get('values') .get('values')
.filter(function getInstanceOfType(e) { .filter(function getInstanceOfType(e) {
return e.$instanceOf('spiffworkflow:unitTests'); return e.$instanceOf('spiffworkflow:UnitTests');
})[0]; })[0];
}; };
@ -73,19 +73,19 @@ export function ScriptUnitTestArray(props) {
if (!scriptUnitTestsModdleElement) { if (!scriptUnitTestsModdleElement) {
scriptUnitTestsModdleElement = scriptTaskModdleElement.$model.create( scriptUnitTestsModdleElement = scriptTaskModdleElement.$model.create(
'spiffworkflow:unitTests' 'spiffworkflow:UnitTests'
); );
scriptTaskModdleElement.extensionElements scriptTaskModdleElement.extensionElements
.get('values') .get('values')
.push(scriptUnitTestsModdleElement); .push(scriptUnitTestsModdleElement);
} }
const scriptUnitTestModdleElement = scriptTaskModdleElement.$model.create( const scriptUnitTestModdleElement = scriptTaskModdleElement.$model.create(
'spiffworkflow:unitTest' 'spiffworkflow:UnitTest'
); );
const scriptUnitTestInputModdleElement = const scriptUnitTestInputModdleElement =
scriptTaskModdleElement.$model.create('spiffworkflow:inputJson'); scriptTaskModdleElement.$model.create('spiffworkflow:InputJson');
const scriptUnitTestOutputModdleElement = const scriptUnitTestOutputModdleElement =
scriptTaskModdleElement.$model.create('spiffworkflow:expectedOutputJson'); scriptTaskModdleElement.$model.create('spiffworkflow:ExpectedOutputJson');
scriptUnitTestModdleElement.id = moddle.ids.nextPrefixed('ScriptUnitTest_'); scriptUnitTestModdleElement.id = moddle.ids.nextPrefixed('ScriptUnitTest_');
scriptUnitTestInputModdleElement.value = '{}'; scriptUnitTestInputModdleElement.value = '{}';
scriptUnitTestOutputModdleElement.value = '{}'; scriptUnitTestOutputModdleElement.value = '{}';

View File

@ -12,9 +12,11 @@ let serviceTaskOperators = [];
const previouslyUsedServiceTaskParameterValuesHash = {}; const previouslyUsedServiceTaskParameterValuesHash = {};
const LOW_PRIORITY = 500; const LOW_PRIORITY = 500;
const SERVICE_TASK_OPERATOR_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:serviceTaskOperator`; // I'm not going to change these variable names, but this is actually the name of the modeller
const SERVICE_TASK_PARAMETERS_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:parameters`; // type (as defined in moddle/spiffworkflow.json) NOT the element name (which is lowercase)
const SERVICE_TASK_PARAMETER_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:parameter`; const SERVICE_TASK_OPERATOR_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:ServiceTaskOperator`;
const SERVICE_TASK_PARAMETERS_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:Parameters`;
const SERVICE_TASK_PARAMETER_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:Parameter`;
/** /**
* A generic properties' editor for text input. * A generic properties' editor for text input.

View File

@ -9,8 +9,8 @@ import { ScriptUnitTestArray } from './ScriptUnitTestArray';
export const SCRIPT_TYPE = { export const SCRIPT_TYPE = {
bpmn: 'bpmn:script', bpmn: 'bpmn:script',
pre: 'spiffworkflow:preScript', pre: 'spiffworkflow:PreScript',
post: 'spiffworkflow:postScript', post: 'spiffworkflow:PostScript',
}; };
function PythonScript(props) { function PythonScript(props) {

View File

@ -18,7 +18,7 @@ export function MessagePayload(props) {
return messageElement.extensionElements return messageElement.extensionElements
.get('values') .get('values')
.filter(function getInstanceOfType(e) { .filter(function getInstanceOfType(e) {
return e.$instanceOf('spiffworkflow:messagePayload'); return e.$instanceOf('spiffworkflow:MessagePayload');
})[0]; })[0];
} }
} }
@ -37,7 +37,7 @@ export function MessagePayload(props) {
let messagePayloadObject = getMessagePayloadObject(); let messagePayloadObject = getMessagePayloadObject();
if (!messagePayloadObject) { if (!messagePayloadObject) {
messagePayloadObject = messageElement.$model.create( messagePayloadObject = messageElement.$model.create(
'spiffworkflow:messagePayload' 'spiffworkflow:MessagePayload'
); );
if (!messageElement.extensionElements) { if (!messageElement.extensionElements) {
messageElement.extensionElements = messageElement.$model.create( messageElement.extensionElements = messageElement.$model.create(

View File

@ -18,7 +18,7 @@ export function MessageVariable(props) {
return messageElement.extensionElements return messageElement.extensionElements
.get('values') .get('values')
.filter(function getInstanceOfType(e) { .filter(function getInstanceOfType(e) {
return e.$instanceOf('spiffworkflow:messageVariable'); return e.$instanceOf('spiffworkflow:MessageVariable');
})[0]; })[0];
} }
} }
@ -37,7 +37,7 @@ export function MessageVariable(props) {
let messageVariableObject = getMessageVariableObject(); let messageVariableObject = getMessageVariableObject();
if (!messageVariableObject) { if (!messageVariableObject) {
messageVariableObject = messageElement.$model.create( messageVariableObject = messageElement.$model.create(
'spiffworkflow:messageVariable' 'spiffworkflow:MessageVariable'
); );
if (!messageElement.extensionElements) { if (!messageElement.extensionElements) {
messageElement.extensionElements = messageElement.$model.create( messageElement.extensionElements = messageElement.$model.create(

View File

@ -3,9 +3,10 @@
"uri": "http://spiffworkflow.org/bpmn/schema/1.0/core", "uri": "http://spiffworkflow.org/bpmn/schema/1.0/core",
"prefix": "spiffworkflow", "prefix": "spiffworkflow",
"associations": [], "associations": [],
"xml": { "tagAlias": "lowerCase" },
"types": [ "types": [
{ {
"name": "preScript", "name": "PreScript",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -16,7 +17,7 @@
] ]
}, },
{ {
"name": "postScript", "name": "PostScript",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -27,7 +28,7 @@
] ]
}, },
{ {
"name": "messagePayload", "name": "MessagePayload",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -38,7 +39,7 @@
] ]
}, },
{ {
"name": "messageVariable", "name": "MessageVariable",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -49,7 +50,7 @@
] ]
}, },
{ {
"name": "calledDecisionId", "name": "CalledDecisionId",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -60,7 +61,7 @@
] ]
}, },
{ {
"name": "instructionsForEndUser", "name": "InstructionsForEndUser",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -71,7 +72,7 @@
] ]
}, },
{ {
"name": "allowGuest", "name": "AllowGuest",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -82,7 +83,7 @@
] ]
}, },
{ {
"name": "guestConfirmation", "name": "GuestConfirmation",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -93,7 +94,7 @@
] ]
}, },
{ {
"name": "signalButtonLabel", "name": "SignalButtonLabel",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -104,20 +105,20 @@
] ]
}, },
{ {
"name": "properties", "name": "Properties",
"superClass": [ "superClass": [
"Element" "Element"
], ],
"properties": [ "properties": [
{ {
"name": "properties", "name": "properties",
"type": "property", "type": "Property",
"isMany": true "isMany": true
} }
] ]
}, },
{ {
"name": "property", "name": "Property",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -133,7 +134,7 @@
] ]
}, },
{ {
"name": "serviceTaskOperator", "name": "ServiceTaskOperator",
"superClass": [ "superClass": [
"Element" "Element"
], ],
@ -155,20 +156,20 @@
] ]
}, },
{ {
"name": "parameters", "name": "Parameters",
"superClass": [ "superClass": [
"Element" "Element"
], ],
"properties": [ "properties": [
{ {
"name": "parameters", "name": "parameters",
"type": "parameter", "type": "Parameter",
"isMany": true "isMany": true
} }
] ]
}, },
{ {
"name": "parameter", "name": "Parameter",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -189,20 +190,20 @@
] ]
}, },
{ {
"name": "unitTests", "name": "UnitTests",
"superClass": [ "superClass": [
"Element" "Element"
], ],
"properties": [ "properties": [
{ {
"name": "unitTests", "name": "unitTests",
"type": "unitTest", "type": "UnitTest",
"isMany": true "isMany": true
} }
] ]
}, },
{ {
"name": "unitTest", "name": "UnitTest",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -212,16 +213,16 @@
}, },
{ {
"name": "inputJson", "name": "inputJson",
"type": "inputJson" "type": "InputJson"
}, },
{ {
"name": "expectedOutputJson", "name": "expectedOutputJson",
"type": "expectedOutputJson" "type": "ExpectedOutputJson"
} }
] ]
}, },
{ {
"name": "inputJson", "name": "InputJson",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -232,7 +233,7 @@
] ]
}, },
{ {
"name": "expectedOutputJson", "name": "ExpectedOutputJson",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -243,7 +244,7 @@
] ]
}, },
{ {
"name": "payloadExpression", "name": "PayloadExpression",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -254,7 +255,7 @@
] ]
}, },
{ {
"name": "variableName", "name": "PariableName",
"superClass": [ "Element" ], "superClass": [ "Element" ],
"properties": [ "properties": [
{ {
@ -265,7 +266,7 @@
] ]
}, },
{ {
"name": "scriptsOnInstances", "name": "ScriptsOnInstances",
"extends": [ "extends": [
"bpmn:MultiInstanceLoopCharacteristics", "bpmn:MultiInstanceLoopCharacteristics",
"bpmn:StandardLoopCharacteristics" "bpmn:StandardLoopCharacteristics"

View File

@ -49,7 +49,7 @@ describe('Business Rule Properties Panel', function () {
modeler.get('eventBus').once('spiff.dmn_files.requested', return_files); modeler.get('eventBus').once('spiff.dmn_files.requested', return_files);
expectSelected('business_rule_task'); expectSelected('business_rule_task');
// THEN - a properties panel exists with a section for editing that script // THEN - a properties panel exists with a section for editing that script
const entry = findEntry('extension_spiffworkflow:calledDecisionId', getPropertiesPanel()); const entry = findEntry('extension_spiffworkflow:CalledDecisionId', getPropertiesPanel());
expect(entry, 'No Entry').to.exist; expect(entry, 'No Entry').to.exist;
const selectList = findSelect(entry); const selectList = findSelect(entry);
expect(selectList, 'No Select').to.exist; expect(selectList, 'No Select').to.exist;
@ -60,7 +60,7 @@ describe('Business Rule Properties Panel', function () {
const modeler = getBpmnJS(); const modeler = getBpmnJS();
modeler.get('eventBus').once('spiff.dmn_files.requested', return_files); modeler.get('eventBus').once('spiff.dmn_files.requested', return_files);
const businessRuleTask = await expectSelected('business_rule_task'); const businessRuleTask = await expectSelected('business_rule_task');
const entry = findEntry('extension_calledDecisionId', getPropertiesPanel()); const entry = findEntry('extension_CalledDecisionId', getPropertiesPanel());
const selectList = findSelect(entry); const selectList = findSelect(entry);
changeInput(selectList, 'Decision_Pizza_Price'); changeInput(selectList, 'Decision_Pizza_Price');
@ -73,7 +73,7 @@ describe('Business Rule Properties Panel', function () {
it('should load up the xml and the value for the called decision should match the xml', async function () { 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'); const businessRuleTask = await expectSelected('business_rule_task');
const entry = findEntry('extension_calledDecisionId', getPropertiesPanel()); const entry = findEntry('extension_CalledDecisionId', getPropertiesPanel());
const selectList = findSelect(entry); const selectList = findSelect(entry);
expect(selectList.value, "initial value is wrong").to.equal('test_decision'); expect(selectList.value, "initial value is wrong").to.equal('test_decision');

View File

@ -80,7 +80,7 @@ describe('Messages should work', function () {
// Select the second Task // Select the second Task
const sendShape = await expectSelected('ActivitySendLetter'); const sendShape = await expectSelected('ActivitySendLetter');
expect(sendShape, "Can't find Send Task").to.exist; expect(sendShape, "Can't find Send Task").to.exist;
// THEN - there is a payload. // THEN - there is a payload.
const payload = findEntry('messagePayload', container); const payload = findEntry('messagePayload', container);
expect(payload, "Can't find the message payload").to.exist; expect(payload, "Can't find the message payload").to.exist;

View File

@ -62,10 +62,10 @@ describe('Properties Panel Script Tasks', function () {
expect(scriptInput.value).to.equal('x = 100'); expect(scriptInput.value).to.equal('x = 100');
}); });
it('should parse the bpmn:script tag when you open an existing file', async function () { it('should parse the spiffworkflow:prescript tag when you open an existing file', async function () {
await expectSelected('task_confirm'); await expectSelected('task_confirm');
const entry = findEntry( const entry = findEntry(
'pythonScript_spiffworkflow:preScript', 'pythonScript_spiffworkflow:PreScript',
PROPERTIES_PANEL_CONTAINER PROPERTIES_PANEL_CONTAINER
); );
const scriptInput = domQuery('textarea', entry); const scriptInput = domQuery('textarea', entry);

View File

@ -129,7 +129,7 @@ describe('Properties Panel for User Tasks', function () {
// The change is reflected in the business object // The change is reflected in the business object
let instructions = getExtensionValue( let instructions = getExtensionValue(
userElement, userElement,
'spiffworkflow:instructionsForEndUser' 'spiffworkflow:InstructionsForEndUser'
); );
expect(instructions).to.equal('#Hello!'); expect(instructions).to.equal('#Hello!');
}); });