Skip to content

Commit 6735e76

Browse files
authored
Merge pull request #75 from 5minds/develop
Remove msg and format from usertask-output
2 parents cdf58fa + 8a2d566 commit 6735e76

7 files changed

+200
-4
lines changed

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ services:
88
environment:
99
- TZ=Europe/Berlin
1010
- ENGINE_URL=http://engine:8000
11+
- TOPIC=TopicFromENV
1112
volumes:
1213
- ./nodered/:/data/
1314
depends_on:

externaltask-input.html

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
name: { value: '' },
77
engine: { value: '', type: 'processcube-engine-config' },
88
topic: { value: '' },
9+
topicType: { value: '' },
910
workerConfig: { value: '{}'},
1011
workerConfigType: { value: 'json'}
1112
},
@@ -23,6 +24,14 @@
2324

2425
$('#node-input-workerConfig').typedInput('value', this.workerConfig);
2526
$('#node-input-workerConfig').typedInput('type', this.workerConfigType);
27+
28+
$('#node-input-topic').typedInput({
29+
default: 'str',
30+
types: ['str', 'env'],
31+
});
32+
33+
$('#node-input-topic').typedInput('value', this.topic);
34+
$('#node-input-topic').typedInput('type', this.topicType);
2635
},
2736
oneditsave: function () {
2837
this.workerConfig = $('#node-input-workerConfig').typedInput('value');
@@ -31,6 +40,8 @@
3140
$('#node-input-workerConfig').typedInput('value', '{}');
3241
}
3342
this.workerConfigType = $('#node-input-workerConfig').typedInput('type');
43+
this.topic = $('#node-input-topic').typedInput('value');
44+
this.topicType = $('#node-input-topic').typedInput('type');
3445
},
3546
});
3647
</script>

externaltask-input.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ module.exports = function (RED) {
121121
});
122122
};
123123

124-
let options = RED.util.evaluateNodeProperty(config.workerConfig, 'json', node);
124+
let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node);
125+
let topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node)
125126

