Fixing a bug in the Call Activity's handing of an update.

This commit is contained in:
Dan 2022-11-14 12:23:22 -05:00
parent 9b62676d4f
commit 48da265837
2 changed files with 23 additions and 5 deletions

View File

@ -181,6 +181,16 @@ 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.eventBus.fire('spiff.callactivity.update', {
value: 'searched_bpmn_id',
});
});
// 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
// create and save files, so keeping it outside the example.

View File

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