@5minds/node-red-contrib-processcube 1.8.5-develop-e1e2dc-m7pcoei4 → 1.8.5-develop-bbf751-m7pcta62

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.
@@ -174,54 +174,35 @@ 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
+
177
186
  node.showStatus = () => {
178
187
  const msgCounter = Object.keys(this.started_external_tasks).length;
179
188
 
180
189
  if (this._subscribed === false) {
181
190
  this.status({ fill: 'red', shape: 'ring', text: `subscription failed (${msgCounter}).` });
182
191
 
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
- });
192
+ this.sendStatus('NotOk', `subscription failed (${msgCounter}).`);
190
193
  } else {
191
194
  if (msgCounter >= 1) {
192
195
  if (node._step) {
193
196
  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
-
197
+ this.sendStatus('Ok', `tasks(${msgCounter}) ->'${node._step}'.`);
203
198
  } else {
204
199
  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
- });
200
+ this.sendStatus('Ok', `tasks(${msgCounter}).`);
213
201
  }
214
202
  this.log(`handling tasks ${msgCounter}.`);
215
203
  } else {
216
204
  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
- });
205
+ this.sendStatus('Ok', `subcribed.`);
225
206
  }
226
207
  }
227
208
  };
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.5-develop-bbf751-m7pcta62",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {