@5minds/node-red-contrib-processcube 1.1.4-develop-772742-m17mr2mk → 1.1.4-develop-0f23a0-m17mrfjc
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/package.json +1 -1
- package/usertask-input.html +10 -31
- package/usertask-input.js +15 -36
package/package.json
CHANGED
package/usertask-input.html
CHANGED
@@ -7,8 +7,7 @@
|
|
7
7
|
engine: { value: '', type: 'processcube-engine-config' },
|
8
8
|
query: { value: 'payload' },
|
9
9
|
query_type: { value: 'msg' },
|
10
|
-
|
11
|
-
multisend: { value: false },
|
10
|
+
sendtype: { value: 'array', required: true },
|
12
11
|
},
|
13
12
|
inputs: 1,
|
14
13
|
outputs: 1,
|
@@ -45,33 +44,13 @@
|
|
45
44
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
46
45
|
<input type="text" id="node-input-query" />
|
47
46
|
</div>
|
48
|
-
<div class="form-row"
|
49
|
-
<label for="node-input-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
<
|
54
|
-
|
55
|
-
checked
|
56
|
-
id="node-input-force_send_array"
|
57
|
-
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
58
|
-
/>
|
59
|
-
<label style="width:auto" for="node-input-force_send_array"
|
60
|
-
>Alway send an array? Only works if <i>Send multi</i> is false.</label
|
61
|
-
>
|
62
|
-
</div>
|
63
|
-
</div>
|
64
|
-
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
65
|
-
<label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
|
66
|
-
<div>
|
67
|
-
<input
|
68
|
-
type="checkbox"
|
69
|
-
checked
|
70
|
-
id="node-input-multisend"
|
71
|
-
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
72
|
-
/>
|
73
|
-
<label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
|
74
|
-
</div>
|
47
|
+
<div class="form-row">
|
48
|
+
<label for="node-input-sendtype"><i class="fa fa-sliders"></i> Result</label>
|
49
|
+
<select id="node-input-sendtype" style="width: 70%;">
|
50
|
+
<option value="array">Send as Array</option>
|
51
|
+
<option value="multi">Send Separately</option>
|
52
|
+
<option value="first">Send First Task</option>
|
53
|
+
</select>
|
75
54
|
</div>
|
76
55
|
</script>
|
77
56
|
|
@@ -88,6 +67,6 @@ A node which sends a payload to a usertask in the ProcessCube.
|
|
88
67
|
|
89
68
|
### References
|
90
69
|
|
91
|
-
-
|
92
|
-
-
|
70
|
+
- [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
71
|
+
- [Node-RED Integration in ProcessCube©](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube©
|
93
72
|
</script>
|
package/usertask-input.js
CHANGED
@@ -4,7 +4,6 @@ module.exports = function (RED) {
|
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
node.on('input', function (msg) {
|
7
|
-
|
8
7
|
const engine = RED.nodes.getNode(config.engine);
|
9
8
|
|
10
9
|
const client = engine.engineClient;
|
@@ -17,46 +16,26 @@ module.exports = function (RED) {
|
|
17
16
|
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
18
17
|
|
19
18
|
query = {
|
20
|
-
...query
|
19
|
+
...query,
|
21
20
|
};
|
22
21
|
|
23
|
-
client.userTasks
|
22
|
+
client.userTasks
|
23
|
+
.query(query, { identity: engine.identity })
|
24
24
|
.then((matchingFlowNodes) => {
|
25
|
-
if (
|
26
|
-
|
27
|
-
matchingFlowNodes &&
|
28
|
-
matchingFlowNodes.userTasks &&
|
29
|
-
matchingFlowNodes.userTasks.length == 1
|
30
|
-
) {
|
31
|
-
userTask = matchingFlowNodes.userTasks[0];
|
32
|
-
|
33
|
-
msg.payload = { userTask: userTask };
|
25
|
+
if (config.sendtype === 'array') {
|
26
|
+
msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
|
34
27
|
node.send(msg);
|
35
|
-
} else {
|
36
|
-
|
37
|
-
|
38
|
-
matchingFlowNodes.userTasks.forEach((userTask) => {
|
39
|
-
msg.payload = { userTask: userTask };
|
40
|
-
node.send(msg);
|
41
|
-
});
|
42
|
-
} else {
|
43
|
-
if (matchingFlowNodes.userTasks == 1) {
|
44
|
-
msg.payload = {
|
45
|
-
userTasks: matchingFlowNodes.userTasks,
|
46
|
-
};
|
47
|
-
node.send(msg);
|
48
|
-
} else {
|
49
|
-
node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
|
50
|
-
}
|
51
|
-
}
|
52
|
-
} else {
|
53
|
-
msg.payload = {
|
54
|
-
userTasks: matchingFlowNodes.userTasks || [],
|
55
|
-
};
|
28
|
+
} else if (config.sendtype === 'multi' && matchingFlowNodes?.userTasks?.length > 1) {
|
29
|
+
matchingFlowNodes.userTasks.forEach((userTask) => {
|
30
|
+
msg.payload = { userTask };
|
56
31
|
node.send(msg);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
32
|
+
});
|
33
|
+
} else if (matchingFlowNodes?.userTasks?.length >= 1) {
|
34
|
+
msg.payload = { userTask: matchingFlowNodes.userTasks[0] };
|
35
|
+
node.send(msg);
|
36
|
+
} else node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
|
37
|
+
})
|
38
|
+
.catch((error) => {
|
60
39
|
node.error(error);
|
61
40
|
});
|
62
41
|
});
|