@5minds/node-red-contrib-processcube 0.3.5-feature-1092e6-lxhvslzu → 0.3.5-feature-58d0b1-lxi3af5i

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.
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@5minds/node-red-contrib-processcube": "file:..",
10
- "@5minds/node-red-dashboard-2-processcube-dynamic-form": "file:../../../../moellenbeck/reps/node-red-dashboard-2-ui-example",
10
+ "@5minds/node-red-dashboard-2-processcube-dynamic-form": "file:../../node-red-dashboard-2-processcube-dynamic-form",
11
11
  "@flowfuse/node-red-dashboard": "^1.11.1",
12
12
  "node-red": "^3.1.10",
13
13
  "node-red-debugger": "^1.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "0.3.5-feature-1092e6-lxhvslzu",
3
+ "version": "0.3.5-feature-58d0b1-lxi3af5i",
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,20 +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" />
38
- <camunda:formField id="customer_01" label="Custom_01" type="v-text-field" />
35
+ <camunda:formField id="customer_01" label="Custom_01" type="string" />
39
36
  </camunda:formData>
40
37
  </bpmn:extensionElements>
41
38
  <bpmn:incoming>Flow_1h0giih</bpmn:incoming>
42
- <bpmn:outgoing>Flow_1laqnja</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>
43
55
  </bpmn:userTask>
44
56
  </bpmn:process>
45
57
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
46
58
  <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
47
59
  <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
48
- <dc:Bounds x="5" y="4" width="435" height="346" />
60
+ <dc:Bounds x="5" y="4" width="665" height="346" />
49
61
  </bpmndi:BPMNShape>
50
62
  <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
51
- <dc:Bounds x="35" y="4" width="405" height="346" />
63
+ <dc:Bounds x="35" y="4" width="635" height="346" />
52
64
  </bpmndi:BPMNShape>
53
65
  <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
54
66
  <dc:Bounds x="92" y="152" width="36" height="36" />
@@ -56,20 +68,28 @@
56
68
  <dc:Bounds x="98" y="195" width="24" height="14" />
57
69
  </bpmndi:BPMNLabel>
58
70
  </bpmndi:BPMNShape>
59
- <bpmndi:BPMNShape id="Event_1eeiwx4_di" bpmnElement="Event_1eeiwx4">
60
- <dc:Bounds x="332" y="152" width="36" height="36" />
61
- </bpmndi:BPMNShape>
62
71
  <bpmndi:BPMNShape id="Activity_1uodwbi_di" bpmnElement="Activity_0ljiko7">
63
72
  <dc:Bounds x="180" y="130" width="100" height="80" />
64
73
  <bpmndi:BPMNLabel />
65
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>
66
82
  <bpmndi:BPMNEdge id="Flow_1h0giih_di" bpmnElement="Flow_1h0giih">
67
83
  <di:waypoint x="128" y="170" />
68
84
  <di:waypoint x="180" y="170" />
69
85
  </bpmndi:BPMNEdge>
70
- <bpmndi:BPMNEdge id="Flow_1laqnja_di" bpmnElement="Flow_1laqnja">
86
+ <bpmndi:BPMNEdge id="Flow_06e5qq4_di" bpmnElement="Flow_06e5qq4">
71
87
  <di:waypoint x="280" y="170" />
72
- <di:waypoint x="332" y="170" />
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" />
73
93
  </bpmndi:BPMNEdge>
74
94
  </bpmndi:BPMNPlane>
75
95
  </bpmndi:BPMNDiagram>
@@ -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: 0,
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
@@ -37,26 +37,27 @@ module.exports = function(RED) {
37
37
  eventEmitter = flowContext.get('emitter');
38
38
  }
39
39
 
40
- client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
41
- console.log(`UserTask with id ${userTaskWaitingNotification.flowNodeInstanceId} is waiting.`);
40
+ node.on("close", async () => {
41
+ client.dispose();
42
+ client = null;
43
+ });
42
44
 
43
- // Abschließend mit - client.userTasks.finishUserTask(waitingUserTask?.flowNodeInstanceId, sampleResult)
45
+ node.on('input', async function(msg) {
44
46
 
45
- // flowNodeInstanceId
46
- // processModelName
47
- // flowNodeId
48
- client.userTasks.query({
49
- flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
50
- processModelId: userTaskWaitingNotification.processModelId,
51
- flowNodeId: userTaskWaitingNotification.flowNodeId,
52
- }).then((matchingFlowNodes) => {
47
+ client.userTasks.query(msg.payload).then((matchingFlowNodes) => {
53
48
  if (matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
54
49
  userTask = matchingFlowNodes.userTasks[0];
55
50
 
56
- node.send({ payload: {userTask: userTask }, "_flowNodeInstanceId": userTaskWaitingNotification.flowNodeInstanceId});
51
+ node.send({ payload: {userTask: userTask } });
57
52
  } else {
58
- node.send({ payload: matchingFlowNodes.userTasks });
59
- }
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
+ }
60
61
  });
61
62
  });
62
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
+ }
@@ -31,13 +31,18 @@ module.exports = function(RED) {
31
31
  }
32
32
 
33
33
  node.on('input', function(msg) {
34
- console.log(`Try to finsih UserTask with id ${msg._flowNodeInstanceId}.`);
35
-
36
- const flowNodeInstanceId = msg._flowNodeInstanceId;
37
-
38
- client.userTasks.finishUserTask(flowNodeInstanceId, msg.payload).then(() => {
39
- console.log(`UserTask with id ${flowNodeInstanceId} finished.`);
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