@bkmj/node-red-contrib-odbcmj 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/odbc.html +117 -38
  2. package/package.json +1 -1
package/odbc.html CHANGED
@@ -2,12 +2,10 @@
2
2
  RED.nodes.registerType("odbc config", {
3
3
  category: "config",
4
4
  credentials: {
5
- // Le mot de passe est défini comme un "credential" sécurisé
6
5
  password: { type: "password" }
7
6
  },
8
7
  defaults: {
9
8
  name: { value: "" },
10
- // Nouveaux champs pour le mode de connexion hybride
11
9
  connectionMode: { value: "structured" },
12
10
  dbType: { value: "sqlserver" },
13
11
  driver: { value: "" },
@@ -15,18 +13,15 @@
15
13
  database: { value: "" },
16
14
  user: { value: "" },
17
15
  connectionString: { value: "" },
18
- // Champs de pool et timeout
19
16
  initialSize: { value: 5 },
20
17
  incrementSize: { value: 5 },
21
18
  maxSize: { value: 15 },
22
19
  shrink: { value: true },
23
20
  connectionTimeout: { value: 3 },
24
21
  loginTimeout: { value: 3 },
25
- // Champs de retry
26
22
  retryFreshConnection: { value: false },
27
23
  retryDelay: { value: 5, validate: RED.validators.number() },
28
24
  retryOnMsg: { value: true },
29
- // Champs avancés
30
25
  syntaxtick: { value: false },
31
26
  syntax: { value: "mysql" },
32
27
  },
@@ -36,7 +31,15 @@
36
31
  oneditprepare: function () {
37
32
  var node = this;
38
33
 
39
- // Logique pour afficher les bons champs selon le mode de connexion
34
+ // --- Logique pour les sections déroulantes ---
35
+ // On ajoute un écouteur de clic sur les en-têtes de section
36
+ $('.form-section-header').on('click', function() {
37
+ $(this).toggleClass('expanded');
38
+ // On fait basculer le conteneur d'options qui suit immédiatement l'en-tête
39
+ $(this).next('.form-section-content').slideToggle();
40
+ });
41
+
42
+ // --- Logique pour le mode de connexion hybride ---
40
43
  function toggleConnectionMode(mode) {
41
44
  if (mode === 'structured') {
42
45
  $(".config-mode-structured").show();
@@ -46,7 +49,6 @@
46
49
  $(".config-mode-string").show();
47
50
  }
48
51
  }
49
- // Gérer le changement du type de BD pour afficher/cacher le champ driver
50
52
  function toggleDriverField(dbType) {
51
53
  if (dbType === 'other') {
52
54
  $("#node-config-driver-row").show();
@@ -55,7 +57,6 @@
55
57
  }
56
58
  }
57
59
 
58
- // Initialisation de l'UI
59
60
  $("#node-config-input-connectionMode").on("change", function() {
60
61
  toggleConnectionMode($(this).val());
61
62
  }).trigger("change");
@@ -64,36 +65,38 @@
64
65
  toggleDriverField($(this).val());
65
66
  }).trigger("change");
66
67
 
67
-
68
- // Logique pour le 'Syntax Checker'
68
+ // --- Logiques pour les cases à cocher ---
69
69
  $("#node-config-input-syntaxtick").on("change", function () {
70
70
  $(".input-syntax").toggle(this.checked);
71
71
  }).trigger("change");
72
72
 
73
-
74
- // Logique pour afficher/masquer les options de retry
75
73
  $("#node-config-input-retryFreshConnection").on("change", function() {
76
74
  $(".retry-options").toggle(this.checked);
77
75
  }).trigger("change");
78
76
 
79
-
80
- // Logique pour le bouton de test de connexion
77
+ // --- Logique pour le bouton de test ---
81
78
  $('#node-config-test-connection').on('click', function() {
82
79
  var button = $(this);
83
- var originalText = button.text();
80
+ var originalText = "Test Connection";
84
81
  var icon = button.find("i");
85
82
  icon.removeClass('fa-bolt').addClass('fa-spinner fa-spin');
86
83
  button.text(' Testing...').prop('disabled', true);
87
84
 
88
- // Collecter toutes les données du formulaire
85
+ var connectionMode = $("#node-config-input-connectionMode").val();
86
+
87
+ // --- CORRECTION : Récupérer le bon mot de passe selon le mode ---
88
+ var password = (connectionMode === 'structured')
89
+ ? $("#node-config-input-password-structured").val()
90
+ : $("#node-config-input-password-string").val();
91
+
89
92
  var configData = {
90
- connectionMode: $("#node-config-input-connectionMode").val(),
93
+ connectionMode: connectionMode,
91
94
  dbType: $("#node-config-input-dbType").val(),
92
95
  driver: $("#node-config-input-driver").val(),
93
96
  server: $("#node-config-input-server").val(),
94
97
  database: $("#node-config-input-database").val(),
95
98
  user: $("#node-config-input-user").val(),
96
- password: $("#node-config-input-password").val(),
99
+ password: password,
97
100
  connectionString: $("#node-config-input-connectionString").val()
98
101
  };
99
102
 
@@ -119,6 +122,24 @@
119
122
  });
120
123
  </script>
121
124
 
125
+ <style>
126
+ .form-section-header {
127
+ cursor: pointer;
128
+ padding: 5px;
129
+ border-bottom: 1px solid #ddd;
130
+ margin-bottom: 10px;
131
+ }
132
+ .form-section-header i.fa-caret-right {
133
+ transition: transform 0.2s ease-in-out;
134
+ }
135
+ .form-section-header.expanded i.fa-caret-right {
136
+ transform: rotate(90deg);
137
+ }
138
+ .form-section-content {
139
+ padding-left: 20px;
140
+ }
141
+ </style>
142
+
122
143
  <script type="text/html" data-template-name="odbc config">
123
144
  <div class="form-row">
124
145
  <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -160,19 +181,19 @@
160
181
  <input type="text" id="node-config-input-user">
161
182
  </div>
162
183
  <div class="form-row">
163
- <label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
164
- <input type="password" id="node-config-input-password">
184
+ <label for="node-config-input-password-structured"><i class="fa fa-lock"></i> Password</label>
185
+ <input type="password" id="node-config-input-password-structured">
165
186
  </div>
166
187
  </div>
167
188
 
168
189
  <div class="config-mode-string">
169
190
  <div class="form-row">
170
191
  <label for="node-config-input-connectionString"><i class="fa fa-font"></i> Connection String</label>
171
- <input type="text" id="node-config-input-connectionString" placeholder="DRIVER={...};SERVER=...;PWD={{{password}}};">
192
+ <input type="text" id="node-config-input-connectionString" placeholder="DRIVER={...};PWD={{{password}}};">
172
193
  </div>
173
194
  <div class="form-row">
174
- <label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
175
- <input type="password" id="node-config-input-password">
195
+ <label for="node-config-input-password-string"><i class="fa fa-lock"></i> Password</label>
196
+ <input type="password" id="node-config-input-password-string">
176
197
  <span class="form-tips">Use <code>{{{password}}}</code> placeholder in the string above.</span>
177
198
  </div>
178
199
  </div>
@@ -183,12 +204,79 @@
183
204
  </div>
184
205
 
185
206
  <hr/>
186
- <h4><i class="fa fa-sitemap"></i> Pool Options</h4>
187
- <hr/>
188
- <h4><i class="fa fa-exclamation-triangle"></i> Error Handling & Retry</h4>
189
- <hr/>
190
- <h4><i class="fa fa-wrench"></i> Advanced</h4>
191
- </script>
207
+
208
+ <div class="form-section-header expanded"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-sitemap"></i> Pool Options</h4></div>
209
+ <div class="form-section-content">
210
+ <div class="form-row">
211
+ <label for="node-config-input-initialSize"><i class="fa fa-play"></i> Initial Size</label>
212
+ <input type="number" id="node-config-input-initialSize" placeholder="5" />
213
+ </div>
214
+ <div class="form-row">
215
+ <label for="node-config-input-incrementSize"><i class="fa fa-plus"></i> Increment Size</label>
216
+ <input type="number" id="node-config-input-incrementSize" placeholder="5" />
217
+ </div>
218
+ <div class="form-row">
219
+ <label for="node-config-input-maxSize"><i class="fa fa-stop"></i> Max Size</label>
220
+ <input type="number" id="node-config-input-maxSize" placeholder="15" />
221
+ </div>
222
+ <div class="form-row">
223
+ <label for="node-config-input-shrink"><i class="fa fa-compress"></i> Shrink Pool</label>
224
+ <input type="checkbox" id="node-config-input-shrink" style="margin-left:0px; vertical-align:top; width:auto !important;" />
225
+ </div>
226
+ <div class="form-row">
227
+ <label for="node-config-input-connectionTimeout"><i class="fa fa-clock-o"></i> Connection Timeout</label>
228
+ <input type="number" id="node-config-input-connectionTimeout" placeholder="3" style="width: 80px;"/>
229
+ <span style="margin-left: 5px;">seconds</span>
230
+ </div>
231
+ <div class="form-row">
232
+ <label for="node-config-input-loginTimeout"><i class="fa fa-clock-o"></i> Login Timeout</label>
233
+ <input type="number" id="node-config-input-loginTimeout" placeholder="3" style="width: 80px;" />
234
+ <span style="margin-left: 5px;">seconds</span>
235
+ </div>
236
+ </div>
237
+
238
+ <div class="form-section-header expanded"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-exclamation-triangle"></i> Error Handling & Retry</h4></div>
239
+ <div class="form-section-content">
240
+ <div class="form-row">
241
+ <label for="node-config-input-retryFreshConnection" style="width: auto;"><i class="fa fa-refresh"></i> Retry with fresh connection</label>
242
+ <input type="checkbox" id="node-config-input-retryFreshConnection" style="display: inline-block; width: auto; vertical-align: top;" />
243
+ </div>
244
+ <div class="retry-options" style="padding-left: 20px;">
245
+ <div class="form-row">
246
+ <label for="node-config-input-retryDelay"><i class="fa fa-history"></i> Retry Delay</label>
247
+ <input type="number" id="node-config-input-retryDelay" placeholder="5" style="width: 80px;" />
248
+ <span style="margin-left: 5px;">seconds</span>
249
+ </div>
250
+ <div class="form-row">
251
+ <label for="node-config-input-retryOnMsg" style="width: auto;"><i class="fa fa-envelope-o"></i> Retry on new message</label>
252
+ <input type="checkbox" id="node-config-input-retryOnMsg" style="display: inline-block; width: auto; vertical-align: top;" />
253
+ </div>
254
+ </div>
255
+ </div>
256
+
257
+ <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-wrench"></i> Advanced</h4></div>
258
+ <div class="form-section-content" style="display: none;">
259
+ <div class="form-row">
260
+ <label for="node-config-input-syntaxtick" style="width: auto;"><i class="fa fa-check-square-o"></i> Syntax Checker</label>
261
+ <input type="checkbox" id="node-config-input-syntaxtick" style="display: inline-block; width: auto; vertical-align: top;" />
262
+ </div>
263
+ <div class="form-row input-syntax">
264
+ <label for="node-config-input-syntax"><i class="fa fa-language"></i> Syntax</label>
265
+ <select id="node-config-input-syntax" style="width: 70%">
266
+ <option value="bigquery">BigQuery</option>
267
+ <option value="db2">DB2</option>
268
+ <option value="hive">Hive</option>
269
+ <option value="mariadb">MariaDB</option>
270
+ <option value="mysql">Mysql</option>
271
+ <option value="postgresql">PostgresQL</option>
272
+ <option value="sqlite">Sqlite</option>
273
+ <option value="transactsql">TransactSQL</option>
274
+ <option value="flinksql">FlinkSQL</option>
275
+ </select>
276
+ </div>
277
+ </div>
278
+ </script>
279
+
192
280
 
193
281
  <script type="text/javascript">
194
282
  RED.nodes.registerType("odbc", {
@@ -199,7 +287,6 @@
199
287
  connection: { type: "odbc config", required: true },
200
288
  query: { value: "" },
201
289
  outputObj: { value: "payload" },
202
- // Nouveaux champs pour le streaming
203
290
  streaming: { value: false },
204
291
  streamChunkSize: { value: 1, validate: RED.validators.number() }
205
292
  },
@@ -216,7 +303,6 @@
216
303
  value: this.query,
217
304
  });
