Squashed 'bpmn-js-spiffworkflow/' changes from 4f23f860..e92f48da

e92f48da minor fixes to the Bpmn-js-subworkflow spec.
af88025a Merge remote-tracking branch 'origin/main' into feature/call_activity_selection
f3bd1e56 Minor tweak to bpmn-js-spiffworkflow
9207ef45 Minor tweak, in the hopes of getting a text box to update correctly.
084f4646 Fixing a bug in the Call Activity's handing of an update.
c9035994 Return the event bus when calling a search.

git-subtree-dir: bpmn-js-spiffworkflow
git-subtree-split: e92f48da7cb4416310af71bb1699caaca87324cd
This commit is contained in:
burnettk 2022-11-18 10:03:38 -05:00
parent a55ad7037a
commit c574ceba76
5 changed files with 58 additions and 33 deletions

View File

@ -71,30 +71,31 @@ the behavior of the editor making it easier for your end users. There are many
this in the app.js file. this in the app.js file.
Below is a table of all the events that are sent and accepted: Below is a table of all the events that are sent and accepted:
| Event Name | Description | Fired or Acceped | Parameters | Description | | Event Name | Description | Fired or Acceped | Parameters | Description |
|--------------------------------|------------------------------------------------------------------------------| ---------------- |----------------------|--------------------------------------------------------------------------| |--------------------------------|------------------------------------------------------------------|---------|----------------------|--------------------------------------------------------------------------|
| spiff.service\_tasks.requested | Request a list of available services that can be called from a service task. | Fired | \- | | | spiff.service\_tasks.requested | Request a list of available services for service task. | Fired | \- | |
| spiff.service\_tasks.returned | Provides a list of services. | Recieved | serviceTaskOperators | ex: \[{id:'Chuck Facts', parameters\[{id:'category', type:'string'}\]}\] | | spiff.service\_tasks.returned | Provides a list of services. | Recieved | serviceTaskOperators | ex: \[{id:'Chuck Facts', parameters\[{id:'category', type:'string'}\]}\] |
| spiff.script.edit | Request to edit a python script in some sort of facy editor. | Fired | scriptType | one of: script, preScript, postScript | | spiff.script.edit | Request to edit a python script in some sort of facy editor. | Fired | scriptType | one of: script, preScript, postScript |
| | | | value | The actual python script | | | | | value | The actual python script |
| | | | element | The element that needs updating | | | | | element | The element that needs updating |
| | | | eventBus | Used by receiver to fire back an event | | | | | eventBus | Used by receiver to fire back an event |
| spiff.script.update | Update a python script to a new value. | Recieved | scriptType | one of: script, preScript, postScript | | spiff.script.update | Update a python script to a new value. | Recieved | scriptType | one of: script, preScript, postScript |
| | | | value | The updated script | | | | | value | The updated script |
| | | | element | The element that needs updating | | | | | element | The element that needs updating |
| spiff.markdown.edit | Request to edit markdown in a fancy editor. | Fired | element | The element that needs updating | | spiff.markdown.edit | Request to edit markdown in a fancy editor. | Fired | element | The element that needs updating |
| | | | value | The current markdown content | | | | | value | The current markdown content |
| spiff.markdown.update | Update Markdown content for a paticular elements 'instructions'. | Recieved | element | The element that needs updating | | spiff.markdown.update | Update Markdown content for a paticular elements 'instructions'. | Recieved | element | The element that needs updating |
| | | | value | Tne updated Markdown content | | | | | value | Tne updated Markdown content |
| spiff.callactivity.edit | Requst to edit a call activity by process id. | Fired | processId | The Process the users wants to edit | | spiff.callactivity.edit | Requst to edit a call activity by process id. | Fired | processId | The Process the users wants to edit |
| spiff.callactivity.search | Requst to search for a call activity | Fired | | | | spiff.callactivity.search | Requst to search for a call activity | Fired | processUd | The currently seleted process id |
| spiff.callactivity.update | Update the process id from a call activity (based on search) | Fired | processId | The Process the users wants to edit | | | | | eventBus | For sending back the selected process id. |
| spiff.file.edit | request to edit a file, but file name. | Fired | value | The file name the user wants to edit | | spiff.callactivity.update | Update the process id from a call activity (based on search) | Received | processId | The Process the users wants to edit |
| spiff.dmn.edit | request to edit a dmn by process id. | Fired | value | The DMN id the user wants to edit | | spiff.file.edit | request to edit a file, but file name. | Fired | value | The file name the user wants to edit |
| spiff.json\_files.requested | request a list of local json files. | Fired | optionType | The type of options required ('json' or 'dmn') | | spiff.dmn.edit | request to edit a dmn by process id. | Fired | value | The DMN id the user wants to edit |
| spff.dmn\_files.requested | request of list of local dmn files. | | | | | spiff.json\_files.requested | request a list of local json files. | Fired | optionType | The type of options required ('json' or 'dmn') |
| spiff.json\_files.returned | Return a list of available json files | Recieved | options | \[{lable:'My Label', value:'1'}\] | | spff.dmn\_files.requested | request of list of local dmn files. | | | |
| spff.dmn\_files.returned | Return a list of available dmn files. | Recieved | options | \[{lable:'My Label', value:'1'}\] | | spiff.json\_files.returned | Return a list of available json files | Recieved | options | \[{lable:'My Label', value:'1'}\] |
| spff.dmn\_files.returned | Return a list of available dmn files. | Recieved | options | \[{lable:'My Label', value:'1'}\] |

