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

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 +109 -41
  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,13 @@
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
+ $('.form-section-header').on('click', function() {
36
+ $(this).toggleClass('expanded');
37
+ $(this).next('.form-section-content').slideToggle();
38
+ });
39
+
40
+ // Logique pour le mode de connexion hybride
40
41
  function toggleConnectionMode(mode) {
41
42
  if (mode === 'structured') {
42
43
  $(".config-mode-structured").show();
@@ -46,7 +47,6 @@
46
47
  $(".config-mode-string").show();
47
48
  }
48
49
  }
49
- // Gérer le changement du type de BD pour afficher/cacher le champ driver
50
50
  function toggleDriverField(dbType) {
51
51
  if (dbType === 'other') {
52
52
  $("#node-config-driver-row").show();
@@ -55,7 +55,6 @@
55
55
  }
56
56
  }
57
57
 
58
- // Initialisation de l'UI
59
58
  $("#node-config-input-connectionMode").on("change", function() {
60
59
  toggleConnectionMode($(this).val());
61
60
  }).trigger("change");
@@ -64,37 +63,35 @@
64
63
  toggleDriverField($(this).val());
65
64
  }).trigger("change");
66
65
 
67
-
68
- // Logique pour le 'Syntax Checker'
66
+ // Logiques pour les cases à cocher
69
67
  $("#node-config-input-syntaxtick").on("change", function () {
70
68
  $(".input-syntax").toggle(this.checked);
71
69
  }).trigger("change");
72
70
 
73
-
74
- // Logique pour afficher/masquer les options de retry
75
71
  $("#node-config-input-retryFreshConnection").on("change", function() {
76
72
  $(".retry-options").toggle(this.checked);
77
73
  }).trigger("change");
78
74
 
79
-
80
- // Logique pour le bouton de test de connexion
75
+ // Logique pour le bouton de test
81
76
  $('#node-config-test-connection').on('click', function() {
82
77
  var button = $(this);
83
- var originalText = button.text();
78
+ var originalText = "Test Connection";
84
79
  var icon = button.find("i");
85
80
  icon.removeClass('fa-bolt').addClass('fa-spinner fa-spin');
86
81
  button.text(' Testing...').prop('disabled', true);
87
82
 
88
- // Collecter toutes les données du formulaire
83
+ var connectionMode = $("#node-config-input-connectionMode").val();
84
+
89
85
  var configData = {
90
- connectionMode: $("#node-config-input-connectionMode").val(),
86
+ connectionMode: connectionMode,
91
87
  dbType: $("#node-config-input-dbType").val(),
92
88
  driver: $("#node-config-input-driver").val(),
93
89
  server: $("#node-config-input-server").val(),
94
90
  database: $("#node-config-input-database").val(),
95
91
  user: $("#node-config-input-user").val(),
96
- password: $("#node-config-input-password").val(),
97
- connectionString: $("#node-config-input-connectionString").val()
92
+ connectionString: $("#node-config-input-connectionString").val(),
93
+ // Le mot de passe n'est envoyé que si on est en mode structuré
94
+ password: (connectionMode === 'structured') ? $("#node-config-input-password").val() : null
98
95
  };
99
96
 
100
97
  $.ajax({
@@ -119,6 +116,25 @@
119
116
  });
120
117
  </script>
121
118
 
119
+ <style>
120
+ .form-section-header {
121
+ cursor: pointer;
122
+ padding: 5px;
123
+ border-bottom: 1px solid #ddd;
124
+ margin-bottom: 10px;
125
+ user-select: none;
126
+ }
127
+ .form-section-header i.fa-caret-right {
128
+ transition: transform 0.2s ease-in-out;
129
+ }
130
+ .form-section-header.expanded i.fa-caret-right {
131
+ transform: rotate(90deg);
132
+ }
133
+ .form-section-content {
134
+ padding-left: 20px;
135
+ }
136
+ </style>
137
+
122
138
  <script type="text/html" data-template-name="odbc config">
123
139
  <div class="form-row">
124
140
  <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -168,12 +184,7 @@
168
184
  <div class="config-mode-string">
169
185
  <div class="form-row">
170
186
  <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}}};">
172
- </div>
173
- <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">
176
- <span class="form-tips">Use <code>{{{password}}}</code> placeholder in the string above.</span>
187
+ <input type="text" id="node-config-input-connectionString" placeholder="DRIVER={...};SERVER=...;UID=...;PWD=...;">
177
188
  </div>
178
189
  </div>
179
190
 
@@ -183,23 +194,88 @@
183
194
  </div>
184
195
 
185
196
  <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>
