@5minds/node-red-contrib-processcube 1.11.1 → 1.12.0

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.
@@ -9,7 +9,8 @@
9
9
  topic: { value: '' },
10
10
  topicType: { value: '' },
11
11
  workerConfig: { value: '{}'},
12
- workerConfigType: { value: 'json'}
12
+ workerConfigType: { value: 'json'},
13
+ traces: { value: [] },
13
14
  },
14
15
  inputs: 0,
15
16
  outputs: 1,
@@ -33,6 +34,24 @@
33
34
 
34
35
  $('#node-input-topic').typedInput('value', this.topic);
35
36
  $('#node-input-topic').typedInput('type', this.topicType);
37
+
38
+ const allTraces = [
39
+ { value: "start", label: "Start" },
40
+ { value: "enter", label: "Enter" },
41
+ { value: "exit", label: "Exit" },
42
+ { value: "finish", label: "Finish" }
43
+ ];
44
+
45
+ const selectEl = $("#node-input-traces");
46
+
47
+ // Optionen einfügen
48
+ allTraces.forEach(opt => {
49
+ selectEl.append(new Option(opt.label, opt.value));
50
+ });
51
+
52
+ // Bereits gespeicherte Werte setzen
53
+ const selectedOptions = this.traces || [];
54
+ selectEl.val(selectedOptions);
36
55
  },
37
56
  oneditsave: function () {
38
57
  this.workerConfig = $('#node-input-workerConfig').typedInput('value');
@@ -43,6 +62,9 @@
43
62
  this.workerConfigType = $('#node-input-workerConfig').typedInput('type');
44
63
  this.topic = $('#node-input-topic').typedInput('value');
45
64
  this.topicType = $('#node-input-topic').typedInput('type');
65
+
66
+ const selected = $("#node-input-traces").val();
67
+ this.traces = selected;
46
68
  },
47
69
  });
48
70
  </script>
@@ -68,6 +90,10 @@
68
90
  <label for="node-input-workerConfig"><i class="fa fa-tag"></i> Config</label>
69
91
  <input type="text" id="node-input-workerConfig" />
70
92
  </div>
93
+ <div class="form-row">
94
+ <label for="node-input-traces"><i class="fa fa-check-square"></i> Traces</label>
95
+ <select id="node-input-traces" multiple size="4" style="width: 100%"></select>
96
+ </div>
71
97
  </script>
72
98
 
73
99
  <script type="text/markdown" data-help-name="externaltask-input">
@@ -17,6 +17,7 @@ module.exports = function (RED) {
17
17
  let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node);
18
18
  let topic = node.topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node)
19
19
  this.workername = RED.util.evaluateNodeProperty(config.workername, config.workernameType, node);
20
+ node._traces = config.traces || [];
20
21
 
21
22
  if (!options['workerId']) {
22
23
 
@@ -146,6 +147,23 @@ module.exports = function (RED) {
146
147
  theNode.status({ fill: 'blue', shape: 'dot', text: `tasks(${node._tracking_nodes[theNode.id].count})` });
147
148
  };
148
149
 
150
+ node.traceExecution = (msg) => {
151
+ if ((node._traces || []).includes(msg.event)) {
152
+
153
+ const message = {
154
+ id: node.id,
155
+ z: node.z,
156
+ _alias: node._alias,
157
+ path: node._flow.path,
158
+ name: node.name,
159
+ topic: node.topic,
160
+ msg: msg
161
+ };
162
+
163
+ RED.comms.publish("debug", message);
164
+ }
165
+ };
166
+
149
167
  RED.hooks.add('preDeliver', (sendEvent) => {
150
168
  if (node.isHandling() && node.ownMessage(sendEvent.msg)) {
151
169
 
@@ -156,6 +174,17 @@ module.exports = function (RED) {
156
174
 
157
175
  node.showStatus();
158
176
 
177
+ const debugMsg = {
178
+ event: 'enter',
179
+ sourceName: sourceNode.name,
180
+ sourceType: sourceNode.type,
181
+ destinationNodeName: destinationNode.name,
182
+ destinationNodeType: destinationNode.type,
183
+ timestamp: new Date().toISOString(),
184
+ };
185
+
186
+ node.traceExecution(debugMsg);
187
+
159
188
  if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true') {
160
189
  node._trace = `'${sourceNode.name || sourceNode.type}'->'${destinationNode.name || destinationNode.type}'`;
161
190
  node.log(`preDeliver: ${node._trace}`);
@@ -171,6 +200,17 @@ module.exports = function (RED) {
171
200
  node.decrMsgOnNode(sourceNode, sendEvent.msg);
172
201
  node.incMsgOnNode(destinationNode, sendEvent.msg);
173
202
 
203
+ const debugMsg = {
204
+ event: 'exit',
205
+ sourceName: sourceNode.name,
206
+ sourceType: sourceNode.type,
207
+ destinationNodeName: destinationNode.name,
208
+ destinationNodeType: destinationNode.type,
209
+ timestamp: new Date().toISOString(),
210
+ };
211
+
212
+ node.traceExecution(debugMsg);
213
+
174
214
  if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true') {
175
215
  node._trace = `'${sourceNode.name || sourceNode.type}'->'${destinationNode.name || destinationNode.type}'`;
176
216
  node.log(`postDeliver: ${node._trace}`);
@@ -200,6 +240,15 @@ module.exports = function (RED) {
200
240
  this._subscribed_error = null;
201
241
  this.started_external_tasks[externalTask.flowNodeInstanceId] = externalTask;
202
242
 
243
+ const debugMsg = {
244
+ event: 'start',
245
+ topic: node.topic,
246
+ flowNodeInstanceId: externalTask.flowNodeInstanceId,
247
+ timestamp: new Date().toISOString(),
248
+ };
249
+
250
+ node.traceExecution(debugMsg);
251
+
203
252
  this.showStatus();
204
253
  };
205
254
 
@@ -213,6 +262,16 @@ module.exports = function (RED) {
213
262
  this._subscribed = true;
214
263
  this._subscribed_error = null;
215
264
 
265
+ const debugMsg = {
266
+ event: 'finish',
267
+ topic: node.topic,
268
+ flowNodeInstanceId: externalTask.flowNodeInstanceId,
269
+ timestamp: new Date().toISOString(),
270
+ };
271
+
272
+ node.traceExecution(debugMsg);
273
+
274
+
216
275
  this.clearTracking(externalTask); // as msg
217
276
  this.showStatus();
218
277
  };
@@ -249,7 +308,7 @@ module.exports = function (RED) {
249
308
  if (msgCounter >= 1) {
250
309
  if (node._step) {
251
310
  this.status({ fill: 'blue', shape: 'dot', text: `tasks(${msgCounter}) ->'${node._step}'` });
252
- this.sendStatus('Ok', `tasks(${msgCounter}) ->'${node._step}'.`);
311
+ this.sendStatus('Ok', `tasks(${msgCounter}) ->'${node._step}'.`);
253
312
  } else {
254
313
  this.status({ fill: 'blue', shape: 'dot', text: `tasks(${msgCounter})` });
255
314
  this.sendStatus('Ok', `tasks(${msgCounter})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {