Merge commit 'a55ad7037ae14c8480dc49a23340d2e2b4901c6b'

This commit is contained in:
burnettk 2022-11-11 11:41:03 -05:00
commit b862d6b5ac
4 changed files with 68 additions and 11 deletions

View File

@ -72,7 +72,7 @@ this in the app.js file.
Below is a table of all the events that are sent and accepted:
| 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.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 |
@ -87,6 +87,8 @@ Below is a table of all the events that are sent and accepted:
| spiff.markdown.update | Update Markdown content for a paticular elements 'instructions'. | Recieved | element | The element that needs updating |
| | | | 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.search | Requst to search for a call activity | Fired | | |
| spiff.callactivity.update | Update the process id from a call activity (based on search) | Fired | processId | The Process the users 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.dmn.edit | request to edit a dmn by process id. | Fired | value | The DMN id 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') |

View File

@ -46,7 +46,6 @@ function createCalledElementGroup(element, translate, moddle, commandStack) {
translate,
},
/* Commented out until such time as we can effectively calculate the list of available processes by process id */
/*
{
id: `called_element_launch_button`,
element,
@ -55,7 +54,14 @@ function createCalledElementGroup(element, translate, moddle, commandStack) {
commandStack,
translate,
},
*/
{
id: `called_element_find_button`,
element,
component: FindProcessButton,
moddle,
commandStack,
translate,
},
],
};
}
@ -91,6 +97,27 @@ function CalledElementTextField(props) {
});
}
function FindProcessButton(props) {
const { element } = props;
const eventBus = useService('eventBus');
return HeaderButton({
id: 'spiffworkflow-search-call-activity-button',
class: 'spiffworkflow-properties-panel-button',
onClick: () => {
const processId = getCalledElementValue(element);
eventBus.fire('spiff.callactivity.search', {
element,
processId,
});
// Listen for a response, to update the script.
eventBus.once('spiff.callactivity.update', (response) => {
element.businessObject.calledElement = response.value;
});
},
children: 'Search',
});
}
function LaunchEditorButton(props) {
const { element } = props;
const eventBus = useService('eventBus');

View File

@ -21,7 +21,7 @@ export function SpiffExtensionLaunchButton(props) {
listenEvent,
});
// Listen for a respose if the listenEvent is provided, and
// Listen for a response if the listenEvent is provided, and
// set the value to the response
// Optional additional arguments if we should listen for a reponse.
if (listenEvent) {

View File

@ -9,13 +9,14 @@ import { inject } from 'bpmn-js/test/helper';
import {
bootstrapPropertiesPanel,
changeInput,
expectSelected, findButton,
findGroupEntry, pressButton,
expectSelected,
findButton,
findGroupEntry,
pressButton,
} from './helpers';
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
import callActivity from '../../app/spiffworkflow/callActivity';
describe('Call Activities should work', function () {
const xml = require('./bpmn/call_activity.bpmn').default;
let container;
@ -60,9 +61,9 @@ describe('Call Activities should work', function () {
expect(businessObject.get('calledElement')).to.equal('newProcessId');
});
/** fixme: Reenable this when we add this button back in.
it('should issue an event to the event bus if user clicks the edit button', inject(
async function(eventBus) {
it('should issue an event to the event bus if user clicks the edit button', inject(async function (
eventBus
) {
const shapeElement = await expectSelected('the_call_activity');
expect(shapeElement, "Can't find Call Activity").to.exist;
const businessObject = getBusinessObject(shapeElement);
@ -79,5 +80,32 @@ describe('Call Activities should work', function () {
await pressButton(button);
expect(launchEvent.processId).to.exist;
}));
*/
it('should issue an event to the event bus if user clicks the search button', inject(async function (
eventBus
) {
const shapeElement = await expectSelected('the_call_activity');
expect(shapeElement, "Can't find Call Activity").to.exist;
const businessObject = getBusinessObject(shapeElement);
expect(businessObject.get('calledElement')).to.equal('ProcessIdTBD1');
const entry = findGroupEntry('called_element', container);
const button = findButton(
'spiffworkflow-search-call-activity-button',
entry
);
expect(button).to.exist;
let launchEvent;
eventBus.on('spiff.callactivity.search', function (event) {
launchEvent = event;
});
await pressButton(button);
expect(launchEvent.processId).to.exist;
eventBus.fire('spiff.callactivity.update', {value: 'searchedProcessId'});
const textInput = domQuery('input', entry);
expect(businessObject.get('calledElement')).to.equal('searchedProcessId');
}));
});