@5minds/node-red-contrib-processcube 0.2.6-feature-90cba5-lvpgbys9 → 0.3.0-develop-fe0d25-lvu1x2ld
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/.node-red/data/.config.nodes.json +1 -130
- package/.node-red/data/.config.nodes.json.backup +1 -119
- package/.node-red/data/.config.users.json.backup +2 -2
- package/.node-red/data/flows.json +1 -218
- package/Dockerfile +0 -1
- package/externaltask-input.html +2 -2
- package/package.json +1 -3
- package/process-start.html +5 -0
- package/process-start.js +13 -0
- package/processcube-engine-config.js +2 -2
- package/.node-red/data/uibuilder/.config/sioMiddleware.js-template +0 -53
- package/.node-red/data/uibuilder/.config/sioMsgOut.js-template +0 -22
- package/.node-red/data/uibuilder/.config/sioUse.js-template +0 -43
- package/.node-red/data/uibuilder/.config/uibMiddleware.js-template +0 -26
- package/.node-red/data/uibuilder/common/images/node-blue.ico +0 -0
- package/.node-red/data/uibuilder/package.json +0 -15
- package/.node-red/data/uibuilder/package.json.bak +0 -15
- package/.node-red/data/uibuilder/usertasks/.eslintrc.js +0 -80
- package/.node-red/data/uibuilder/usertasks/LICENSE +0 -178
- package/.node-red/data/uibuilder/usertasks/README.md +0 -57
- package/.node-red/data/uibuilder/usertasks/api/.keep +0 -0
- package/.node-red/data/uibuilder/usertasks/package.json +0 -26
- package/.node-red/data/uibuilder/usertasks/routes/.keep +0 -0
- package/.node-red/data/uibuilder/usertasks/src/index.css +0 -7
- package/.node-red/data/uibuilder/usertasks/src/index.html +0 -26
- package/.node-red/data/uibuilder/usertasks/src/index.js +0 -8
- package/processes/SampleUserTask.bpmn +0 -75
- package/usertask-input.html +0 -31
- package/usertask-input.js +0 -89
- package/usertask-output.html +0 -31
- package/usertask-output.js +0 -45
@@ -1,75 +0,0 @@
|
|
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="SampleUserTask_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="SampleUserTask" processRef="SampleUserTask_Process" />
|
5
|
-
</bpmn:collaboration>
|
6
|
-
<bpmn:process id="SampleUserTask_Process" name="SampleUserTask" isExecutable="true">
|
7
|
-
<bpmn:laneSet>
|
8
|
-
<bpmn:lane id="Lane_1xzf0d3" name="Lane">
|
9
|
-
<bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
|
10
|
-
<bpmn:flowNodeRef>Event_1eeiwx4</bpmn:flowNodeRef>
|
11
|
-
<bpmn:flowNodeRef>Activity_0ljiko7</bpmn:flowNodeRef>
|
12
|
-
</bpmn:lane>
|
13
|
-
</bpmn:laneSet>
|
14
|
-
<bpmn:startEvent id="StartEvent_1" name="Start">
|
15
|
-
<bpmn:extensionElements>
|
16
|
-
<camunda:properties>
|
17
|
-
<camunda:property name="studio.defaultCustomStartToken" value="{ "sample": "hello" }" />
|
18
|
-
</camunda:properties>
|
19
|
-
</bpmn:extensionElements>
|
20
|
-
<bpmn:outgoing>Flow_1h0giih</bpmn:outgoing>
|
21
|
-
</bpmn:startEvent>
|
22
|
-
<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
|
-
<bpmn:userTask id="Activity_0ljiko7" name="Hello world">
|
28
|
-
<bpmn:extensionElements>
|
29
|
-
<camunda:formData>
|
30
|
-
<camunda:formField id="text_id" label="Text Label" type="string" />
|
31
|
-
<camunda:formField id="number_id" label="Number Label" type="long" defaultValue="${token.current.sample}" customForm="{"hint":"Sample"}" />
|
32
|
-
<camunda:formField id="date_id" label="Date Label" type="date" />
|
33
|
-
<camunda:formField id="select_id" label="Select Label" type="enum">
|
34
|
-
<camunda:value id="value_01" name="Value 01" />
|
35
|
-
<camunda:value id="value_02" name="Value 02" />
|
36
|
-
</camunda:formField>
|
37
|
-
<camunda:formField id="boolean_id" label="Boolean Label" type="boolean" />
|
38
|
-
</camunda:formData>
|
39
|
-
</bpmn:extensionElements>
|
40
|
-
<bpmn:incoming>Flow_1h0giih</bpmn:incoming>
|
41
|
-
<bpmn:outgoing>Flow_1laqnja</bpmn:outgoing>
|
42
|
-
</bpmn:userTask>
|
43
|
-
</bpmn:process>
|
44
|
-
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
45
|
-
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
|
46
|
-
<bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
|
47
|
-
<dc:Bounds x="5" y="4" width="435" height="346" />
|
48
|
-
</bpmndi:BPMNShape>
|
49
|
-
<bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
|
50
|
-
<dc:Bounds x="35" y="4" width="405" height="346" />
|
51
|
-
</bpmndi:BPMNShape>
|
52
|
-
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
|
53
|
-
<dc:Bounds x="92" y="152" width="36" height="36" />
|
54
|
-
<bpmndi:BPMNLabel>
|
55
|
-
<dc:Bounds x="98" y="195" width="24" height="14" />
|
56
|
-
</bpmndi:BPMNLabel>
|
57
|
-
</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
|
-
<bpmndi:BPMNShape id="Activity_1uodwbi_di" bpmnElement="Activity_0ljiko7">
|
62
|
-
<dc:Bounds x="180" y="130" width="100" height="80" />
|
63
|
-
<bpmndi:BPMNLabel />
|
64
|
-
</bpmndi:BPMNShape>
|
65
|
-
<bpmndi:BPMNEdge id="Flow_1h0giih_di" bpmnElement="Flow_1h0giih">
|
66
|
-
<di:waypoint x="128" y="170" />
|
67
|
-
<di:waypoint x="180" y="170" />
|
68
|
-
</bpmndi:BPMNEdge>
|
69
|
-
<bpmndi:BPMNEdge id="Flow_1laqnja_di" bpmnElement="Flow_1laqnja">
|
70
|
-
<di:waypoint x="280" y="170" />
|
71
|
-
<di:waypoint x="332" y="170" />
|
72
|
-
</bpmndi:BPMNEdge>
|
73
|
-
</bpmndi:BPMNPlane>
|
74
|
-
</bpmndi:BPMNDiagram>
|
75
|
-
</bpmn:definitions>
|
package/usertask-input.html
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-input',{
|
3
|
-
category: 'ProcessCube',
|
4
|
-
color: '#00aed7',
|
5
|
-
defaults: {
|
6
|
-
name: {value: ""},
|
7
|
-
engine: {value: "", type: "processcube-engine-config"}
|
8
|
-
},
|
9
|
-
inputs: 0,
|
10
|
-
outputs: 1,
|
11
|
-
icon: "font-awesome/fa-envelope-open",
|
12
|
-
label: function() {
|
13
|
-
return this.name || "usertask-input";
|
14
|
-
}
|
15
|
-
});
|
16
|
-
</script>
|
17
|
-
|
18
|
-
<script type="text/html" data-template-name="usertask-input">
|
19
|
-
<div class="form-row">
|
20
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
21
|
-
<input type="text" id="node-input-name" placeholder="Name">
|
22
|
-
</div>
|
23
|
-
<div class="form-row">
|
24
|
-
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
25
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000">
|
26
|
-
</div>
|
27
|
-
</script>
|
28
|
-
|
29
|
-
<script type="text/html" data-help-name="usertask-input">
|
30
|
-
<p>A node which subscribes to an User Task of https://processcube.io</p>
|
31
|
-
</script>
|
package/usertask-input.js
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
const process = require('process');
|
2
|
-
const EventEmitter = require('node:events');
|
3
|
-
|
4
|
-
const engine_client = require('@5minds/processcube_engine_client');
|
5
|
-
|
6
|
-
function showStatus(node, msgCounter) {
|
7
|
-
if (msgCounter >= 1) {
|
8
|
-
node.status({fill: "blue", shape: "dot", text: `handling tasks ${msgCounter}`});
|
9
|
-
} else {
|
10
|
-
node.status({fill: "blue", shape: "ring", text: `subcribed ${msgCounter}`});
|
11
|
-
}
|
12
|
-
}
|
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
|
-
module.exports = function(RED) {
|
34
|
-
function UserTaskInput(config) {
|
35
|
-
RED.nodes.createNode(this,config);
|
36
|
-
var node = this;
|
37
|
-
var msgCounter = 0;
|
38
|
-
var flowContext = node.context().flow;
|
39
|
-
var nodeContext = node.context();
|
40
|
-
|
41
|
-
this.engine = this.server = RED.nodes.getNode(config.engine);
|
42
|
-
|
43
|
-
const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
|
44
|
-
|
45
|
-
var client = nodeContext.get('client');
|
46
|
-
|
47
|
-
if (!client) {
|
48
|
-
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
49
|
-
client = nodeContext.get('client');
|
50
|
-
}
|
51
|
-
|
52
|
-
var eventEmitter = flowContext.get('emitter');
|
53
|
-
|
54
|
-
if (!eventEmitter) {
|
55
|
-
flowContext.set('emitter', new EventEmitter());
|
56
|
-
eventEmitter = flowContext.get('emitter');
|
57
|
-
}
|
58
|
-
|
59
|
-
client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
|
60
|
-
console.log(`UserTask with id ${userTaskWaitingNotification.flowNodeInstanceId} is waiting.`);
|
61
|
-
|
62
|
-
// Abschließend mit - client.userTasks.finishUserTask(waitingUserTask?.flowNodeInstanceId, sampleResult)
|
63
|
-
|
64
|
-
// flowNodeInstanceId
|
65
|
-
// processModelName
|
66
|
-
// flowNodeId
|
67
|
-
client.userTasks.query({
|
68
|
-
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
69
|
-
processModelId: userTaskWaitingNotification.processModelId,
|
70
|
-
flowNodeId: userTaskWaitingNotification.flowNodeId,
|
71
|
-
}).then((matchingFlowNodes) => {
|
72
|
-
if (matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
73
|
-
userTask = matchingFlowNodes.userTasks[0];
|
74
|
-
|
75
|
-
let formFields = mapUserTaskToMsg(userTask);
|
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
|
-
|
82
|
-
} else {
|
83
|
-
node.send({ payload: matchingFlowNodes });
|
84
|
-
}
|
85
|
-
});
|
86
|
-
});
|
87
|
-
}
|
88
|
-
RED.nodes.registerType("usertask-input", UserTaskInput);
|
89
|
-
}
|
package/usertask-output.html
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-output',{
|
3
|
-
category: 'ProcessCube',
|
4
|
-
color: '#00aed7',
|
5
|
-
defaults: {
|
6
|
-
name: {value: ""},
|
7
|
-
engine: {value: "", type: "processcube-engine-config"}
|
8
|
-
},
|
9
|
-
inputs: 1,
|
10
|
-
outputs: 0,
|
11
|
-
icon: "font-awesome/fa-envelope",
|
12
|
-
label: function() {
|
13
|
-
return this.name || "usertask-output";
|
14
|
-
}
|
15
|
-
});
|
16
|
-
</script>
|
17
|
-
|
18
|
-
<script type="text/html" data-template-name="usertask-output">
|
19
|
-
<div class="form-row">
|
20
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
21
|
-
<input type="text" id="node-input-name" placeholder="Name">
|
22
|
-
</div>
|
23
|
-
<div class="form-row">
|
24
|
-
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
25
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000">
|
26
|
-
</div>
|
27
|
-
</script>
|
28
|
-
|
29
|
-
<script type="text/html" data-help-name="usertask-output">
|
30
|
-
<p>A node which send the result to an User Task of https://processcube.io</p>
|
31
|
-
</script>
|
package/usertask-output.js
DELETED
@@ -1,45 +0,0 @@
|
|
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 UserTaskOutput(config) {
|
8
|
-
|
9
|
-
RED.nodes.createNode(this, config);
|
10
|
-
|
11
|
-
var node = this;
|
12
|
-
var flowContext = node.context().flow;
|
13
|
-
var nodeContext = node.context();
|
14
|
-
|
15
|
-
this.engine = this.server = RED.nodes.getNode(config.engine);
|
16
|
-
|
17
|
-
const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
|
18
|
-
|
19
|
-
var client = nodeContext.get('client');
|
20
|
-
|
21
|
-
if (!client) {
|
22
|
-
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
23
|
-
client = nodeContext.get('client');
|
24
|
-
}
|
25
|
-
|
26
|
-
var eventEmitter = flowContext.get('emitter');
|
27
|
-
|
28
|
-
if (!eventEmitter) {
|
29
|
-
flowContext.set('emitter', new EventEmitter());
|
30
|
-
eventEmitter = flowContext.get('emitter');
|
31
|
-
}
|
32
|
-
|
33
|
-
node.on('input', function(msg) {
|
34
|
-
console.log(`Try to finsih UserTask with id ${msg.payload._flowNodeInstanceId}.`);
|
35
|
-
|
36
|
-
const flowNodeInstanceId = msg.payload._flowNodeInstanceId;
|
37
|
-
|
38
|
-
client.userTasks.finishUserTask(flowNodeInstanceId, msg.payload).then(() => {
|
39
|
-
console.log(`UserTask with id ${flowNodeInstanceId} finished.`);
|
40
|
-
});
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
RED.nodes.registerType("usertask-output", UserTaskOutput);
|
45
|
-
}
|