View File

@ -181,6 +181,17 @@ bpmnModeler.on('spiff.dmn_files.requested', (event) => {
}); });
}); });
// As call activites might refernce processes across the system
// it should be possible to search for a paticular call activity.
bpmnModeler.on('spiff.callactivity.search', (event) => {
console.log("Firing call activity update", event.element)
event.eventBus.fire('spiff.callactivity.update', {
value: 'searched_bpmn_id',
element: event.element,
});
});
// This handles the download and upload buttons - it isn't specific to // This handles the download and upload buttons - it isn't specific to
// the BPMN modeler or these extensions, just a quick way to allow you to // the BPMN modeler or these extensions, just a quick way to allow you to
// create and save files, so keeping it outside the example. // create and save files, so keeping it outside the example.

View File

@ -98,20 +98,29 @@ function CalledElementTextField(props) {
} }
function FindProcessButton(props) { function FindProcessButton(props) {
const { element } = props; const { element, commandStack } = props;
const eventBus = useService('eventBus'); const eventBus = useService('eventBus');
return HeaderButton({ return HeaderButton({
id: 'spiffworkflow-search-call-activity-button', id: 'spiffworkflow-search-call-activity-button',
class: 'spiffworkflow-properties-panel-button', class: 'spiffworkflow-properties-panel-button',
onClick: () => { onClick: () => {
const processId = getCalledElementValue(element); const processId = getCalledElementValue(element);
eventBus.fire('spiff.callactivity.search', {
element, // First, set up the listen, then fire the event, just
processId, // in case we are testing and things are happening superfast.
});
// Listen for a response, to update the script.
eventBus.once('spiff.callactivity.update', (response) => { eventBus.once('spiff.callactivity.update', (response) => {
element.businessObject.calledElement = response.value; commandStack.execute('element.updateProperties', {
element: response.element,
moddleElement: response.element.businessObject,
properties: {
calledElement: response.value,
},
});
});
eventBus.fire('spiff.callactivity.search', {
processId,
eventBus,
element
}); });
}, },
children: 'Search', children: 'Search',

View File

@ -53,7 +53,10 @@ export function SpiffExtensionSelect(props) {
} }
const getOptions = () => { const getOptions = () => {
const optionList = []; const optionList = [];
if (optionType in spiffExtensionOptions) { if (
optionType in spiffExtensionOptions &&
spiffExtensionOptions[optionType] !== null
) {
spiffExtensionOptions[optionType].forEach((opt) => { spiffExtensionOptions[optionType].forEach((opt) => {
optionList.push({ optionList.push({
label: opt.label, label: opt.label,

View File

@ -102,8 +102,9 @@ describe('Call Activities should work', function () {
}); });
await pressButton(button); await pressButton(button);
expect(launchEvent.processId).to.exist; expect(launchEvent.processId).to.exist;
expect(launchEvent.element).to.exist;
eventBus.fire('spiff.callactivity.update', {value: 'searchedProcessId'}); eventBus.fire('spiff.callactivity.update', {value: 'searchedProcessId', element: launchEvent.element});
const textInput = domQuery('input', entry); const textInput = domQuery('input', entry);
expect(businessObject.get('calledElement')).to.equal('searchedProcessId'); expect(businessObject.get('calledElement')).to.equal('searchedProcessId');