node-red-contrib-uos-nats 0.1.44 → 0.1.45
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.
- package/nodes/datahub-input.html +6 -0
- package/nodes/datahub-input.js +11 -7
- package/package.json +1 -1
package/nodes/datahub-input.html
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
connection: { type: 'uos-config', required: true },
|
|
8
8
|
providerId: { value: '', required: false },
|
|
9
9
|
variablesText: { value: '', required: false },
|
|
10
|
+
manualVariables: { value: '', required: false },
|
|
10
11
|
pollingInterval: { value: 0, required: false, validate: RED.validators.number() },
|
|
11
12
|
},
|
|
12
13
|
inputs: 1,
|
|
@@ -346,6 +347,11 @@
|
|
|
346
347
|
<label></label>
|
|
347
348
|
<div id="datahub-variables-status" class="form-tips">Leave empty to listen to every variable.</div>
|
|
348
349
|
</div>
|
|
350
|
+
<div class="form-row">
|
|
351
|
+
<label for="node-input-manualVariables" style="width: auto;"><i class="fa fa-wrench"></i> Manual Definitions</label>
|
|
352
|
+
<input type="text" id="node-input-manualVariables" placeholder="e.g. pressure:5, temp:6">
|
|
353
|
+
</div>
|
|
354
|
+
<div class="form-tips">Use <code>Name:ID</code> format to provide definitions if API Discovery fails (fixes "Empty List" issues).</div>
|
|
349
355
|
</script>
|
|
350
356
|
|
|
351
357
|
<script type="text/html" data-help-name="datahub-input">
|
package/nodes/datahub-input.js
CHANGED
|
@@ -29,12 +29,18 @@ module.exports = function (RED) {
|
|
|
29
29
|
this.providerId = config.providerId || 'sampleprovider';
|
|
30
30
|
this.pollingInterval = parseInt(config.pollingInterval, 10) || 0; // ms, 0 = disabled (default)
|
|
31
31
|
const text = config.variablesText || '';
|
|
32
|
+
const manualText = config.manualVariables || '';
|
|
32
33
|
|
|
33
|
-
// Parse variables
|
|
34
|
-
this.manualDefs = [];
|
|
34
|
+
// Parse variables: Standard list of names to filter
|
|
35
35
|
this.variables = text
|
|
36
36
|
.split(',')
|
|
37
|
-
.map((entry) =>
|
|
37
|
+
.map((entry) => (entry ? String(entry).trim() : ''))
|
|
38
|
+
.filter((entry) => entry.length > 0);
|
|
39
|
+
|
|
40
|
+
// Parse Manual Definitions "Name:ID"
|
|
41
|
+
this.manualDefs = [];
|
|
42
|
+
if (manualText) {
|
|
43
|
+
manualText.split(',').forEach(entry => {
|
|
38
44
|
let trimmed = entry ? String(entry).trim() : '';
|
|
39
45
|
if (trimmed.includes(':')) {
|
|
40
46
|
const parts = trimmed.split(':');
|
|
@@ -42,12 +48,10 @@ module.exports = function (RED) {
|
|
|
42
48
|
const id = parseInt(parts[1].trim(), 10);
|
|
43
49
|
if (name && !isNaN(id)) {
|
|
44
50
|
this.manualDefs.push({ id, key: name });
|
|
45
|
-
return name;
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.filter((entry) => entry.length > 0);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
51
55
|
|
|
52
56
|
let nc;
|
|
53
57
|
let sub;
|