add an additional spiffworkflow extension for Signal events which, when attached to a user or manual task, will allow you to set a button lable which will be displayed beside a submit button and allow the end user to immediately fire that signal event.

This commit is contained in:
Dan 2023-05-01 13:07:22 -04:00
parent 313969da10
commit 0a9db509a0
3 changed files with 60 additions and 1 deletions

View File

@ -3,7 +3,7 @@ import {
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
} from 'bpmn-js-properties-panel';
import diagramXML from '../test/spec/bpmn/empty_diagram.bpmn';
import diagramXML from '../test/spec/bpmn/user_form.bpmn';
import spiffworkflow from './spiffworkflow';
import setupFileOperations from './fileOperations';

View File

@ -8,6 +8,9 @@ import {
import {OPTION_TYPE, SpiffExtensionSelect} from './SpiffExtensionSelect';
import {SpiffExtensionLaunchButton} from './SpiffExtensionLaunchButton';
import {SpiffExtensionTextArea} from './SpiffExtensionTextArea';
import {SpiffExtensionTextInput} from './SpiffExtensionTextInput';
import {hasEventDefinition} from 'bpmn-js/lib/util/DiUtil';
import { PropertyDescription } from 'bpmn-js-properties-panel/';
const LOW_PRIORITY = 500;
@ -32,6 +35,7 @@ export default function ExtensionsPropertiesProvider(
if (is(element, 'bpmn:UserTask')) {
groups.push(createUserGroup(element, translate, moddle, commandStack));
}
if (is(element, 'bpmn:BusinessRuleTask')) {
groups.push(
createBusinessRuleGroup(element, translate, moddle, commandStack)
@ -53,6 +57,15 @@ export default function ExtensionsPropertiesProvider(
createUserInstructionsGroup(element, translate, moddle, commandStack)
);
}
if (
is(element, 'bpmn:BoundaryEvent') &&
hasEventDefinition(element, 'bpmn:SignalEventDefinition') &&
isAny(element.businessObject.attachedToRef, ['bpmn:ManualTask', 'bpmn:UserTask'])
) {
groups.push(
createSignalButtonGroup(element, translate, moddle, commandStack)
);
}
if (is(element, 'bpmn:ServiceTask')) {
groups.push(
createServiceGroup(element, translate, moddle, commandStack)
@ -260,6 +273,41 @@ function createUserInstructionsGroup (
};
}
/**
* Create a group on the main panel with a text box for specifying a
* a Button Label that is associated with a signal event.)
* @param element
* @param translate
* @param moddle
* @returns entries
*/
function createSignalButtonGroup (
element,
translate,
moddle,
commandStack
) {
let description =
<p style={{maxWidth : "330px"}}> If attached to a user/manual task, setting this value will display a button which a user can click to immediately fire this signal event.
</p>
return {
id: 'signal_button',
label: translate('Button'),
entries: [
{
element,
moddle,
commandStack,
component: SpiffExtensionTextInput,
name: 'spiffworkflow:signalButtonLabel',
label: 'Button Label',
description: description
},
],
};
}
/**
* Create a group on the main panel with a text box (for choosing the dmn to connect)
* @param element

View File

@ -70,6 +70,17 @@
}
]
},
{
"name": "signalButtonLabel",
"superClass": [ "Element" ],
"properties": [
{
"name": "value",
"isBody": true,
"type": "String"
}
]
},
{
"name": "properties",
"superClass": [