node-red-contrib-uos-nats 0.2.38 → 0.2.39

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.
@@ -16,116 +16,117 @@
16
16
  return this.name || "DataHub - Write";
17
17
  },
18
18
  paletteLabel: "DataHub - Write",
19
- // Search Button Handler
20
- $('#node-config-lookup-var').click(function () {
21
- const configId = $('#node-input-connection').val();
22
- const providerId = $('#node-input-providerId').val();
23
-
24
- if (!configId || configId === '_ADD_') {
25
- RED.notify("Please select a valid Configuration Node first.", "error");
26
- return;
27
- }
28
- if (!providerId) {
29
- RED.notify("Please enter a Provider ID to search.", "error");
30
- return;
31
- }
32
-
33
- const notification = RED.notify("Searching variables... please wait...", "info");
34
-
35
- $.getJSON('datahub-nats/variables/' + configId + '/' + providerId, function (data) {
36
- notification.close();
37
-
38
- // Build table
39
- let rows = "";
40
- data.sort((a, b) => a.key.localeCompare(b.key));
41
-
42
- data.forEach(v => {
43
- rows += `<tr class="node-dialog-var-row" style="cursor:pointer;" data-id="${v.id}" data-key="${v.key}">
44
- <td>${v.id}</td>
45
- <td>${v.key}</td>
46
- <td>${v.dataType}</td>
47
- <td>${v.access}</td>
48
- </tr>`;
49
- });
19
+ oneditprepare: function () {
20
+ // Search Button Handler
21
+ $('#node-config-lookup-var').click(function () {
22
+ const configId = $('#node-input-connection').val();
23
+ const providerId = $('#node-input-providerId').val();
24
+
25
+ if (!configId || configId === '_ADD_') {
26
+ RED.notify("Please select a valid Configuration Node first.", "error");
27
+ return;
28
+ }
29
+ if (!providerId) {
30
+ RED.notify("Please enter a Provider ID to search.", "error");
31
+ return;
32
+ }
33
+
34
+ const notification = RED.notify("Searching variables... please wait...", "info");
35
+
36
+ $.getJSON('datahub-nats/variables/' + configId + '/' + providerId, function (data) {
37
+ notification.close();
38
+
39
+ // Build table
40
+ let rows = "";
41
+ data.sort((a, b) => a.key.localeCompare(b.key));
42
+
43
+ data.forEach(v => {
44
+ rows += `<tr class="node-dialog-var-row" style="cursor:pointer;" data-id="${v.id}" data-key="${v.key}">
45
+ <td>${v.id}</td>
46
+ <td>${v.key}</td>
47
+ <td>${v.dataType}</td>
48
+ <td>${v.access}</td>
49
+ </tr>`;
50
+ });
50
51
 
51
- const dialogHtml = `
52
- <div id="node-lookup-var-dialog" title="Select Variable">
53
- <input type="text" id="node-lookup-var-search" placeholder="Filter variables..." style="width:100%; margin-bottom:10px;">
54
- <div style="height:300px; overflow-y:scroll; border:1px solid #ccc;">
55
- <table class="table table-hover" style="width:100%">
56
- <thead>
57
- <tr>
58
- <th>ID</th>
59
- <th>Key</th>
60
- <th>Type</th>
61
- <th>Access</th>
62
- </tr>
63
- </thead>
64
- <tbody id="node-lookup-var-list">
65
- ${rows}
66
- </tbody>
67
- </table>
52
+ const dialogHtml = `
53
+ <div id="node-lookup-var-dialog" title="Select Variable">
54
+ <input type="text" id="node-lookup-var-search" placeholder="Filter variables..." style="width:100%; margin-bottom:10px;">
55
+ <div style="height:300px; overflow-y:scroll; border:1px solid #ccc;">
56
+ <table class="table table-hover" style="width:100%">
57
+ <thead>
58
+ <tr>
59
+ <th>ID</th>
60
+ <th>Key</th>
61
+ <th>Type</th>
62
+ <th>Access</th>
63
+ </tr>
64
+ </thead>
65
+ <tbody id="node-lookup-var-list">
66
+ ${rows}
67
+ </tbody>
68
+ </table>
69
+ </div>
68
70
  </div>
69
- </div>
70
- `;
71
+ `;
71
72
 
72
- // Show Dialog (using jquery-ui which Node-RED has)
73
- const $dialog = $(dialogHtml).appendTo("body");
73
+ // Show Dialog (using jquery-ui which Node-RED has)
74
+ const $dialog = $(dialogHtml).appendTo("body");
74
75
 
75
- // Filter Logic
76
- $('#node-lookup-var-search').on('keyup', function () {
77
- const val = $(this).val().toLowerCase();
78
- $("#node-lookup-var-list tr").filter(function () {
79
- $(this).toggle($(this).text().toLowerCase().indexOf(val) > -1)
76
+ // Filter Logic
77
+ $('#node-lookup-var-search').on('keyup', function () {
78
+ const val = $(this).val().toLowerCase();
79
+ $("#node-lookup-var-list tr").filter(function () {
80
+ $(this).toggle($(this).text().toLowerCase().indexOf(val) > -1)
81
+ });
80
82
  });
81
- });
82
83
 
83
- // Row Click Logic
84
- $('.node-dialog-var-row').click(function () {
85
- const id = $(this).data('id');
86
- const key = $(this).data('key');
84
+ // Row Click Logic
85
+ $('.node-dialog-var-row').click(function () {
86
+ const id = $(this).data('id');
87
+ const key = $(this).data('key');
87
88
 
88
- $('#node-input-variableId').val(id);
89
- $('#node-input-variableKey').val(key);
89
+ $('#node-input-variableId').val(id);
90
+ $('#node-input-variableKey').val(key);
90
91
 
91
- $dialog.dialog('close');
92
- $dialog.remove();
93
- });
92
+ $dialog.dialog('close');
93
+ $dialog.remove();
94
+ });
94
95
 
95
- $dialog.dialog({
96
- modal: true,
97
- autoOpen: true,
98
- width: 600,
99
- title: `Variables for ${providerId}`,
100
- buttons: {
101
- "Cancel": function () {
102
- $(this).dialog("close");
103
- $(this).remove();
96
+ $dialog.dialog({
97
+ modal: true,
98
+ autoOpen: true,
99
+ width: 600,
100
+ title: `Variables for ${providerId}`,
101
+ buttons: {
102
+ "Cancel": function () {
103
+ $(this).dialog("close");
104
+ $(this).remove();
105
+ }
104
106
  }
105
- }
106
- });
107
+ });
107
108
 
108
- }).fail(function (jqxhr) {
109
- notification.close();
110
- RED.notify("Search failed: " + jqxhr.responseText, "error");
109
+ }).fail(function (jqxhr) {
110
+ notification.close();
111
+ RED.notify("Search failed: " + jqxhr.responseText, "error");
112
+ });
111
113
  });
112
- });
113
-
114
- // Validate: at least one of ID or Key required
115
- const validateVar = () => {
116
- const hasId = $('#node-input-variableId').val();
117
- const hasKey = $('#node-input-variableKey').val();
118
- if (!hasId && !hasKey) {
119
- $('#var-validation-error').show();
120
- return false;
121
- } else {
122
- $('#var-validation-error').hide();
123
- return true;
124
- }
125
- };
126
-
127
- $('#node-input-variableId, #node-input-variableKey').on('change keyup', validateVar);
128
- },
114
+
115
+ // Validate: at least one of ID or Key required
116
+ const validateVar = () => {
117
+ const hasId = $('#node-input-variableId').val();
118
+ const hasKey = $('#node-input-variableKey').val();
119
+ if (!hasId && !hasKey) {
120
+ $('#var-validation-error').show();
121
+ return false;
122
+ } else {
123
+ $('#var-validation-error').hide();
124
+ return true;
125
+ }
126
+ };
127
+
128
+ $('#node-input-variableId, #node-input-variableKey').on('change keyup', validateVar);
129
+ },
129
130
  oneditsave: function () {
130
131
  // Loose validation - server side will check
131
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-uos-nats",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
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",