@5minds/node-red-contrib-processcube 0.14.0-develop-7fe136-lygsbbpi → 0.14.0-error-handling-in-process-instance-query-and-add-prettier-8b2f33-lz08cr3v
Sign up to get free protection for your applications and to get access to all the features.
- package/.prettierrc.json +6 -0
- package/Dockerfile +1 -1
- package/docker-compose.yml +12 -0
- package/examples/External-Task-Sample.json +252 -0
- package/externaltask-error.html +26 -12
- package/externaltask-error.js +19 -22
- package/externaltask-input.html +31 -14
- package/externaltask-input.js +114 -57
- package/externaltask-output.html +20 -10
- package/externaltask-output.js +11 -12
- package/message-event-trigger.html +14 -14
- package/message-event-trigger.js +25 -33
- package/nodered/node-red-contrib-processcube-flows.json +216 -132
- package/nodered/package.json +1 -0
- package/nodered/settings.js +82 -92
- package/package.json +5 -2
- package/process-start.html +19 -23
- package/process-start.js +22 -27
- package/processcube-engine-config.html +10 -10
- package/processcube-engine-config.js +39 -17
- package/processdefinition-query.html +29 -23
- package/processdefinition-query.js +13 -25
- package/processes/External-Task-Sample.bpmn +94 -0
- package/processinstance-query.html +19 -20
- package/processinstance-query.js +17 -21
- package/signal-event-trigger.html +14 -14
- package/signal-event-trigger.js +25 -33
- package/usertask-finished-listener.html +17 -12
- package/usertask-finished-listener.js +34 -24
- package/usertask-input.html +40 -27
- package/usertask-input.js +34 -29
- package/usertask-new-listener.html +17 -12
- package/usertask-new-listener.js +35 -26
- package/usertask-output.html +23 -24
- package/usertask-output.js +13 -21
- package/processes/CheckError.bpmn +0 -78
- package/processes/NodeRedExternalTask.bpmn +0 -77
- package/processes/SampleUserTask.bpmn +0 -95
@@ -3,52 +3,58 @@
|
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
query: {value:
|
9
|
-
query_type: {value:
|
10
|
-
models_only: {value: false},
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
query: { value: 'payload' },
|
9
|
+
query_type: { value: 'msg' },
|
10
|
+
models_only: { value: false },
|
11
11
|
},
|
12
12
|
inputs: 1,
|
13
13
|
outputs: 1,
|
14
|
-
icon:
|
15
|
-
label: function() {
|
16
|
-
return this.name ||
|
14
|
+
icon: 'font-awesome/fa-envelope-open',
|
15
|
+
label: function () {
|
16
|
+
return this.name || 'processdefinition-query';
|
17
17
|
},
|
18
|
-
oneditprepare: function() {
|
19
|
-
$(
|
18
|
+
oneditprepare: function () {
|
19
|
+
$('#node-input-query').typedInput({
|
20
20
|
default: 'msg',
|
21
|
-
types: ['msg', 'json']
|
21
|
+
types: ['msg', 'json'],
|
22
22
|
});
|
23
23
|
|
24
|
-
$(
|
25
|
-
$(
|
24
|
+
$('#node-input-query').typedInput('value', this.query);
|
25
|
+
$('#node-input-query').typedInput('type', this.query_type);
|
26
|
+
},
|
27
|
+
oneditsave: function () {
|
28
|
+
(this.query = $('#node-input-query').typedInput('value')),
|
29
|
+
(this.query_type = $('#node-input-query').typedInput('type'));
|
26
30
|
},
|
27
|
-
oneditsave: function() {
|
28
|
-
this.query = $("#node-input-query").typedInput('value'),
|
29
|
-
this.query_type = $("#node-input-query").typedInput('type')
|
30
|
-
|
31
|
-
}
|
32
31
|
});
|
33
32
|
</script>
|
34
33
|
|
35
34
|
<script type="text/html" data-template-name="processdefinition-query">
|
36
35
|
<div class="form-row">
|
37
36
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
38
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
37
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
39
38
|
</div>
|
40
39
|
<div class="form-row">
|
41
40
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
42
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
41
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
43
42
|
</div>
|
44
43
|
<div class="form-row">
|
45
44
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
46
|
-
<input type="text" id="node-input-query"
|
45
|
+
<input type="text" id="node-input-query" />
|
47
46
|
</div>
|
48
47
|
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
49
|
-
<label for="node-input-models_only" style="vertical-align:top"
|
48
|
+
<label for="node-input-models_only" style="vertical-align:top"
|
49
|
+
><i class="fa fa-list-alt"></i> Models Only</label
|
50
|
+
>
|
50
51
|
<div>
|
51
|
-
<input
|
52
|
+
<input
|
53
|
+
type="checkbox"
|
54
|
+
checked
|
55
|
+
id="node-input-models_only"
|
56
|
+
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
57
|
+
/>
|
52
58
|
<label style="width:auto" for="node-input-models_only">Only send models as result.</label>
|
53
59
|
</div>
|
54
60
|
</div>
|
@@ -3,23 +3,15 @@ const EventEmitter = require('node:events');
|
|
3
3
|
|
4
4
|
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
|
-
module.exports = function(RED) {
|
6
|
+
module.exports = function (RED) {
|
7
7
|
function ProcessdefinitionQuery(config) {
|
8
|
-
RED.nodes.createNode(this,config);
|
8
|
+
RED.nodes.createNode(this, config);
|
9
9
|
var node = this;
|
10
10
|
var flowContext = node.context().flow;
|
11
|
-
var nodeContext = node.context();
|
12
11
|
|
13
12
|
this.engine = this.server = RED.nodes.getNode(config.engine);
|
14
13
|
|
15
|
-
const
|
16
|
-
|
17
|
-
var client = nodeContext.get('client');
|
18
|
-
|
19
|
-
if (!client) {
|
20
|
-
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
21
|
-
client = nodeContext.get('client');
|
22
|
-
}
|
14
|
+
const client = this.engine.getEngineClient();
|
23
15
|
|
24
16
|
var eventEmitter = flowContext.get('emitter');
|
25
17
|
|
@@ -28,43 +20,39 @@ module.exports = function(RED) {
|
|
28
20
|
eventEmitter = flowContext.get('emitter');
|
29
21
|
}
|
30
22
|
|
31
|
-
node.on(
|
23
|
+
node.on('close', async () => {
|
32
24
|
client.dispose();
|
33
25
|
client = null;
|
34
26
|
});
|
35
27
|
|
36
|
-
node.on('input', function(msg) {
|
37
|
-
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg)
|
28
|
+
node.on('input', function (msg) {
|
29
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
38
30
|
query = {
|
39
31
|
...query,
|
40
|
-
identity: node.server.identity
|
32
|
+
identity: node.server.identity,
|
41
33
|
};
|
42
|
-
|
43
|
-
client.processDefinitions.getAll(query).then((matchingProcessDefinitions) => {
|
44
34
|
|
45
|
-
|
35
|
+
client.processDefinitions.getAll(query).then((matchingProcessDefinitions) => {
|
46
36
|
if (config.models_only && matchingProcessDefinitions.totalCount > 0) {
|
47
37
|
let models = [];
|
48
38
|
|
49
|
-
matchingProcessDefinitions.processDefinitions.forEach(processDefinition => {
|
50
|
-
processDefinition.processModels.forEach(model => {
|
39
|
+
matchingProcessDefinitions.processDefinitions.forEach((processDefinition) => {
|
40
|
+
processDefinition.processModels.forEach((model) => {
|
51
41
|
models.push(model);
|
52
42
|
});
|
53
43
|
});
|
54
44
|
|
55
45
|
msg.payload = {
|
56
46
|
models: models,
|
57
|
-
totalCount: models.length
|
47
|
+
totalCount: models.length,
|
58
48
|
};
|
59
|
-
|
60
49
|
} else {
|
61
50
|
msg.payload = matchingProcessDefinitions;
|
62
51
|
}
|
63
52
|
|
64
|
-
|
65
53
|
node.send(msg);
|
66
54
|
});
|
67
55
|
});
|
68
56
|
}
|
69
|
-
RED.nodes.registerType(
|
70
|
-
}
|
57
|
+
RED.nodes.registerType('processdefinition-query', ProcessdefinitionQuery);
|
58
|
+
};
|
@@ -0,0 +1,94 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="External-Task-Sample_Definition" targetNamespace="http://bpmn.io/schema/bpmn" exporter="5Minds Studio" exporterVersion="1">
|
3
|
+
<bpmn:collaboration id="Collaboration_1cidyxu" name="">
|
4
|
+
<bpmn:participant id="Participant_0px403d" name="External-Task-Sample" processRef="External-Task-Sample_Process" />
|
5
|
+
<bpmn:textAnnotation id="TextAnnotation_0lbjt7p">
|
6
|
+
<bpmn:text>Will be executed at the boundary event</bpmn:text>
|
7
|
+
</bpmn:textAnnotation>
|
8
|
+
<bpmn:association id="Association_0ivfgz1" associationDirection="None" sourceRef="Activity_0ma3kzt" targetRef="TextAnnotation_0lbjt7p" />
|
9
|
+
</bpmn:collaboration>
|
10
|
+
<bpmn:process id="External-Task-Sample_Process" name="External-Task-Sample" isExecutable="true">
|
11
|
+
<bpmn:laneSet />
|
12
|
+
<bpmn:startEvent id="StartEvent_1" name="Start">
|
13
|
+
<bpmn:outgoing>Flow_0qmxzxk</bpmn:outgoing>
|
14
|
+
</bpmn:startEvent>
|
15
|
+
<bpmn:sequenceFlow id="Flow_0qmxzxk" sourceRef="StartEvent_1" targetRef="Activity_02ykwt2" />
|
16
|
+
<bpmn:sequenceFlow id="Flow_16dfeac" sourceRef="Activity_02ykwt2" targetRef="Activity_0ma3kzt" />
|
17
|
+
<bpmn:endEvent id="Event_05wpeos">
|
18
|
+
<bpmn:incoming>Flow_0mo4oek</bpmn:incoming>
|
19
|
+
</bpmn:endEvent>
|
20
|
+
<bpmn:sequenceFlow id="Flow_0mo4oek" sourceRef="Activity_0ma3kzt" targetRef="Event_05wpeos" />
|
21
|
+
<bpmn:endEvent id="Event_0yn9mzh">
|
22
|
+
<bpmn:incoming>Flow_0y6es1p</bpmn:incoming>
|
23
|
+
</bpmn:endEvent>
|
24
|
+
<bpmn:sequenceFlow id="Flow_0y6es1p" sourceRef="Event_0o7qlkd" targetRef="Event_0yn9mzh" />
|
25
|
+
<bpmn:serviceTask id="Activity_02ykwt2" name="Topic "Test"" camunda:type="external" camunda:topic="Test">
|
26
|
+
<bpmn:incoming>Flow_0qmxzxk</bpmn:incoming>
|
27
|
+
<bpmn:outgoing>Flow_16dfeac</bpmn:outgoing>
|
28
|
+
</bpmn:serviceTask>
|
29
|
+
<bpmn:serviceTask id="Activity_0ma3kzt" name="Topic "SampleError"" camunda:type="external" camunda:topic="SampleError">
|
30
|
+
<bpmn:incoming>Flow_16dfeac</bpmn:incoming>
|
31
|
+
<bpmn:outgoing>Flow_0mo4oek</bpmn:outgoing>
|
32
|
+
</bpmn:serviceTask>
|
33
|
+
<bpmn:boundaryEvent id="Event_0o7qlkd" attachedToRef="Activity_0ma3kzt">
|
34
|
+
<bpmn:outgoing>Flow_0y6es1p</bpmn:outgoing>
|
35
|
+
<bpmn:errorEventDefinition id="ErrorEventDefinition_1lr8fha" errorRef="Error_3O8wBFQi" />
|
36
|
+
</bpmn:boundaryEvent>
|
37
|
+
</bpmn:process>
|
38
|
+
<bpmn:error id="Error_3O8wBFQi" errorCode="MyErrorCode" />
|
39
|
+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
40
|
+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
|
41
|
+
<bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
|
42
|
+
<dc:Bounds x="5" y="30" width="635" height="320" />
|
43
|
+
</bpmndi:BPMNShape>
|
44
|
+
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
|
45
|
+
<dc:Bounds x="92" y="152" width="36" height="36" />
|
46
|
+
<bpmndi:BPMNLabel>
|
47
|
+
<dc:Bounds x="98" y="195" width="24" height="14" />
|
48
|
+
</bpmndi:BPMNLabel>
|
49
|
+
</bpmndi:BPMNShape>
|
50
|
+
<bpmndi:BPMNShape id="Event_05wpeos_di" bpmnElement="Event_05wpeos">
|
51
|
+
<dc:Bounds x="502" y="152" width="36" height="36" />
|
52
|
+
</bpmndi:BPMNShape>
|
53
|
+
<bpmndi:BPMNShape id="Event_0yn9mzh_di" bpmnElement="Event_0yn9mzh">
|
54
|
+
<dc:Bounds x="482" y="272" width="36" height="36" />
|
55
|
+
</bpmndi:BPMNShape>
|
56
|
+
<bpmndi:BPMNShape id="Activity_1vxcs04_di" bpmnElement="Activity_02ykwt2">
|
57
|
+
<dc:Bounds x="180" y="130" width="100" height="80" />
|
58
|
+
<bpmndi:BPMNLabel />
|
59
|
+
</bpmndi:BPMNShape>
|
60
|
+
<bpmndi:BPMNShape id="Activity_1b7fiqp_di" bpmnElement="Activity_0ma3kzt">
|
61
|
+
<dc:Bounds x="340" y="130" width="100" height="80" />
|
62
|
+
<bpmndi:BPMNLabel />
|
63
|
+
</bpmndi:BPMNShape>
|
64
|
+
<bpmndi:BPMNShape id="Event_134k5nt_di" bpmnElement="Event_0o7qlkd">
|
65
|
+
<dc:Bounds x="392" y="192" width="36" height="36" />
|
66
|
+
</bpmndi:BPMNShape>
|
67
|
+
<bpmndi:BPMNEdge id="Flow_0qmxzxk_di" bpmnElement="Flow_0qmxzxk">
|
68
|
+
<di:waypoint x="128" y="170" />
|
69
|
+
<di:waypoint x="180" y="170" />
|
70
|
+
</bpmndi:BPMNEdge>
|
71
|
+
<bpmndi:BPMNEdge id="Flow_16dfeac_di" bpmnElement="Flow_16dfeac">
|
72
|
+
<di:waypoint x="280" y="170" />
|
73
|
+
<di:waypoint x="340" y="170" />
|
74
|
+
</bpmndi:BPMNEdge>
|
75
|
+
<bpmndi:BPMNEdge id="Flow_0mo4oek_di" bpmnElement="Flow_0mo4oek">
|
76
|
+
<di:waypoint x="440" y="170" />
|
77
|
+
<di:waypoint x="502" y="170" />
|
78
|
+
</bpmndi:BPMNEdge>
|
79
|
+
<bpmndi:BPMNEdge id="Flow_0y6es1p_di" bpmnElement="Flow_0y6es1p">
|
80
|
+
<di:waypoint x="410" y="228" />
|
81
|
+
<di:waypoint x="410" y="290" />
|
82
|
+
<di:waypoint x="482" y="290" />
|
83
|
+
</bpmndi:BPMNEdge>
|
84
|
+
<bpmndi:BPMNShape id="TextAnnotation_0lbjt7p_di" bpmnElement="TextAnnotation_0lbjt7p">
|
85
|
+
<dc:Bounds x="370" y="50" width="169.99387960829492" height="39.99855990783411" />
|
86
|
+
<bpmndi:BPMNLabel />
|
87
|
+
</bpmndi:BPMNShape>
|
88
|
+
<bpmndi:BPMNEdge id="Association_0ivfgz1_di" bpmnElement="Association_0ivfgz1">
|
89
|
+
<di:waypoint x="401" y="130" />
|
90
|
+
<di:waypoint x="413" y="90" />
|
91
|
+
</bpmndi:BPMNEdge>
|
92
|
+
</bpmndi:BPMNPlane>
|
93
|
+
</bpmndi:BPMNDiagram>
|
94
|
+
</bpmn:definitions>
|
@@ -3,46 +3,45 @@
|
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
query: {value:
|
9
|
-
query_type: {value:
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
query: { value: 'payload' },
|
9
|
+
query_type: { value: 'msg' },
|
10
10
|
},
|
11
11
|
inputs: 1,
|
12
12
|
outputs: 1,
|
13
|
-
icon:
|
14
|
-
label: function() {
|
15
|
-
return this.name ||
|
13
|
+
icon: 'font-awesome/fa-envelope-open',
|
14
|
+
label: function () {
|
15
|
+
return this.name || 'processinstance-query';
|
16
16
|
},
|
17
|
-
oneditprepare: function() {
|
18
|
-
$(
|
17
|
+
oneditprepare: function () {
|
18
|
+
$('#node-input-query').typedInput({
|
19
19
|
default: 'msg',
|
20
|
-
types: ['msg', 'json']
|
20
|
+
types: ['msg', 'json'],
|
21
21
|
});
|
22
22
|
|
23
|
-
$(
|
24
|
-
$(
|
23
|
+
$('#node-input-query').typedInput('value', this.query);
|
24
|
+
$('#node-input-query').typedInput('type', this.query_type);
|
25
|
+
},
|
26
|
+
oneditsave: function () {
|
27
|
+
(this.query = $('#node-input-query').typedInput('value')),
|
28
|
+
(this.query_type = $('#node-input-query').typedInput('type'));
|
25
29
|
},
|
26
|
-
oneditsave: function() {
|
27
|
-
this.query = $("#node-input-query").typedInput('value'),
|
28
|
-
this.query_type = $("#node-input-query").typedInput('type')
|
29
|
-
|
30
|
-
}
|
31
30
|
});
|
32
31
|
</script>
|
33
32
|
|
34
33
|
<script type="text/html" data-template-name="processinstance-query">
|
35
34
|
<div class="form-row">
|
36
35
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
37
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
36
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
38
37
|
</div>
|
39
38
|
<div class="form-row">
|
40
39
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
41
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
40
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
42
41
|
</div>
|
43
42
|
<div class="form-row">
|
44
43
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
45
|
-
<input type="text" id="node-input-query"
|
44
|
+
<input type="text" id="node-input-query" />
|
46
45
|
</div>
|
47
46
|
</script>
|
48
47
|
|
package/processinstance-query.js
CHANGED
@@ -3,23 +3,15 @@ const EventEmitter = require('node:events');
|
|
3
3
|
|
4
4
|
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
|
-
module.exports = function(RED) {
|
6
|
+
module.exports = function (RED) {
|
7
7
|
function ProcessinstanceQuery(config) {
|
8
|
-
RED.nodes.createNode(this,config);
|
8
|
+
RED.nodes.createNode(this, config);
|
9
9
|
var node = this;
|
10
10
|
var flowContext = node.context().flow;
|
11
|
-
var nodeContext = node.context();
|
12
11
|
|
13
12
|
this.engine = this.server = RED.nodes.getNode(config.engine);
|
14
13
|
|
15
|
-
const
|
16
|
-
|
17
|
-
var client = nodeContext.get('client');
|
18
|
-
|
19
|
-
if (!client) {
|
20
|
-
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
21
|
-
client = nodeContext.get('client');
|
22
|
-
}
|
14
|
+
const client = this.engine.getEngineClient();
|
23
15
|
|
24
16
|
var eventEmitter = flowContext.get('emitter');
|
25
17
|
|
@@ -28,21 +20,25 @@ module.exports = function(RED) {
|
|
28
20
|
eventEmitter = flowContext.get('emitter');
|
29
21
|
}
|
30
22
|
|
31
|
-
node.on(
|
23
|
+
node.on('close', async () => {
|
32
24
|
client.dispose();
|
33
25
|
client = null;
|
34
26
|
});
|
35
27
|
|
36
|
-
node.on('input', function(msg) {
|
37
|
-
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg)
|
38
|
-
|
39
|
-
client.processInstances.query(query, { identity: node.server.identity }).then((matchingInstances) => {
|
28
|
+
node.on('input', function (msg) {
|
29
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
40
30
|
|
41
|
-
|
31
|
+
client.processInstances
|
32
|
+
.query(query, { identity: node.server.identity })
|
33
|
+
.then((matchingInstances) => {
|
34
|
+
msg.payload = matchingInstances;
|
42
35
|
|
43
|
-
|
44
|
-
|
36
|
+
node.send(msg);
|
37
|
+
})
|
38
|
+
.catch((error) => {
|
39
|
+
node.error(`Processinstancequery failed: ${error.message}`);
|
40
|
+
});
|
45
41
|
});
|
46
42
|
}
|
47
|
-
RED.nodes.registerType(
|
48
|
-
}
|
43
|
+
RED.nodes.registerType('processinstance-query', ProcessinstanceQuery);
|
44
|
+
};
|
@@ -1,41 +1,41 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('signal-event-trigger',{
|
2
|
+
RED.nodes.registerType('signal-event-trigger', {
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
signalname: {value:
|
9
|
-
processInstanceId: {value:
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
signalname: { value: '', required: true },
|
9
|
+
processInstanceId: { value: '' },
|
10
10
|
},
|
11
11
|
inputs: 1,
|
12
12
|
outputs: 1,
|
13
|
-
icon:
|
14
|
-
label: function() {
|
15
|
-
return this.name||
|
16
|
-
}
|
13
|
+
icon: 'font-awesome/fa-envelope-open',
|
14
|
+
label: function () {
|
15
|
+
return this.name || 'signal-event-trigger';
|
16
|
+
},
|
17
17
|
});
|
18
18
|
</script>
|
19
19
|
|
20
20
|
<script type="text/html" data-template-name="signal-event-trigger">
|
21
21
|
<div class="form-row">
|
22
22
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
23
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
23
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
24
24
|
</div>
|
25
25
|
<div class="form-row">
|
26
26
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
|
27
|
-
<input type="text" id="node-input-engine" placeholder="Engine"
|
27
|
+
<input type="text" id="node-input-engine" placeholder="Engine" />
|
28
28
|
</div>
|
29
29
|
<div class="form-row">
|
30
30
|
<label for="node-input-signalname"><i class="fa fa-tag"></i> Signal Name</label>
|
31
|
-
<input type="text" id="node-input-signalname" placeholder="Name of the Signal"
|
31
|
+
<input type="text" id="node-input-signalname" placeholder="Name of the Signal" />
|
32
32
|
</div>
|
33
33
|
<div class="form-row">
|
34
34
|
<label for="node-input-processinstanceid"><i class="fa fa-tag"></i> Process Instance Id</label>
|
35
|
-
<input type="text" id="node-input-processinstanceid" placeholder="Id of the recipient process instance"
|
35
|
+
<input type="text" id="node-input-processinstanceid" placeholder="Id of the recipient process instance" />
|
36
36
|
</div>
|
37
37
|
</script>
|
38
38
|
|
39
39
|
<script type="text/html" data-help-name="signal-event-trigger">
|
40
40
|
<p>A node which emmits a signal event to the Engine.</p>
|
41
|
-
</script>
|
41
|
+
</script>
|
package/signal-event-trigger.js
CHANGED
@@ -2,44 +2,36 @@ const process = require('process');
|
|
2
2
|
|
3
3
|
const engine_client = require('@5minds/processcube_engine_client');
|
4
4
|
|
5
|
-
module.exports = function(RED) {
|
5
|
+
module.exports = function (RED) {
|
6
6
|
function SignalEventTrigger(config) {
|
7
7
|
RED.nodes.createNode(this, config);
|
8
8
|
var node = this;
|
9
|
-
var nodeContext = node.context();
|
10
9
|
|
11
10
|
this.engine = this.server = RED.nodes.getNode(config.engine);
|
12
11
|
|
13
|
-
const
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
node.send(msg);
|
37
|
-
node.status({fill: "blue", shape: "dot", text: `signal event triggered`});
|
38
|
-
|
39
|
-
}).catch((error) => {
|
40
|
-
node.error(error);
|
41
|
-
});
|
12
|
+
const client = this.engine.getEngineClient();
|
13
|
+
|
14
|
+
node.on('input', function (msg) {
|
15
|
+
client.events
|
16
|
+
.triggerSignalEvent(config.signalname, {
|
17
|
+
processInstanceId: config.processinstanceid,
|
18
|
+
payload: msg.payload,
|
19
|
+
identity: node.server.identity,
|
20
|
+
})
|
21
|
+
.then((result) => {
|
22
|
+
msg.payload = result;
|
23
|
+
|
24
|
+
node.send(msg);
|
25
|
+
node.status({
|
26
|
+
fill: 'blue',
|
27
|
+
shape: 'dot',
|
28
|
+
text: `signal event triggered`,
|
29
|
+
});
|
30
|
+
})
|
31
|
+
.catch((error) => {
|
32
|
+
node.error(error);
|
33
|
+
});
|
42
34
|
});
|
43
35
|
}
|
44
|
-
RED.nodes.registerType(
|
45
|
-
}
|
36
|
+
RED.nodes.registerType('signal-event-trigger', SignalEventTrigger);
|
37
|
+
};
|
@@ -1,34 +1,39 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-finished-listener',{
|
2
|
+
RED.nodes.registerType('usertask-finished-listener', {
|
3
3
|
category: 'ProcessCube Events',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
multisend: {value: false}
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
multisend: { value: false },
|
9
9
|
},
|
10
10
|
inputs: 0,
|
11
11
|
outputs: 1,
|
12
|
-
icon:
|
13
|
-
label: function() {
|
14
|
-
return this.name ||
|
15
|
-
}
|
12
|
+
icon: 'font-awesome/fa-envelope',
|
13
|
+
label: function () {
|
14
|
+
return this.name || 'usertask-finished-listener';
|
15
|
+
},
|
16
16
|
});
|
17
17
|
</script>
|
18
18
|
|
19
19
|
<script type="text/html" data-template-name="usertask-finished-listener">
|
20
20
|
<div class="form-row">
|
21
21
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
22
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
22
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
23
23
|
</div>
|
24
24
|
<div class="form-row">
|
25
25
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
26
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
26
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
27
27
|
</div>
|
28
28
|
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
29
29
|
<label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
|
30
30
|
<div>
|
31
|
-
<input
|
31
|
+
<input
|
32
|
+
type="checkbox"
|
33
|
+
checked
|
34
|
+
id="node-input-multisend"
|
35
|
+
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
36
|
+
/>
|
32
37
|
<label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
|
33
38
|
</div>
|
34
39
|
</div>
|
@@ -36,4 +41,4 @@
|
|
36
41
|
|
37
42
|
<script type="text/html" data-help-name="usertask-finished-listener">
|
38
43
|
<p>A node which subscribes to an User Task of https://processcube.io</p>
|
39
|
-
</script>
|
44
|
+
</script>
|