node-red-contrib-uos-nats 0.1.28 → 0.1.30

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,7 @@
9
9
  variablesText: { value: '', required: false },
10
10
  pollingInterval: { value: 0, required: false, validate: RED.validators.number() },
11
11
  },
12
- inputs: 0,
12
+ inputs: 1,
13
13
  outputs: 1,
14
14
  icon: "white/datahub-input.svg",
15
15
  oneditprepare: function () {
@@ -77,7 +77,13 @@
77
77
  let providerRequest = 0;
78
78
  let variableRequest = 0;
79
79
 
80
- const setProviderStatus = (text) => $providerStatus.text(text || '');
80
+ const setProviderStatus = (text) => {
81
+ if (text) {
82
+ $providerStatus.text(text).show();
83
+ } else {
84
+ $providerStatus.hide();
85
+ }
86
+ };
81
87
  const setVariableStatus = (text) => $variablesStatus.text(text || '');
82
88
 
83
89
  const setProviderValue = (value) => {
@@ -268,6 +274,14 @@
268
274
  if (prov) loadVariables(prov, true);
269
275
  });
270
276
 
277
+ $('#datahub-vars-all').on('click', () => {
278
+ $variablesContainer.find('input[type="checkbox"]').prop('checked', true).trigger('change');
279
+ });
280
+
281
+ $('#datahub-vars-none').on('click', () => {
282
+ $variablesContainer.find('input[type="checkbox"]').prop('checked', false).trigger('change');
283
+ });
284
+
271
285
  // Removed $providerManual listeners as per instruction
272
286
 
273
287
  $config.on('change', () => {
@@ -292,10 +306,7 @@
292
306
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
293
307
  <input type="text" id="node-input-name">
294
308
  </div>
295
- <div class="form-row">
296
- <label for="node-input-pollingInterval"><i class="fa fa-clock-o"></i> Polling (ms)</label>
297
- <input type="number" id="node-input-pollingInterval" placeholder="0 = Events only, >0 = Hybrid">
298
- </div>
309
+ <!-- Polling (ms) removed in favor of Input Port triggering -->
299
310
  <div class="form-row">
300
311
  <label for="node-input-connection"><i class="fa fa-cube"></i> u-OS Config</label>
301
312
  <input type="text" id="node-input-connection">
@@ -312,18 +323,20 @@
312
323
  </div>
313
324
  <div class="form-row">
314
325
  <label></label>
315
- <div id="datahub-provider-status" class="form-tips"></div>
326
+ <div id="datahub-provider-status" class="form-tips" style="display:none;"></div>
316
327
  </div>
317
- <div class="form-row">
318
- <label for="datahub-input-variables"><i class="fa fa-list"></i> Variables</label>
319
- <div style="display:flex; align-items:center; flex:1; margin-bottom:5px;">
320
- <span style="flex:1"></span>
328
+ <div class="form-row" style="margin-bottom:0;">
329
+ <label for="datahub-input-variables" style="width: auto;"><i class="fa fa-list"></i> Variables</label>
330
+ <div style="display:inline-block; float:right;">
331
+ <div class="btn-group" style="margin-right: 5px;">
332
+ <button type="button" id="datahub-vars-all" class="red-ui-button red-ui-button-small" title="Select All"><i class="fa fa-check-square-o"></i></button>
333
+ <button type="button" id="datahub-vars-none" class="red-ui-button red-ui-button-small" title="Deselect All"><i class="fa fa-square-o"></i></button>
334
+ </div>
321
335
  <button type="button" id="datahub-vars-refresh" class="red-ui-button red-ui-button-small" title="Refresh Variables"><i class="fa fa-refresh"></i></button>
322
336
  </div>
323
337
  </div>
324
338
  <div class="form-row">
325
- <label></label>
326
- <div style="border:1px solid #ccc; border-radius:4px; height:150px; overflow-y:scroll; padding:5px; margin-left:105px;" id="datahub-variables-container">
339
+ <div style="border:1px solid #ccc; border-radius:4px; height:200px; overflow-y:scroll; padding:5px; width:100%; box-sizing:border-box;" id="datahub-variables-container">
327
340
  <!-- Checkboxes will be inserted here -->
328
341
  <div style="color:#aaa; font-style:italic; padding:5px;">Select a provider to load variables...</div>
329
342
  </div>
@@ -342,17 +355,10 @@
342
355
  <dt>u-OS Config</dt>
343
356
  <dd>Pick the connection node that holds host, port and OAuth credentials.</dd>
344
357
  <dt>Provider ID</dt>
345
- <dd>Provider to read. The drop-down lists every provider returned by the <p><strong>Attributes:</strong></p>
358
+ <dd>Provider to read. The drop-down lists every provider returned by the <p><strong>Attributes:</strong></p>
346
359
  <dl>
347
- <dt>Polling (ms)</dt>
348
- <dd>
349
- <ul>
350
- <li><code>0</code> (default): <strong>Event-based only</strong>. You receive updates whenever they happen.</li>
351
- <li><code>> 0</code>: <strong>Hybrid Mode</strong>. You receive live Events <strong>AND</strong> the node explicitly reads all values every X milliseconds. Useful if you suspect missed events.</li>
352
- </ul>
353
- </dd>
354
360
  <dt>Provider & Variables</dt>
355
- <dd>Click the <strong>Refresh</strong> button to load the lists. Providers can be cached, but <strong>Variables require a deployed Config Node</strong> to be loaded securely.</dd>
361
+ <dd>Click the <strong>Refresh</strong> button to load the lists. Use the Input Port (e.g. inject node) to trigger manual snapshots.</dd>
356
362
  </dl>
357
363
  <p><strong>Troubleshooting:</strong></p>
358
364
  <ul>
@@ -128,6 +128,12 @@ module.exports = function (RED) {
128
128
  }
129
129
  };
130
130
 
131
+ this.on('input', (msg, send, done) => {
132
+ performSnapshot()
133
+ .then(() => done())
134
+ .catch((err) => done(err));
135
+ });
136
+
131
137
  start();
132
138
 
133
139
  this.on('close', async (done) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-uos-nats",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Node-RED nodes for u-OS Data Hub via NATS",
5
5
  "repository": {
6
6
  "type": "git",