node-red-trexmes-commands 0.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.
@@ -0,0 +1,388 @@
1
+ <style>
2
+ .trexmes-cmd-form-row>label {
3
+ width: 125px !important;
4
+ }
5
+ .trexmes-cmd-form-row>select {
6
+ width: 70% !important;
7
+ }
8
+ div.form-row.trexmes-cmd-form-row > input[type="checkbox"]{
9
+ width: unset;
10
+ margin-top: -2px;
11
+ }
12
+
13
+ div.form-row.trexmes-cmd-form-row > .form-tips {
14
+ width: calc(100% - 35px);
15
+ }
16
+
17
+ .trexmes-cmd-row-item {
18
+ margin: 2px 4px 2px 2px;
19
+ }
20
+
21
+ .trexmes-cmd-row {
22
+ flex-wrap: wrap;
23
+ }
24
+ .trexmes-cmd-hide-row {
25
+ display: none !important;
26
+ }
27
+
28
+ div.form-row.trexmes-cmd-form-row > .form-tips {
29
+ width: calc(100% - 35px);
30
+ }
31
+
32
+ .trexmes-cmd-row-item {
33
+ /* margin: 2px 4px 2px 2px; */
34
+ margin: 0px 4px 0px 2px;
35
+ }
36
+
37
+ .trexmes-cmd-row {
38
+ flex-wrap: wrap;
39
+ }
40
+
41
+ ol .trexmes-cmd-row > .trexmes-cmd-row-item input[type="checkbox"] {
42
+ width: 15px;
43
+ margin-left: 4px;
44
+ margin-top: -1px;
45
+ margin-right: 20px;
46
+ }
47
+ ol .trexmes-cmd-row > .trexmes-cmd-row-item label {
48
+ margin-top: 2px;
49
+ margin-bottom: 0px;
50
+ }
51
+
52
+
53
+ </style>
54
+
55
+
56
+ <script type="text/html" data-template-name="trexMes-CN">
57
+ <div class="form-row trexmes-cmd-form-row">
58
+ <label for="node-config-input-name" ><i class="fa fa-tag"></i><span data-i18n="trexMes-CMD.connection.label.name"></span></label>
59
+ <input type="text" id="node-config-input-name" data-i18n="[placeholder]trexMes-CMD.connection.label.name_ph">
60
+ </div>
61
+ <div class="form-row trexmes-cmd-form-row">
62
+ <label for="node-config-input-server"><i class="fa fa-server"></i> <span data-i18n="trexMes-CMD.connection.label.server"></span></label>
63
+ <input type="text" id="node-config-input-server" data-i18n="[placeholder]trexMes-CMD.connection.label.server_ph">
64
+ </div>
65
+ <div class="form-row trexmes-cmd-form-row">
66
+ <label for="node-config-input-port"><i class="fa fa-random"></i> <span data-i18n="trexMes-CMD.connection.label.port"></span></label>
67
+ <input type="text" id="node-config-input-port" data-i18n="[placeholder]trexMes-CMD.connection.label.port">
68
+ </div>
69
+ <div class="form-row trexmes-cmd-form-row">
70
+ <label for="node-config-input-username"><i class="fa fa-user"></i> <span data-i18n="trexMes-CMD.connection.label.username"></span></label>
71
+ <input type="text" id="node-config-input-username">
72
+ </div>
73
+ <div class="form-row trexmes-cmd-form-row">
74
+ <label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="trexMes-CMD.connection.label.password"></label>
75
+ <input type="password" id="node-config-input-password">
76
+ </div>
77
+ <div class="form-row trexmes-cmd-form-row">
78
+ <label for="node-config-input-domain"><i class="fa fa-user"></i> <span data-i18n="trexMes-CMD.connection.label.domain"></label>
79
+ <input type="text" id="node-config-input-domain">
80
+ </div>
81
+ <div class="form-row trexmes-cmd-form-row">
82
+ <label for="node-config-input-database"><i class="fa fa-database"></i> <span data-i18n="trexMes-CMD.connection.label.database"></label>
83
+ <input type="text" id="node-config-input-database">
84
+ </div>
85
+ <div class="form-row trexmes-cmd-form-row">
86
+ <label for="node-config-input-companyId"><i class="fa fa-building"></i> <span data-i18n="trexMes-CMD.connection.label.companyId"></label>
87
+ <input type="text" id="node-config-input-companyId">
88
+ </div>
89
+ <div class="form-row trexmes-cmd-form-row">
90
+ <label for="node-config-input-userId"><i class="fa fa-user-md"></i> <span data-i18n="trexMes-CMD.connection.label.userId"></label>
91
+ <input type="text" id="node-config-input-userId">
92
+ </div>
93
+ <div class="form-row trexmes-cmd-form-row">
94
+ <label for="node-config-input-tdsVersion"><i class="fa fa-list"></i> <span data-i18n="trexMes-CMD.connection.label.tds.title"></label>
95
+ <select id="node-config-input-tdsVersion">
96
+ <option value="7_4" data-i18n="trexMes-CMD.connection.label.tds.v7_4"></option>
97
+ <option value="7_3_B" data-i18n="trexMes-CMD.connection.label.tds.v7_3_b"></option>
98
+ <option value="7_3_A" data-i18n="trexMes-CMD.connection.label.tds.v7_3_a"></option>
99
+ <option value="7_2" data-i18n="trexMes-CMD.connection.label.tds.v7_2"></option>
100
+ <option value="7_1" data-i18n="trexMes-CMD.connection.label.tds.v7_1"></option>
101
+ </select>
102
+ </div>
103
+ <div class="form-row trexmes-cmd-form-row">
104
+ <label for="node-config-input-encyption"><i class="fa fa-lock"></i> <span data-i18n="trexMes-CMD.connection.label.encryption"></label>
105
+ <input type="checkbox" id="node-config-input-encyption">
106
+ <div class="form-tips" data-i18n="trexMes-CMD.connection.label.encryption_tip"></div>
107
+ </div>
108
+ <div class="form-row trexmes-cmd-form-row">
109
+ <label for="node-config-input-trustServerCertificate"><i class="fa fa-lock"></i> Trust Certificate?</label>
110
+ <input type="checkbox" id="node-config-input-trustServerCertificate">
111
+ <div class="form-tips">If unchecked, SQL Server will try to validate the server SSL certificate and will terminate the connection if validation fails</div>
112
+ </div>
113
+ <div class="form-row trexmes-cmd-form-row">
114
+ <label for="node-config-input-useUTC"><i class="fa fa-clock-o"></i> <span data-i18n="trexMes-CMD.connection.label.utc"></label>
115
+ <input type="checkbox" id="node-config-input-useUTC">
116
+ <div class="form-tips" data-i18n="trexMes-CMD.connection.label.utc_tip"></div>
117
+ </div>
118
+ <div class="form-row trexmes-cmd-form-row">
119
+ <label for="node-config-input-connectTimeout"><i class="fa fa-clock-o"></i> <span data-i18n="trexMes-CMD.connection.label.connect_timeout"></label>
120
+ <input type="text" id="node-config-input-connectTimeout">
121
+ <div class="form-tips" data-i18n="trexMes-CMD.connection.label.connect_timeout_tip"></div>
122
+ </div>
123
+ <div class="form-row trexmes-cmd-form-row">
124
+ <label for="node-config-input-requestTimeout"><i class="fa fa-clock-o"></i> <span data-i18n="trexMes-CMD.connection.label.request_timeout"></label>
125
+ <input type="text" id="node-config-input-requestTimeout">
126
+ <div class="form-tips" data-i18n="trexMes-CMD.connection.label.request_timeout_tip"></div>
127
+ </div>
128
+ <div class="form-row trexmes-cmd-form-row">
129
+ <label for="node-config-input-cancelTimeout"><i class="fa fa-clock-o"></i> <span data-i18n="trexMes-CMD.connection.label.cancel_timeout"></label>
130
+ <input type="text" id="node-config-input-cancelTimeout">
131
+ <div class="form-tips"data-i18n="trexMes-CMD.connection.label.cancel_timeout_tip"></div>
132
+ </div>
133
+ <div class="form-row trexmes-cmd-form-row">
134
+ <label for="node-config-input-pool"><i class="icon-bookmark"></i> <span data-i18n="trexMes-CMD.connection.label.max_pool_size"></label>
135
+ <input type="text" id="node-config-input-pool" data-i18n="[placeholder]trexMes-CMD.connection.label.max_pool_size">
136
+ </div>
137
+ <div class="form-row trexmes-cmd-form-row">
138
+ <label for="node-config-input-parseJSON"><i class="fa fa-file-o"></i> <span data-i18n="trexMes-CMD.connection.label.parse_json"></label>
139
+ <input type="checkbox" id="node-config-input-parseJSON">
140
+ </div>
141
+ <div class="form-row trexmes-cmd-form-row">
142
+ <label for="node-config-input-enableArithAbort" data-i18n="[title]trexMes-CMD.connection.label.arith_abort_tooltip"><i class="fa fa-times"></i> <span data-i18n="trexMes-CMD.connection.label.arith_abort"></label>
143
+ <input type="checkbox" id="node-config-input-enableArithAbort" checked data-i18n="[title]trexMes-CMD.connection.label.arith_abort_tooltip">
144
+ </div>
145
+ <div class="form-row trexmes-cmd-form-row">
146
+ <label for="node-config-input-readOnlyIntent"><i class="fa fa-square-o"></i> <span data-i18n="trexMes-CMD.connection.label.read_only_intent"></label>
147
+ <input type="checkbox" id="node-config-input-readOnlyIntent">
148
+ </div>
149
+ </script>
150
+
151
+ <script type="text/javascript">
152
+ RED.nodes.registerType('trexMes-CN', {
153
+ category: 'config',
154
+ color: '#C0DEED',
155
+ defaults: {
156
+ tdsVersion: {
157
+ value: '7_4'
158
+ },
159
+ name: {
160
+ value: ''
161
+ },
162
+ server: {
163
+ value: '',
164
+ required: true
165
+ },
166
+ port: {
167
+ value: '1433'
168
+ },
169
+ encyption: {
170
+ value: true
171
+ },
172
+ trustServerCertificate: {
173
+ value: true
174
+ },
175
+ database: {
176
+ value: '',
177
+ required: false // database can be left blank but user should use full name in queries or a USE DB statment
178
+ },
179
+ companyId: {
180
+ value: 0,
181
+ required: true
182
+ },
183
+ userId: {
184
+ value: 0,
185
+ required: true
186
+ },
187
+ useUTC: {
188
+ value: true
189
+ },
190
+ connectTimeout: {
191
+ value: '15000'
192
+ },
193
+ requestTimeout: {
194
+ value: '15000'
195
+ },
196
+ cancelTimeout: {
197
+ value: '5000'
198
+ },
199
+ pool: {
200
+ value: '5'
201
+ },
202
+ parseJSON: {
203
+ value: false
204
+ },
205
+ enableArithAbort: {
206
+ value: true
207
+ },
208
+ readOnlyIntent: {
209
+ value: false
210
+ }
211
+ },
212
+ inputs: 0,
213
+ outputs: 0,
214
+ credentials: {
215
+ username: {
216
+ type: 'text'
217
+ },
218
+ password: {
219
+ type: 'password'
220
+ },
221
+ domain: {
222
+ type: 'text'
223
+ }
224
+ },
225
+ label: function () {
226
+ if (this.name) {
227
+ return this.name;
228
+ }
229
+ let n = 'trexMes-CN';
230
+ if (this.server) {
231
+ n = this.server;
232
+ if (this.database) {
233
+ n += '.' + this.database;
234
+ }
235
+ }
236
+ return n;
237
+ },
238
+ oneditresize: function (size) {
239
+ $('div.form-row.trexmes-cmd-form-row > .form-tips').css('maxWidth', 'unset');
240
+ }
241
+ });
242
+ </script>
243
+
244
+
245
+ <script type="text/html" data-template-name="trexMes-CMD">
246
+
247
+ <div class="form-row trexmes-cmd-form-row">
248
+ <label for="node-input-trexmesCN"><i class="fa fa-globe"></i> <span data-i18n="trexMes-CMD.node.label.connection"></label>
249
+ <input type="text" id="node-input-trexmesCN">
250
+ </div>
251
+
252
+ <div class="form-row trexmes-cmd-form-row">
253
+ <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="trexMes-CMD.node.label.name"></span></label>
254
+ <input type="text" id="node-input-name" data-i18n="[placeholder]trexMes-CMD.node.label.name">
255
+ </div>
256
+
257
+
258
+ <div class="form-row trexmes-cmd-form-row">
259
+ <label for="node-input-data"><i class="fa fa-list-ul"></i> <span data-i18n="trexMes-CMD.node.label.query_mode"></span></label>
260
+ <input type="hidden" id="node-input-modeOptType">
261
+ <input type="text" id="node-input-modeOpt" style="width: 70%" data-i18n="[placeholder]trexMes-CMD.node.label.query_mode">
262
+ </div>
263
+
264
+ <div class="form-row trexmes-cmd-form-row node-text-editor-row" style="min-height: 60px; margin-top: -6px;">
265
+ <label for="node-json-param-editor" style="width: 100% !important;"><i class="fa fa-tag"></i> <span data-i18n="trexMes-CMD.node.label.editor"></span></label>
266
+ <div style="height: 60px;" class="node-text-editor" id="node-json-param-editor" ></div>
267
+ </div>
268
+
269
+ <div class="form-row trexmes-cmd-form-row">
270
+ <label for="node-input-throwErrors"><i class="fa fa-exclamation"></i> <span data-i18n="trexMes-CMD.node.label.error_handling"></label>
271
+ <select id="node-input-throwErrors" style="width: 70%">
272
+ <option value="0" data-i18n="trexMes-CMD.node.label.error_handling_send_in_msg"></option>
273
+ <option value="1" data-i18n="trexMes-CMD.node.label.error_handling_throw"></option>
274
+ </select>
275
+ </div>
276
+
277
+ </script>
278
+
279
+ <script type="text/javascript">
280
+ /* eslint-disable spaced-comment */
281
+ /* eslint-disable space-before-function-paren */
282
+ (function() {
283
+
284
+ RED.nodes.registerType('trexMes-CMD', {
285
+ category: 'trexmes',
286
+ color: '#3FADB5',
287
+ defaults: {
288
+ trexmesCN: {
289
+ type: 'trexMes-CN'
290
+ },
291
+ name: {
292
+ value: ''
293
+ },
294
+ throwErrors: {
295
+ value: 1 //0=original (for compatibility), 1=throw errors for catch node
296
+ },
297
+ query: {
298
+ value: ''
299
+ },
300
+ modeOptType: {
301
+ value: '1|Load Job Plan'
302
+ }
303
+ },
304
+ inputs: 1,
305
+ outputs: 1,
306
+ icon: "trex.png",
307
+ label: function () {
308
+ let optType = undefined;
309
+ let splitted = this.modeOptType.split('|');
310
+ if(splitted.length > 1) {
311
+ optType = splitted[1];
312
+ }
313
+ return (this.name || optType) || 'TrexMes-CMD';
314
+ },
315
+ labelStyle: function () {
316
+ return this.name ? 'node_label_italic' : '';
317
+ },
318
+ oneditprepare: function () {
319
+ const node = this;
320
+
321
+ if (node.query.trim().length === 0) {
322
+ node.query = '{ "WorkstationId": 10 , "PlanId": 123 }';
323
+ node.query = JSON.stringify(JSON.parse(node.query),null, 2);
324
+ }
325
+ //create the query editor
326
+ this.editor = RED.editor.createEditor({
327
+ id: 'node-json-param-editor',
328
+ mode: 'ace/mode/json',
329
+ value: node.query, // $("#node-input-query").val()
330
+ readOnly: true
331
+ });
332
+ //create typedInput widgets
333
+ const modeField = $('#node-input-modeOpt').typedInput({
334
+ types: [
335
+ { value: '1|Load Job Plan', label: 'Load Job Plan', hasValue: false },
336
+ { value: '2|Change Job Plan', label: 'Change Job Plan', hasValue: false },
337
+ { value: '3|Save Production', label: 'Save Production', hasValue: false }
338
+ ],
339
+ typeField: $('#node-input-modeOptType'),
340
+ default: 'Load Job Plan'
341
+ });
342
+
343
+ //show/hide rows field depending on query type
344
+ modeField.on('change', function() {
345
+ const operationMode = $(this).typedInput('type');
346
+
347
+ let data = '{}';
348
+ if(operationMode.startsWith('1|')) {
349
+ data = '{ "WorkstationId": 10 , "PlanId": 123 }';
350
+ }
351
+ else if(operationMode.startsWith('2|')) {
352
+ data = '{"deneme": "123"}';
353
+ }
354
+ node.editor.setValue(JSON.stringify(JSON.parse(data),null, 2));
355
+
356
+ });
357
+
358
+
359
+ $('#node-input-returnType')[0].selectedIndex = this.returnType ? this.returnType : 0;
360
+ $('#node-input-throwErrors')[0].selectedIndex = this.throwErrors ? this.throwErrors : 0;
361
+
362
+
363
+ },
364
+ oneditsave: function () {
365
+ const node = this;
366
+ node.query = this.editor.getValue();
367
+ this.editor.destroy();
368
+ },
369
+ oneditresize: function (size) {
370
+
371
+ const rows = $('#dialog-form>div:not(.node-text-editor-row)');
372
+ let height = $('#dialog-form').height();
373
+ let row;
374
+ for (let i = 0; i < rows.size(); i++) {
375
+ row = $(rows[i]);
376
+ if (row && row.is(':hidden')) continue;
377
+ height -= row.outerHeight(true);
378
+ }
379
+ const editorRow = $('#dialog-form>div.node-text-editor-row');
380
+ height -= (parseInt(editorRow.css('marginTop')) + parseInt(editorRow.css('marginBottom')));
381
+ const h = Math.max(height, 60);
382
+ $('.node-text-editor').css('height', h + 'px');
383
+ this.editor.resize();
384
+
385
+ }
386
+ });
387
+ })();
388
+ </script>