126127
client.externalTasks
127-
.subscribeToExternalTaskTopic(config.topic, etwCallback, options)
128+
.subscribeToExternalTaskTopic(topic, etwCallback, options)
128129
.then(async (externalTaskWorker) => {
129130
node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
130131

nodered/flows.json

+121
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,32 @@
507507
"w": 552,
508508
"h": 142
509509
},
510+
{
511+
"id": "73ca179de59cdabf",
512+
"type": "group",
513+
"z": "a23d2e782beb66f4",
514+
"style": {
515+
"stroke": "#999999",
516+
"stroke-opacity": "1",
517+
"fill": "none",
518+
"fill-opacity": "1",
519+
"label": true,
520+
"label-position": "nw",
521+
"color": "#a4a4a4"
522+
},
523+
"nodes": [
524+
"3283986789f6f865",
525+
"f2b869714547df91",
526+
"7a24dd57f7964be1",
527+
"9be410342a64e57a",
528+
"7bc885294b6f6b08",
529+
"412d03bddecd4fd4"
530+
],
531+
"x": 34,
532+
"y": 739,
533+
"w": 682,
534+
"h": 202
535+
},
510536
{
511537
"id": "42e6796dddd9d4db",
512538
"type": "processcube-engine-config",
@@ -824,6 +850,101 @@
824850
"y": 540,
825851
"wires": []
826852
},
853+
{
854+
"id": "3283986789f6f865",
855+
"type": "externaltask-input",
856+
"z": "a23d2e782beb66f4",
857+
"g": "73ca179de59cdabf",
858+
"name": "TopicFromENV",
859+
"engine": "42e6796dddd9d4db",
860+
"topic": "TOPIC",
861+
"topicType": "env",
862+
"workerConfig": "{}",
863+
"workerConfigType": "json",
864+
"x": 140,
865+
"y": 840,
866+
"wires": [
867+
[
868+
"f2b869714547df91"
869+
]
870+
]
871+
},
872+
{
873+
"id": "f2b869714547df91",
874+
"type": "delay",
875+
"z": "a23d2e782beb66f4",
876+
"g": "73ca179de59cdabf",
877+
"name": "",
878+
"pauseType": "delay",
879+
"timeout": "5",
880+
"timeoutUnits": "seconds",
881+
"rate": "1",
882+
"nbRateUnits": "1",
883+
"rateUnits": "second",
884+
"randomFirst": "1",
885+
"randomLast": "5",
886+
"randomUnits": "seconds",
887+
"drop": false,
888+
"allowrate": false,
889+
"outputs": 1,
890+
"x": 400,
891+
"y": 840,
892+
"wires": [
893+
[
894+
"7a24dd57f7964be1"
895+
]
896+
]
897+
},
898+
{
899+
"id": "7a24dd57f7964be1",
900+
"type": "externaltask-output",
901+
"z": "a23d2e782beb66f4",
902+
"g": "73ca179de59cdabf",
903+
"name": "",
904+
"x": 600,
905+
"y": 840,
906+
"wires": []
907+
},
908+
{
909+
"id": "9be410342a64e57a",
910+
"type": "externaltask-error",
911+
"z": "a23d2e782beb66f4",
912+
"g": "73ca179de59cdabf",
913+
"name": "",
914+
"error": "",
915+
"x": 510,
916+
"y": 900,
917+
"wires": [
918+
[]
919+
]
920+
},
921+
{
922+
"id": "7bc885294b6f6b08",
923+
"type": "catch",
924+
"z": "a23d2e782beb66f4",
925+
"g": "73ca179de59cdabf",
926+
"name": "",
927+
"scope": null,
928+
"uncaught": false,
929+
"x": 320,
930+
"y": 900,
931+
"wires": [
932+
[
933+
"9be410342a64e57a"
934+
]
935+
]
936+
},
937+
{
938+
"id": "412d03bddecd4fd4",
939+
"type": "comment",
940+
"z": "a23d2e782beb66f4",
941+
"g": "73ca179de59cdabf",
942+
"name": "External Task with Topic from ENV",
943+
"info": "",
944+
"x": 200,
945+
"y": 780,
946+
"wires": []
947+
},
827948
{
828949
"id": "82533b02fb9a9f04",
829950
"type": "comment",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@5minds/node-red-contrib-processcube",
3-
"version": "1.6.3",
3+
"version": "1.6.4",
44
"license": "MIT",
55
"description": "Node-RED nodes for ProcessCube",
66
"scripts": {
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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-Env-Topic_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-Env-Topic" processRef="External-Task-Env-Topic_Process" />
5+
</bpmn:collaboration>
6+
<bpmn:process id="External-Task-Env-Topic_Process" name="External-Task-Env-Topic" isExecutable="true">
7+
<bpmn:laneSet>
8+
<bpmn:lane id="Lane_1xzf0d3">
9+
<bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
10+
<bpmn:flowNodeRef>Event_0altset</bpmn:flowNodeRef>
11+
<bpmn:flowNodeRef>Activity_0oql7b5</bpmn:flowNodeRef>
12+
</bpmn:lane>
13+
</bpmn:laneSet>
14+
<bpmn:startEvent id="StartEvent_1" name="Start">
15+
<bpmn:outgoing>Flow_1y2qxv2</bpmn:outgoing>
16+
</bpmn:startEvent>
17+
<bpmn:sequenceFlow id="Flow_1y2qxv2" sourceRef="StartEvent_1" targetRef="Activity_0oql7b5" />
18+
<bpmn:endEvent id="Event_0altset">
19+
<bpmn:incoming>Flow_01qqshn</bpmn:incoming>
20+
</bpmn:endEvent>
21+
<bpmn:sequenceFlow id="Flow_01qqshn" sourceRef="Activity_0oql7b5" targetRef="Event_0altset" />
22+
<bpmn:serviceTask id="Activity_0oql7b5" name="External Task with topic from ENV" camunda:type="external" camunda:topic="TopicFromENV">
23+
<bpmn:incoming>Flow_1y2qxv2</bpmn:incoming>
24+
<bpmn:outgoing>Flow_01qqshn</bpmn:outgoing>
25+
</bpmn:serviceTask>
26+
</bpmn:process>
27+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
28+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
29+
<bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
30+
<dc:Bounds x="5" y="4" width="885" height="346" />
31+
</bpmndi:BPMNShape>
32+
<bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
33+
<dc:Bounds x="35" y="4" width="855" height="346" />
34+
</bpmndi:BPMNShape>
35+
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
36+
<dc:Bounds x="92" y="152" width="36" height="36" />
37+
<bpmndi:BPMNLabel>
38+
<dc:Bounds x="98" y="195" width="24" height="14" />
39+
</bpmndi:BPMNLabel>
40+
</bpmndi:BPMNShape>
41+
<bpmndi:BPMNShape id="Event_0altset_di" bpmnElement="Event_0altset">
42+
<dc:Bounds x="332" y="152" width="36" height="36" />
43+
</bpmndi:BPMNShape>
44+
<bpmndi:BPMNShape id="Activity_1hcksxj_di" bpmnElement="Activity_0oql7b5">
45+
<dc:Bounds x="180" y="130" width="100" height="80" />
46+
</bpmndi:BPMNShape>
47+
<bpmndi:BPMNEdge id="Flow_1y2qxv2_di" bpmnElement="Flow_1y2qxv2">
48+
<di:waypoint x="128" y="170" />
49+
<di:waypoint x="180" y="170" />
50+
</bpmndi:BPMNEdge>
51+
<bpmndi:BPMNEdge id="Flow_01qqshn_di" bpmnElement="Flow_01qqshn">
52+
<di:waypoint x="280" y="170" />
53+
<di:waypoint x="332" y="170" />
54+
</bpmndi:BPMNEdge>
55+
</bpmndi:BPMNPlane>
56+
</bpmndi:BPMNDiagram>
57+
</bpmn:definitions>

usertask-output.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ module.exports = function (RED) {
77
if (msg.payload.userTask) {
88
const flowNodeInstanceId = msg.payload.userTask.flowNodeInstanceId;
99

10-
const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
10+
let userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
11+
12+
// remote msg and format from result
13+
delete userTaskResult.format;
14+
delete userTaskResult.msg;
15+
1116

1217
node.engine = RED.nodes.getNode(config.engine);
1318

0 commit comments

Comments
 (0)