218
305
 
219
- // Logique pour afficher/cacher le champ de taille de lot
220
306
  $("#node-input-streaming").on("change", function() {
221
307
  $(".stream-options").toggle(this.checked);
222
308
  }).trigger("change");
@@ -238,30 +324,23 @@
238
324
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
239
325
  <input type="text" id="node-input-name" />
240
326
  </div>
241
-
242
327
  <div class="form-row">
243
328
  <label for="node-input-connection"><i class="fa fa-cog"></i> Connection</label>
244
329
  <input type="text" id="node-input-connection" />
245
330
  </div>
246
-
247
331
  <div class="form-row node-text-editor-row">
248
332
  <label for="node-input-query" style="width: 100% !important;"><i class="fa fa-search"></i> Query</label>
249
333
  <div style="height: 250px;" class="node-text-editor" id="node-input-query-editor"></div>
250
334
  </div>
251
-
252
335
  <div class="form-row">
253
336
  <label for="node-input-outputObj"><i class="fa fa-edit"></i> Result to</label>
254
337
  <span>msg.</span><input type="text" id="node-input-outputObj" placeholder="payload" style="width: 64%;"/>
255
338
  </div>
256
-
257
339
  <hr/>
258
- <h4><i class="fa fa-sliders"></i> Advanced Options</h4>
259
-
260
340
  <div class="form-row">
261
341
  <label for="node-input-streaming" style="width: auto;"><i class="fa fa-arrows-v"></i> Stream Results</label>
262
342
  <input type="checkbox" id="node-input-streaming" style="display: inline-block; width: auto; vertical-align: top;">
263
343
  </div>
264
-
265
344
  <div class="form-row stream-options">
266
345
  <label for="node-input-streamChunkSize"><i class="fa fa-bars"></i> Chunk Size</label>
267
346
  <input type="number" id="node-input-streamChunkSize" placeholder="1" style="width: 100px;">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bkmj/node-red-contrib-odbcmj",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A powerful Node-RED node to connect to any ODBC data source, with connection pooling, advanced retry logic, and result streaming.",
5
5
  "keywords": [
6
6
  "node-red",