@5minds/node-red-contrib-processcube 1.8.5-develop-e1e2dc-m7pcoei4 → 1.8.6-develop-ccda16-m7pcutdr

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.
@@ -429,7 +429,7 @@
429
429
  },
430
430
  "@5minds/node-red-contrib-processcube": {
431
431
  "name": "@5minds/node-red-contrib-processcube",
432
- "version": "1.8.4",
432
+ "version": "1.8.5",
433
433
  "local": false,
434
434
  "user": false,
435
435
  "nodes": {
@@ -174,54 +174,36 @@ module.exports = function (RED) {
174
174
  this.showStatus();
175
175
  };
176
176
 
177
+ node.sendStatus = (status, message) => {
178
+ RED.events.emit("processcube:healthcheck:update", {
179
+ nodeId: node.id,
180
+ status: status,
181
+ nodeName: node.name,
182
+ nodeType: 'externaltask-input',
183
+ message: message
184
+ });
185
+ };
186
+
177
187
  node.showStatus = () => {
178
188
  const msgCounter = Object.keys(this.started_external_tasks).length;
179
189
 
180
190
  if (this._subscribed === false) {
181
191
  this.status({ fill: 'red', shape: 'ring', text: `subscription failed (${msgCounter}).` });
182
192
 
183
- RED.events.emit("processcube:healthcheck:update", {
184
- nodeId: node.id,
185
- status: 'NotOk',
186
- nodeName: node.name,
187
- nodeType: 'externaltask-input',
188
- message: `subscription failed (${msgCounter}).`
189
- });
193
+ this.sendStatus('NotOk', `subscription failed (${msgCounter}).`);
190
194
  } else {
191
195
  if (msgCounter >= 1) {
192
196
  if (node._step) {
193
197
  this.status({ fill: 'green', shape: 'dot', text: `tasks(${msgCounter}) ->'${node._step}'.` });
194
-
195
- RED.events.emit("processcube:healthcheck:update", {
196
- nodeId: node.id,
197
- status: 'Ok',
198
- nodeName: node.name,
199
- nodeType: 'externaltask-input',
200
- message: `tasks(${msgCounter}) ->'${node._step}'.`
201
- });
202
-
198
+ this.sendStatus('Ok', `tasks(${msgCounter}) ->'${node._step}'.`);
203
199
  } else {
204
200
  this.status({ fill: 'green', shape: 'dot', text: `tasks(${msgCounter}).` });
205
-
206
- RED.events.emit("processcube:healthcheck:update", {
207
- nodeId: node.id,
208
- status: 'Ok',
209
- nodeName: node.name,
210
- nodeType: 'externaltask-input',
211
- message: `tasks(${msgCounter}).`
212
- });
201
+ this.sendStatus('Ok', `tasks(${msgCounter}).`);
213
202
  }
214
203
  this.log(`handling tasks ${msgCounter}.`);
215
204
  } else {
216
205
  this.status({ fill: 'blue', shape: 'ring', text: `subcribed.` });
217
-
218
- RED.events.emit("processcube:healthcheck:update", {
219
- nodeId: node.id,
220
- status: 'Ok',
221
- nodeName: node.name,
222
- nodeType: 'externaltask-input',
223
- message: `subcribed.`
224
- });
206
+ this.sendStatus('Ok', `subcribed.`);
225
207
  }
226
208
  }
227
209
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.8.5-develop-e1e2dc-m7pcoei4",
3
+ "version": "1.8.6-develop-ccda16-m7pcutdr",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {