@5minds/node-red-contrib-processcube 0.3.5-feature-65fd58-lx819m2o → 0.3.5-feature-c8c609-lxi2vjv1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +8 -6
- package/nodered/.node-red-contrib-processcube-flows.json.backup +798 -98
- package/nodered/node-red-contrib-processcube-flows.json +823 -96
- package/nodered/package.json +16 -0
- package/package.json +2 -1
- package/processes/SampleUserTask.bpmn +34 -13
- package/usertask-input.html +10 -2
- package/usertask-input.js +15 -39
- package/usertask-new-listener.html +39 -0
- package/usertask-new-listener.js +44 -0
- package/usertask-output.js +12 -7
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "node-red-contrib-processcube-sample",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "A sample for the processcube node-red contrib package",
|
5
|
+
"scripts": {
|
6
|
+
"start": "./node_modules/.bin/node-red node-red-contrib-processcube-flows.json"
|
7
|
+
},
|
8
|
+
"dependencies": {
|
9
|
+
"@5minds/node-red-contrib-processcube": "file:..",
|
10
|
+
"@5minds/node-red-dashboard-2-processcube-dynamic-form": "file:../../node-red-dashboard-2-processcube-dynamic-form",
|
11
|
+
"@flowfuse/node-red-dashboard": "^1.11.1",
|
12
|
+
"node-red": "^3.1.10",
|
13
|
+
"node-red-debugger": "^1.1.1",
|
14
|
+
"openapi-red": "^1.2.5"
|
15
|
+
}
|
16
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "0.3.5-feature-
|
3
|
+
"version": "0.3.5-feature-c8c609-lxi2vjv1",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"authors": [
|
@@ -32,6 +32,7 @@
|
|
32
32
|
"externaltaskOutput": "externaltask-output.js",
|
33
33
|
"externaltaskError": "externaltask-error.js",
|
34
34
|
"processStart": "process-start.js",
|
35
|
+
"UserTaskNewListener": "usertask-new-listener.js",
|
35
36
|
"UserTaskInput": "usertask-input.js",
|
36
37
|
"UserTaskOutput": "usertask-output.js",
|
37
38
|
"processcubeEngineConfig": "processcube-engine-config.js"
|
@@ -7,8 +7,9 @@
|
|
7
7
|
<bpmn:laneSet>
|
8
8
|
<bpmn:lane id="Lane_1xzf0d3" name="Lane">
|
9
9
|
<bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
|
10
|
-
<bpmn:flowNodeRef>Event_1eeiwx4</bpmn:flowNodeRef>
|
11
10
|
<bpmn:flowNodeRef>Activity_0ljiko7</bpmn:flowNodeRef>
|
11
|
+
<bpmn:flowNodeRef>Event_1eeiwx4</bpmn:flowNodeRef>
|
12
|
+
<bpmn:flowNodeRef>Activity_0glvmjk</bpmn:flowNodeRef>
|
12
13
|
</bpmn:lane>
|
13
14
|
</bpmn:laneSet>
|
14
15
|
<bpmn:startEvent id="StartEvent_1" name="Start">
|
@@ -20,10 +21,6 @@
|
|
20
21
|
<bpmn:outgoing>Flow_1h0giih</bpmn:outgoing>
|
21
22
|
</bpmn:startEvent>
|
22
23
|
<bpmn:sequenceFlow id="Flow_1h0giih" sourceRef="StartEvent_1" targetRef="Activity_0ljiko7" />
|
23
|
-
<bpmn:endEvent id="Event_1eeiwx4">
|
24
|
-
<bpmn:incoming>Flow_1laqnja</bpmn:incoming>
|
25
|
-
</bpmn:endEvent>
|
26
|
-
<bpmn:sequenceFlow id="Flow_1laqnja" sourceRef="Activity_0ljiko7" targetRef="Event_1eeiwx4" />
|
27
24
|
<bpmn:userTask id="Activity_0ljiko7" name="Hello world">
|
28
25
|
<bpmn:extensionElements>
|
29
26
|
<camunda:formData>
|
@@ -35,19 +32,35 @@
|
|
35
32
|
<camunda:value id="value_02" name="Value 02" />
|
36
33
|
</camunda:formField>
|
37
34
|
<camunda:formField id="boolean_id" label="Boolean Label" type="boolean" />
|
35
|
+
<camunda:formField id="customer_01" label="Custom_01" type="string" />
|
38
36
|
</camunda:formData>
|
39
37
|
</bpmn:extensionElements>
|
40
38
|
<bpmn:incoming>Flow_1h0giih</bpmn:incoming>
|
41
|
-
<bpmn:outgoing>
|
39
|
+
<bpmn:outgoing>Flow_06e5qq4</bpmn:outgoing>
|
40
|
+
</bpmn:userTask>
|
41
|
+
<bpmn:sequenceFlow id="Flow_06e5qq4" sourceRef="Activity_0ljiko7" targetRef="Activity_0glvmjk" />
|
42
|
+
<bpmn:endEvent id="Event_1eeiwx4">
|
43
|
+
<bpmn:incoming>Flow_02dyxfy</bpmn:incoming>
|
44
|
+
</bpmn:endEvent>
|
45
|
+
<bpmn:sequenceFlow id="Flow_02dyxfy" sourceRef="Activity_0glvmjk" targetRef="Event_1eeiwx4" />
|
46
|
+
<bpmn:userTask id="Activity_0glvmjk" name="foo">
|
47
|
+
<bpmn:extensionElements>
|
48
|
+
<camunda:formData>
|
49
|
+
<camunda:formField id="FormField_BeDNcjma" label="Label 1" type="string" />
|
50
|
+
<camunda:formField id="FormField_Qv2INvg4" label="Label 2" type="string" />
|
51
|
+
</camunda:formData>
|
52
|
+
</bpmn:extensionElements>
|
53
|
+
<bpmn:incoming>Flow_06e5qq4</bpmn:incoming>
|
54
|
+
<bpmn:outgoing>Flow_02dyxfy</bpmn:outgoing>
|
42
55
|
</bpmn:userTask>
|
43
56
|
</bpmn:process>
|
44
57
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
45
58
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
|
46
59
|
<bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
|
47
|
-
<dc:Bounds x="5" y="4" width="
|
60
|
+
<dc:Bounds x="5" y="4" width="665" height="346" />
|
48
61
|
</bpmndi:BPMNShape>
|
49
62
|
<bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
|
50
|
-
<dc:Bounds x="35" y="4" width="
|
63
|
+
<dc:Bounds x="35" y="4" width="635" height="346" />
|
51
64
|
</bpmndi:BPMNShape>
|
52
65
|
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
|
53
66
|
<dc:Bounds x="92" y="152" width="36" height="36" />
|
@@ -55,20 +68,28 @@
|
|
55
68
|
<dc:Bounds x="98" y="195" width="24" height="14" />
|
56
69
|
</bpmndi:BPMNLabel>
|
57
70
|
</bpmndi:BPMNShape>
|
58
|
-
<bpmndi:BPMNShape id="Event_1eeiwx4_di" bpmnElement="Event_1eeiwx4">
|
59
|
-
<dc:Bounds x="332" y="152" width="36" height="36" />
|
60
|
-
</bpmndi:BPMNShape>
|
61
71
|
<bpmndi:BPMNShape id="Activity_1uodwbi_di" bpmnElement="Activity_0ljiko7">
|
62
72
|
<dc:Bounds x="180" y="130" width="100" height="80" />
|
63
73
|
<bpmndi:BPMNLabel />
|
64
74
|
</bpmndi:BPMNShape>
|
75
|
+
<bpmndi:BPMNShape id="Event_1eeiwx4_di" bpmnElement="Event_1eeiwx4">
|
76
|
+
<dc:Bounds x="482" y="152" width="36" height="36" />
|
77
|
+
</bpmndi:BPMNShape>
|
78
|
+
<bpmndi:BPMNShape id="Activity_0vcm0z0_di" bpmnElement="Activity_0glvmjk">
|
79
|
+
<dc:Bounds x="330" y="130" width="100" height="80" />
|
80
|
+
<bpmndi:BPMNLabel />
|
81
|
+
</bpmndi:BPMNShape>
|
65
82
|
<bpmndi:BPMNEdge id="Flow_1h0giih_di" bpmnElement="Flow_1h0giih">
|
66
83
|
<di:waypoint x="128" y="170" />
|
67
84
|
<di:waypoint x="180" y="170" />
|
68
85
|
</bpmndi:BPMNEdge>
|
69
|
-
<bpmndi:BPMNEdge id="
|
86
|
+
<bpmndi:BPMNEdge id="Flow_06e5qq4_di" bpmnElement="Flow_06e5qq4">
|
70
87
|
<di:waypoint x="280" y="170" />
|
71
|
-
<di:waypoint x="
|
88
|
+
<di:waypoint x="330" y="170" />
|
89
|
+
</bpmndi:BPMNEdge>
|
90
|
+
<bpmndi:BPMNEdge id="Flow_02dyxfy_di" bpmnElement="Flow_02dyxfy">
|
91
|
+
<di:waypoint x="430" y="170" />
|
92
|
+
<di:waypoint x="482" y="170" />
|
72
93
|
</bpmndi:BPMNEdge>
|
73
94
|
</bpmndi:BPMNPlane>
|
74
95
|
</bpmndi:BPMNDiagram>
|
package/usertask-input.html
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
color: '#00aed7',
|
5
5
|
defaults: {
|
6
6
|
name: {value: ""},
|
7
|
-
engine: {value: "", type: "processcube-engine-config"}
|
7
|
+
engine: {value: "", type: "processcube-engine-config"},
|
8
|
+
multisend: {value: false}
|
8
9
|
},
|
9
|
-
inputs:
|
10
|
+
inputs: 1,
|
10
11
|
outputs: 1,
|
11
12
|
icon: "font-awesome/fa-envelope-open",
|
12
13
|
label: function() {
|
@@ -24,6 +25,13 @@
|
|
24
25
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
25
26
|
<input type="text" id="node-input-engine" placeholder="http://engine:8000">
|
26
27
|
</div>
|
28
|
+
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
29
|
+
<label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
|
30
|
+
<div>
|
31
|
+
<input type="checkbox" checked id="node-input-multisend" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
|
32
|
+
<label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
|
33
|
+
</div>
|
34
|
+
</div>
|
27
35
|
</script>
|
28
36
|
|
29
37
|
<script type="text/html" data-help-name="usertask-input">
|
package/usertask-input.js
CHANGED
@@ -11,25 +11,6 @@ function showStatus(node, msgCounter) {
|
|
11
11
|
}
|
12
12
|
}
|
13
13
|
|
14
|
-
function mapUserTaskToMsg(userTask) {
|
15
|
-
return userTask.userTaskConfig.formFields.map(field => {
|
16
|
-
switch (field.type) {
|
17
|
-
case 'string':
|
18
|
-
return { id: field.id, type: 'text', required: false, label: field.label, value: '', title: 'Some helpful text' };
|
19
|
-
case 'long':
|
20
|
-
return { id: field.id, type: 'number', required: true, label: field.label, title: 'Some helpful text' };
|
21
|
-
case 'date':
|
22
|
-
return { id: field.id, type: 'date', required: true, label: field.label, title: 'Some helpful text' };
|
23
|
-
case 'enum':
|
24
|
-
return { id: field.id, type: 'select', required: true, label: field.label, options: field.enumValues.map(v => ({ id: v.id, name: v.name })), title: 'Choose an option' };
|
25
|
-
case 'boolean':
|
26
|
-
return { id: field.id, type: 'checkbox', required: false, label: field.label, title: 'Check for Yes' };
|
27
|
-
default:
|
28
|
-
return { id: field.id, type: field.type, required: true, label: field.label, title: 'Additional Information Needed' };
|
29
|
-
}
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
14
|
module.exports = function(RED) {
|
34
15
|
function UserTaskInput(config) {
|
35
16
|
RED.nodes.createNode(this,config);
|
@@ -56,32 +37,27 @@ module.exports = function(RED) {
|
|
56
37
|
eventEmitter = flowContext.get('emitter');
|
57
38
|
}
|
58
39
|
|
59
|
-
|
60
|
-
|
40
|
+
node.on("close", async () => {
|
41
|
+
client.dispose();
|
42
|
+
client = null;
|
43
|
+
});
|
61
44
|
|
62
|
-
|
45
|
+
node.on('input', async function(msg) {
|
63
46
|
|
64
|
-
|
65
|
-
// processModelName
|
66
|
-
// flowNodeId
|
67
|
-
client.userTasks.query({
|
68
|
-
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
69
|
-
processModelId: userTaskWaitingNotification.processModelId,
|
70
|
-
flowNodeId: userTaskWaitingNotification.flowNodeId,
|
71
|
-
}).then((matchingFlowNodes) => {
|
47
|
+
client.userTasks.query(msg.payload).then((matchingFlowNodes) => {
|
72
48
|
if (matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
73
49
|
userTask = matchingFlowNodes.userTasks[0];
|
74
50
|
|
75
|
-
|
76
|
-
|
77
|
-
let flowNodeInstanceId = { id: "_flowNodeInstanceId", type: "hidden", value: userTaskWaitingNotification.flowNodeInstanceId};
|
78
|
-
formFields.push(flowNodeInstanceId);
|
79
|
-
|
80
|
-
node.send({ payload: {formFields: formFields, userTask: userTask }});
|
81
|
-
|
51
|
+
node.send({ payload: {userTask: userTask } });
|
82
52
|
} else {
|
83
|
-
|
84
|
-
|
53
|
+
if (config.multisend) {
|
54
|
+
matchingFlowNodes.userTasks.forEach((userTask) => {
|
55
|
+
node.send({ payload: { userTask: userTask } });
|
56
|
+
});
|
57
|
+
} else {
|
58
|
+
node.send({ payload: { userTasks: matchingFlowNodes.userTasks } });
|
59
|
+
}
|
60
|
+
}
|
85
61
|
});
|
86
62
|
});
|
87
63
|
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
RED.nodes.registerType('usertask-new-listener',{
|
3
|
+
category: 'ProcessCube',
|
4
|
+
color: '#00aed7',
|
5
|
+
defaults: {
|
6
|
+
name: {value: ""},
|
7
|
+
engine: {value: "", type: "processcube-engine-config"},
|
8
|
+
multisend: {value: false}
|
9
|
+
},
|
10
|
+
inputs: 0,
|
11
|
+
outputs: 1,
|
12
|
+
icon: "font-awesome/fa-envelope-open",
|
13
|
+
label: function() {
|
14
|
+
return this.name || "usertask-new-listener";
|
15
|
+
}
|
16
|
+
});
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<script type="text/html" data-template-name="usertask-new-listener">
|
20
|
+
<div class="form-row">
|
21
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
22
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
23
|
+
</div>
|
24
|
+
<div class="form-row">
|
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">
|
27
|
+
</div>
|
28
|
+
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
29
|
+
<label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
|
30
|
+
<div>
|
31
|
+
<input type="checkbox" checked id="node-input-multisend" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
|
32
|
+
<label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</script>
|
36
|
+
|
37
|
+
<script type="text/html" data-help-name="usertask-input">
|
38
|
+
<p>A node which subscribes to an User Task of https://processcube.io</p>
|
39
|
+
</script>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const process = require('process');
|
2
|
+
const EventEmitter = require('node:events');
|
3
|
+
|
4
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
5
|
+
|
6
|
+
module.exports = function(RED) {
|
7
|
+
function UserTaskNewListener(config) {
|
8
|
+
RED.nodes.createNode(this,config);
|
9
|
+
var node = this;
|
10
|
+
var msgCounter = 0;
|
11
|
+
var flowContext = node.context().flow;
|
12
|
+
var nodeContext = node.context();
|
13
|
+
|
14
|
+
this.engine = this.server = RED.nodes.getNode(config.engine);
|
15
|
+
|
16
|
+
const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
|
17
|
+
|
18
|
+
var client = nodeContext.get('client');
|
19
|
+
|
20
|
+
if (!client) {
|
21
|
+
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
22
|
+
client = nodeContext.get('client');
|
23
|
+
}
|
24
|
+
|
25
|
+
var eventEmitter = flowContext.get('emitter');
|
26
|
+
|
27
|
+
if (!eventEmitter) {
|
28
|
+
flowContext.set('emitter', new EventEmitter());
|
29
|
+
eventEmitter = flowContext.get('emitter');
|
30
|
+
}
|
31
|
+
|
32
|
+
node.on("close", async () => {
|
33
|
+
client.dispose();
|
34
|
+
client = null;
|
35
|
+
});
|
36
|
+
|
37
|
+
client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
|
38
|
+
console.log(`UserTask with id ${userTaskWaitingNotification.flowNodeInstanceId} is waiting.`);
|
39
|
+
|
40
|
+
node.send({ payload: { flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId } });
|
41
|
+
});
|
42
|
+
}
|
43
|
+
RED.nodes.registerType("usertask-new-listener", UserTaskNewListener);
|
44
|
+
}
|
package/usertask-output.js
CHANGED
@@ -31,13 +31,18 @@ module.exports = function(RED) {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
node.on('input', function(msg) {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
if (msg.payload.userTask) {
|
35
|
+
console.log(`Try to finsih UserTask with id ${msg.payload.userTask.flowNodeInstanceId}.`);
|
36
|
+
|
37
|
+
const flowNodeInstanceId = msg.payload.userTask.flowNodeInstanceId;
|
38
|
+
const userTaskResult = msg.payload.formData || {};
|
39
|
+
|
40
|
+
client.userTasks.finishUserTask(flowNodeInstanceId, userTaskResult).then(() => {
|
41
|
+
console.log(`UserTask with id ${flowNodeInstanceId} finished.`);
|
42
|
+
});
|
43
|
+
} else {
|
44
|
+
console.log(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
|
45
|
+
}
|
41
46
|
});
|
42
47
|
}
|
43
48
|
|