@5minds/node-red-contrib-processcube 0.5.1-develop-65e016-lxnszh24 → 0.5.2-develop-0a86d2-lxpxvugu

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "0.5.1-develop-65e016-lxnszh24",
3
+ "version": "0.5.2-develop-0a86d2-lxpxvugu",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "authors": [
@@ -5,6 +5,7 @@
5
5
  defaults: {
6
6
  name: {value: ""},
7
7
  engine: {value: "", type: "processcube-engine-config"},
8
+ force_send_array: {value: false},
8
9
  multisend: {value: false}
9
10
  },
10
11
  inputs: 1,
@@ -25,6 +26,13 @@
25
26
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
27
  <input type="text" id="node-input-engine" placeholder="http://engine:8000">
27
28
  </div>
29
+ <div class="form-row" style="display:flex; margin-bottom: 3px;">
30
+ <label for="node-input-force_send_array" style="vertical-align:top"><i class="fa fa-list-alt"></i> Force send payload as array</label>
31
+ <div>
32
+ <input type="checkbox" checked id="node-input-force_send_array" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
33
+ <label style="width:auto" for="node-input-force_send_array">Alway send an array? Only works if <i>Send multi</i> is false.</label>
34
+ </div>
35
+ </div>
28
36
  <div class="form-row" style="display:flex; margin-bottom: 3px;">
29
37
  <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
30
38
  <div>
package/usertask-input.js CHANGED
@@ -51,17 +51,21 @@ module.exports = function(RED) {
51
51
 
52
52
  console.log(`UserTaskInput query result: ${JSON.stringify(matchingFlowNodes)}`);
53
53
 
54
- if (matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
54
+ if (config.force_send_array == false && matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
55
55
  userTask = matchingFlowNodes.userTasks[0];
56
56
 
57
57
  node.send({ payload: {userTask: userTask } });
58
58
  } else {
59
- if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
60
- matchingFlowNodes.userTasks.forEach((userTask) => {
61
- node.send({ payload: { userTask: userTask } });
62
- });
59
+ if (config.config.force_send_array == false) {
60
+ if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
61
+ matchingFlowNodes.userTasks.forEach((userTask) => {
62
+ node.send({ payload: { userTask: userTask } });
63
+ });
64
+ } else {
65
+ node.send({ payload: { userTasks: matchingFlowNodes.userTasks } });
66
+ }
63
67
  } else {
64
- node.send({ payload: { userTasks: matchingFlowNodes.userTasks } });
68
+ node.send({ payload: { userTasks: matchingFlowNodes.userTasks || []} });
65
69
  }
66
70
  }
67
71
  });