node-red-contrib-uos-nats 1.2.4 → 1.3.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.
package/nodes/datahub-input.html
CHANGED
|
@@ -62,8 +62,9 @@
|
|
|
62
62
|
const $hiddenManual = $('#node-input-manualVariables');
|
|
63
63
|
|
|
64
64
|
// Styles
|
|
65
|
-
|
|
66
|
-
const
|
|
65
|
+
// Adjusted: ID column removed per user request (Key is main identifier)
|
|
66
|
+
const rowStyle = "display:grid; grid-template-columns: 30px 1fr; align-items:center; padding:4px 0; border-bottom:1px solid #eee; font-family:'Helvetica Neue', Arial, sans-serif; font-size:12px;";
|
|
67
|
+
// const idStyle = ... (removed)
|
|
67
68
|
const keyStyle = "overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-left:10px;";
|
|
68
69
|
|
|
69
70
|
let currentVariables = []; // Stores {id, key, accessType, etc.}
|
|
@@ -93,7 +94,7 @@
|
|
|
93
94
|
const selectedMap = getSelectedMap();
|
|
94
95
|
|
|
95
96
|
vars.forEach(v => {
|
|
96
|
-
// Robust ID handling
|
|
97
|
+
// Robust ID handling
|
|
97
98
|
let rawId = (v.id !== undefined && v.id !== null) ? v.id : v.Id;
|
|
98
99
|
const safeId = (rawId !== undefined && rawId !== null) ? rawId : 'ERR';
|
|
99
100
|
const isSelected = selectedMap.has(v.key);
|
|
@@ -104,13 +105,15 @@
|
|
|
104
105
|
const cb = $('<input type="checkbox" class="var-checkbox">')
|
|
105
106
|
.prop('checked', isSelected)
|
|
106
107
|
.data('key', v.key)
|
|
107
|
-
.data('id', safeId);
|
|
108
|
+
.data('id', safeId); // ID strictly stored in data attribute
|
|
108
109
|
cbContainer.append(cb);
|
|
109
110
|
|
|
110
|
-
|
|
111
|
+
// ID Column Removed from View
|
|
112
|
+
// const idBadge = ...
|
|
113
|
+
|
|
111
114
|
const label = $('<div>', { style: keyStyle, title: v.key }).text(v.key);
|
|
112
115
|
|
|
113
|
-
row.append(cbContainer).append(
|
|
116
|
+
row.append(cbContainer).append(label); // No ID badge
|
|
114
117
|
$listContainer.append(row);
|
|
115
118
|
});
|
|
116
119
|
};
|
package/nodes/datahub-write.html
CHANGED
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
const $inputKey = $('#node-input-variableKey');
|
|
30
30
|
|
|
31
31
|
// Styles matching Read Node exactly
|
|
32
|
-
|
|
33
|
-
const
|
|
32
|
+
// Adjusted: ID column removed
|
|
33
|
+
const rowStyle = "display:grid; grid-template-columns: 30px 1fr; align-items:center; padding:4px 0; border-bottom:1px solid #eee; font-family:'Helvetica Neue', Arial, sans-serif; font-size:12px; cursor:pointer;";
|
|
34
|
+
// const idStyle = ...
|
|
34
35
|
const keyStyle = "overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-left:10px;";
|
|
35
36
|
|
|
36
37
|
// Removed iconStyle, using checkbox instead
|
|
@@ -60,12 +61,12 @@
|
|
|
60
61
|
|
|
61
62
|
cbContainer.append(cb);
|
|
62
63
|
|
|
63
|
-
// ID
|
|
64
|
-
const idCol = $('<div>', { style: 'text-align:center;' }).append($('<span>', { style: idStyle }).text(safeId));
|
|
64
|
+
// ID - HIDDEN
|
|
65
|
+
// const idCol = $('<div>', { style: 'text-align:center;' }).append($('<span>', { style: idStyle }).text(safeId));
|
|
65
66
|
// Key
|
|
66
67
|
const keyCol = $('<div>', { style: keyStyle, title: v.key }).text(v.key);
|
|
67
68
|
|
|
68
|
-
row.append(cbContainer).append(
|
|
69
|
+
row.append(cbContainer).append(keyCol); // No ID Col
|
|
69
70
|
|
|
70
71
|
// Click Handler (Row or Checkbox)
|
|
71
72
|
const selectRow = () => {
|
package/nodes/datahub-write.js
CHANGED
|
@@ -106,13 +106,36 @@ module.exports = function (RED) {
|
|
|
106
106
|
// Validate: either ID or Key required
|
|
107
107
|
// Relaxed validation for Batch Mode (handled in Input)
|
|
108
108
|
|
|
109
|
-
// If
|
|
110
|
-
|
|
109
|
+
// If Key is provided, we should ALWAYS resolve it to ensure ID is fresh (Auto-Healing)
|
|
110
|
+
// If only ID is provided (legacy), we trust it.
|
|
111
|
+
if (this.variableKey) {
|
|
112
|
+
// Trigger background resolution
|
|
113
|
+
node.status({ fill: 'yellow', shape: 'dot', text: 'resolving...' });
|
|
114
|
+
resolveVariableKey(await configNode.acquire(), this.providerId, this.variableKey, node, node.payloads)
|
|
115
|
+
.then(resolved => {
|
|
116
|
+
node.resolvedId = resolved.id;
|
|
117
|
+
node.resolvedDataType = resolved.dataType;
|
|
118
|
+
node.resolvedFingerprint = resolved.fingerprint;
|
|
119
|
+
|
|
120
|
+
if (node.variableId && node.variableId !== resolved.id) {
|
|
121
|
+
node.warn(`Auto-Healed ID for '${this.variableKey}': Configured=${node.variableId}, Resolved=${resolved.id}`);
|
|
122
|
+
}
|
|
123
|
+
node.status({ fill: 'green', shape: 'ring', text: 'ready' });
|
|
124
|
+
})
|
|
125
|
+
.catch(err => {
|
|
126
|
+
node.warn(`ID Resolution failed for '${this.variableKey}': ${err.message}. Using configured ID: ${this.variableId}`);
|
|
127
|
+
// Fallback to configured ID if resolution failed
|
|
128
|
+
if (this.variableId && !isNaN(this.variableId)) {
|
|
129
|
+
node.resolvedId = this.variableId;
|
|
130
|
+
node.status({ fill: 'green', shape: 'ring', text: 'ready (fallback)' });
|
|
131
|
+
} else {
|
|
132
|
+
node.status({ fill: 'red', shape: 'dot', text: 'resolution failed' });
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
} else if (this.variableId && !isNaN(this.variableId)) {
|
|
136
|
+
// Legacy/Manual Mode without Key
|
|
111
137
|
this.resolvedId = this.variableId;
|
|
112
138
|
node.status({ fill: 'green', shape: 'ring', text: 'ready' });
|
|
113
|
-
} else if (this.variableKey) {
|
|
114
|
-
// Key provided - will resolve on first message
|
|
115
|
-
node.status({ fill: 'yellow', shape: 'ring', text: 'key needs resolution' });
|
|
116
139
|
}
|
|
117
140
|
|
|
118
141
|
// Load payloads module dynamically
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-uos-nats",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Node-RED nodes for Weidmüller u-OS Data Hub. Read, write, and provide variables via NATS protocol with OAuth2 authentication. Features: Variable Key resolution, custom icons, example flows, and provider definition caching.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "IoTUeli",
|