197
+
198
+ <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-sitemap"></i> Pool Options</h4></div>
199
+ <div class="form-section-content" style="display: none;">
200
+ <div class="form-row">
201
+ <label for="node-config-input-initialSize"><i class="fa fa-play"></i> Initial Size</label>
202
+ <input type="number" id="node-config-input-initialSize" placeholder="5" />
203
+ </div>
204
+ <div class="form-row">
205
+ <label for="node-config-input-incrementSize"><i class="fa fa-plus"></i> Increment Size</label>
206
+ <input type="number" id="node-config-input-incrementSize" placeholder="5" />
207
+ </div>
208
+ <div class="form-row">
209
+ <label for="node-config-input-maxSize"><i class="fa fa-stop"></i> Max Size</label>
210
+ <input type="number" id="node-config-input-maxSize" placeholder="15" />
211
+ </div>
212
+ <div class="form-row">
213
+ <label for="node-config-input-shrink"><i class="fa fa-compress"></i> Shrink Pool</label>
214
+ <input type="checkbox" id="node-config-input-shrink" style="margin-left:0px; vertical-align:top; width:auto !important;" />
215
+ </div>
216
+ <div class="form-row">
217
+ <label for="node-config-input-connectionTimeout"><i class="fa fa-clock-o"></i> Connection Timeout</label>
218
+ <input type="number" id="node-config-input-connectionTimeout" placeholder="3" style="width: 80px;"/>
219
+ <span style="margin-left: 5px;">seconds</span>
220
+ </div>
221
+ <div class="form-row">
222
+ <label for="node-config-input-loginTimeout"><i class="fa fa-clock-o"></i> Login Timeout</label>
223
+ <input type="number" id="node-config-input-loginTimeout" placeholder="3" style="width: 80px;" />
224
+ <span style="margin-left: 5px;">seconds</span>
225
+ </div>
226
+ </div>
227
+
228
+ <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-exclamation-triangle"></i> Error Handling & Retry</h4></div>
229
+ <div class="form-section-content" style="display: none;">
230
+ <div class="form-row">
231
+ <label for="node-config-input-retryFreshConnection" style="width: auto;"><i class="fa fa-refresh"></i> Retry with fresh connection</label>
232
+ <input type="checkbox" id="node-config-input-retryFreshConnection" style="display: inline-block; width: auto; vertical-align: top;" />
233
+ </div>
234
+ <div class="retry-options" style="padding-left: 20px;">
235
+ <div class="form-row">
236
+ <label for="node-config-input-retryDelay"><i class="fa fa-history"></i> Retry Delay</label>
237
+ <input type="number" id="node-config-input-retryDelay" placeholder="5" style="width: 80px;" />
238
+ <span style="margin-left: 5px;">seconds</span>
239
+ </div>
240
+ <div class="form-row">
241
+ <label for="node-config-input-retryOnMsg" style="width: auto;"><i class="fa fa-envelope-o"></i> Retry on new message</label>
242
+ <input type="checkbox" id="node-config-input-retryOnMsg" style="display: inline-block; width: auto; vertical-align: top;" />
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-wrench"></i> Advanced</h4></div>
248
+ <div class="form-section-content" style="display: none;">
249
+ <div class="form-row">
250
+ <label for="node-config-input-syntaxtick" style="width: auto;"><i class="fa fa-check-square-o"></i> Syntax Checker</label>
251
+ <input type="checkbox" id="node-config-input-syntaxtick" style="display: inline-block; width: auto; vertical-align: top;" />
252
+ </div>
253
+ <div class="form-row input-syntax">
254
+ <label for="node-config-input-syntax"><i class="fa fa-language"></i> Syntax</label>
255
+ <select id="node-config-input-syntax" style="width: 70%">
256
+ <option value="bigquery">BigQuery</option>
257
+ <option value="db2">DB2</option>
258
+ <option value="hive">Hive</option>
259
+ <option value="mariadb">MariaDB</option>
260
+ <option value="mysql">Mysql</option>
261
+ <option value="postgresql">PostgresQL</option>
262
+ <option value="sqlite">Sqlite</option>
263
+ <option value="transactsql">TransactSQL</option>
264
+ <option value="flinksql">FlinkSQL</option>
265
+ </select>
266
+ </div>
267
+ </div>
268
+ </script>
192
269
 
193
270
  <script type="text/javascript">
194
271
  RED.nodes.registerType("odbc", {
195
- category: "storage-input",
272
+ category: "storage",
196
273
  color: "#89A5C0",
197
274
  defaults: {
198
275
  name: { value: "" },
199
276
  connection: { type: "odbc config", required: true },
200
277
  query: { value: "" },
201
278
  outputObj: { value: "payload" },
202
- // Nouveaux champs pour le streaming
203
279
  streaming: { value: false },
204
280
  streamChunkSize: { value: 1, validate: RED.validators.number() }
205
281
  },
@@ -216,7 +292,6 @@
216
292
  value: this.query,
217
293
  });
218
294
 
219
- // Logique pour afficher/cacher le champ de taille de lot
220
295
  $("#node-input-streaming").on("change", function() {
221
296
  $(".stream-options").toggle(this.checked);
222
297
  }).trigger("change");
@@ -238,30 +313,23 @@
238
313
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
239
314
  <input type="text" id="node-input-name" />
240
315
  </div>
241
-
242
316
  <div class="form-row">
243
317
  <label for="node-input-connection"><i class="fa fa-cog"></i> Connection</label>
244
318
  <input type="text" id="node-input-connection" />
245
319
  </div>
246
-
247
320
  <div class="form-row node-text-editor-row">
248
321
  <label for="node-input-query" style="width: 100% !important;"><i class="fa fa-search"></i> Query</label>
249
322
  <div style="height: 250px;" class="node-text-editor" id="node-input-query-editor"></div>
250
323
  </div>
251
-
252
324
  <div class="form-row">
253
325
  <label for="node-input-outputObj"><i class="fa fa-edit"></i> Result to</label>
254
326
  <span>msg.</span><input type="text" id="node-input-outputObj" placeholder="payload" style="width: 64%;"/>
255
327
  </div>
256
-
257
328
  <hr/>
258
- <h4><i class="fa fa-sliders"></i> Advanced Options</h4>
259
-
260
329
  <div class="form-row">
261
330
  <label for="node-input-streaming" style="width: auto;"><i class="fa fa-arrows-v"></i> Stream Results</label>
262
331
  <input type="checkbox" id="node-input-streaming" style="display: inline-block; width: auto; vertical-align: top;">
263
332
  </div>
264
-
265
333
  <div class="form-row stream-options">
266
334
  <label for="node-input-streamChunkSize"><i class="fa fa-bars"></i> Chunk Size</label>
267
335
  <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.2",
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",