node-red-contrib-mobius-flow-base 2.5.86-beta.60 → 2.5.86-beta.64

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.
@@ -5,43 +5,70 @@ initMobsearch = {
5
5
  toIns: (mobiusSrvc, opts) => {
6
6
  getMobsearch(mobiusSrvc, false, false, opts);
7
7
  },
8
- toRidListed: (mobiusSrvc, opts) => {
8
+ toRid_listed: (mobiusSrvc, opts) => {
9
9
  getMobsearch(mobiusSrvc, true, true, opts);
10
10
  },
11
- toInsListed: (mobiusSrvc, opts) => {
11
+ toIns_listed: (mobiusSrvc, opts) => {
12
12
  getMobsearch(mobiusSrvc, false, true, opts);
13
13
  },
14
14
  };
15
15
 
16
16
  // RID ONLY
17
+ // opts.htmlElementId
17
18
  // opts.uriFieldName
18
19
  // opts.selectionIndex
19
20
  // opts.containerRowName
20
21
  // opts.containerName
21
22
  // opts.containerSecondFieldName
22
23
 
24
+ if (typeof selectionIndex === undefined) {
25
+ let selectionIndex = 0;
26
+ }
27
+
28
+ function addMobsearchListButton(field, i, opts) {
29
+ field.click(function () {
30
+ selectionIndex = i;
31
+ $(`#${opts.containerRowName}`).hide();
32
+ $('#instance-search-sid').val('');
33
+ $('#instance-search-pid').val('');
34
+ $('#instance-search-ins').val('');
35
+ $('#instance-search-rid').val('');
36
+ $('#node-search-return').removeClass('disabled');
37
+ $('#node-search-accept').removeClass('disabled');
38
+ $('#instance-search-row').show();
39
+ });
40
+ }
41
+
23
42
  function getMobsearch(mobiusSrvc, useRid, listed, opts) {
24
- console.log($(`#${opts.uriFieldName}`).val());
25
- //level dependent html
26
- let rows =
27
- useRid === true
28
- ? `
29
- <input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
30
- <input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
31
- <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
32
- <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
33
- <input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
34
- `
35
- : `
36
- <input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
37
- <input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
38
- <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
39
- <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
40
- `;
43
+ selectionIndex = 0;
44
+
45
+ const resourceHtml = `
46
+ <input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
47
+ <input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
48
+ <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
49
+ <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
50
+ <input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
51
+ `;
52
+
53
+ const instanceHtml = `
54
+ <input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
55
+ <input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
56
+ <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
57
+ <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
58
+ `;
59
+
60
+ if (!listed) {
61
+ console.log('lalalal');
62
+ console.log($(`#${opts.uriFieldName}`).val());
63
+ $(`#${opts.uriFieldName}`).val($(`#${opts.uriFieldName}`).val());
64
+ }
65
+
66
+ //set level dependent html
67
+ let rows = useRid === true ? resourceHtml : instanceHtml;
41
68
  let alertMsg = useRid === true ? `and/or RID ` : ``;
42
69
 
43
- //Add new html
44
- document.getElementById('mobsearch').innerHTML += `
70
+ //Inject new html
71
+ document.getElementById(opts.htmlElementId).innerHTML += `
45
72
  <div id="instance-search-row">
46
73
  <div class="form-row">
47
74
  <label for="instance-search-sid"><i class="fa fa-tasks"></i> URI</label>
@@ -249,7 +276,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
249
276
  uri = uri.substring(0, uri.indexOf('#') + 1);
250
277
  }
251
278
  if (listed) {
252
- opts.list[opts.selectionIndex].uri = uri;
279
+ opts.list[selectionIndex].uri = uri;
253
280
  updateList();
254
281
  } else {
255
282
  $(`#${opts.uriFieldName}`).val(uri);
@@ -266,40 +293,52 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
266
293
  //Function to update if accept button is grade out and functions based on conditions of fields
267
294
  function acceptCheck() {
268
295
  if (useRid) {
269
- if (
270
- ($('#instance-search-hid').val() !== '' &&
271
- $('#instance-search-sid').val() !== '' &&
272
- $('#instance-search-pid').val() !== '' &&
273
- $('#instance-search-ins').val() !== '' &&
274
- $('#instance-search-rid').val() !== '') ||
275
- $('#instance-search-sid').val() === '#' ||
276
- $('#instance-search-pid').val() === '#' ||
277
- $('#instance-search-ins').val() === '#' ||
278
- $('#instance-search-rid').val() === '#'
279
- ) {
280
- $('#node-search-accept').css('color', '#555555');
281
- readyToAccept = true;
282
- } else {
283
- $('#node-search-accept').css('color', '#CCCCCC');
284
- readyToAccept = false;
285
- }
296
+ checkFieldsToRid();
286
297
  } else {
287
- if (
288
- ($('#instance-search-hid').val() !== '' &&
289
- $('#instance-search-sid').val() !== '' &&
290
- $('#instance-search-pid').val() !== '' &&
291
- $('#instance-search-ins').val() !== '') ||
292
- $('#instance-search-sid').val() === '#' ||
293
- $('#instance-search-pid').val() === '#' ||
294
- $('#instance-search-ins').val() === '#'
295
- ) {
296
- $('#node-search-accept').css('color', '#555555');
297
- readyToAccept = true;
298
- } else {
299
- $('#node-search-accept').css('color', '#CCCCCC');
300
- readyToAccept = false;
301
- }
298
+ checkFieldsToIns();
302
299
  }
300
+ checkWildcards();
301
+ }
302
+
303
+ function checkFieldsToRid() {
304
+ if (
305
+ ($('#instance-search-hid').val() !== '' &&
306
+ $('#instance-search-sid').val() !== '' &&
307
+ $('#instance-search-pid').val() !== '' &&
308
+ $('#instance-search-ins').val() !== '' &&
309
+ $('#instance-search-rid').val() !== '') ||
310
+ $('#instance-search-sid').val() === '#' ||
311
+ $('#instance-search-pid').val() === '#' ||
312
+ $('#instance-search-ins').val() === '#' ||
313
+ $('#instance-search-rid').val() === '#'
314
+ ) {
315
+ $('#node-search-accept').css('color', '#555555');
316
+ readyToAccept = true;
317
+ } else {
318
+ $('#node-search-accept').css('color', '#CCCCCC');
319
+ readyToAccept = false;
320
+ }
321
+ }
322
+
323
+ function checkFieldsToIns() {
324
+ if (
325
+ ($('#instance-search-hid').val() !== '' &&
326
+ $('#instance-search-sid').val() !== '' &&
327
+ $('#instance-search-pid').val() !== '' &&
328
+ $('#instance-search-ins').val() !== '') ||
329
+ $('#instance-search-sid').val() === '#' ||
330
+ $('#instance-search-pid').val() === '#' ||
331
+ $('#instance-search-ins').val() === '#'
332
+ ) {
333
+ $('#node-search-accept').css('color', '#555555');
334
+ readyToAccept = true;
335
+ } else {
336
+ $('#node-search-accept').css('color', '#CCCCCC');
337
+ readyToAccept = false;
338
+ }
339
+ }
340
+
341
+ function checkWildcards() {
303
342
  if (
304
343
  $('#instance-search-sid').val() !== '+' &&
305
344
  $('#instance-search-pid').val() !== '+' &&
@@ -87,7 +87,6 @@ POSSIBILITY OF SUCH DAMAGE.
87
87
  }
88
88
 
89
89
  let mobiusSrvc = $("#node-input-connection").val();
90
- let globalIndex = 0;
91
90
 
92
91
  /** Create the subs container and populate it */
93
92
  $('#node-input-resources-container').css('min-height', '300px').css('min-width', '450px').editableList ({
@@ -121,23 +120,10 @@ POSSIBILITY OF SUCH DAMAGE.
121
120
  // resizeResource(container);
122
121
 
123
122
  // *** MOBSEARCH *** //
124
-
125
123
  if (!node.resources[i]) {
126
124
  node.resources[i] = {uri: '', comment: ''}
127
125
  }
128
-
129
- searchField.click(function () {
130
- globalIndex = i;
131
- $('#node-input-resources-container-row').hide();
132
- $("#instance-search-sid").val('');
133
- $("#instance-search-pid").val('');
134
- $("#instance-search-ins").val('');
135
- $("#instance-search-rid").val('');
136
- $("#node-search-return").removeClass('disabled');
137
- $("#node-search-accept").removeClass('disabled');
138
- $("#instance-search-row").show();
139
-
140
- });
126
+ addMobsearchListButton(searchField, i, mobsearchOpts)
141
127
  // *** END MOBSEARCH *** //
142
128
  },
143
129
  resizeItem: resizeResource
@@ -150,14 +136,14 @@ POSSIBILITY OF SUCH DAMAGE.
150
136
 
151
137
  // *** MOBSEARCH *** //
152
138
 
153
- opts = {
139
+ mobsearchOpts = {
140
+ htmlElementId: 'mobsearch',
154
141
  list: node.resources,
155
- selectionIndex: globalIndex,
156
142
  containerRowName: 'node-input-resources-container-row',
157
143
  containerName: 'node-input-resources-container',
158
144
  containerSecondFieldName: 'node-input-resources-comment',
159
145
  };
160
- initMobsearch.toRidListed(mobiusSrvc, opts);
146
+ initMobsearch.toRid_listed(mobiusSrvc, mobsearchOpts);
161
147
 
162
148
  // *** END MOBSEARCH *** //
163
149
 
@@ -107,6 +107,7 @@ POSSIBILITY OF SUCH DAMAGE.
107
107
  let mobiusSrvc = $("#node-input-connection").val();
108
108
 
109
109
  opts = {
110
+ htmlElementId: 'mobsearch',
110
111
  uriFieldName: 'node-input-instance '
111
112
  };
112
113
  initMobsearch.toIns(mobiusSrvc, opts);
@@ -99,9 +99,13 @@ POSSIBILITY OF SUCH DAMAGE.
99
99
  var node = this;
100
100
  let mobiusSrvc = $("#node-input-connection").val();
101
101
  opts = {
102
+ htmlElementId: 'mobsearch',
102
103
  uriFieldName: 'node-input-resource'
103
104
  };
104
105
  initMobsearch.toRid(mobiusSrvc, opts);
106
+
107
+ console.log('Foo Bar');
108
+ console.log($("#node-input-resource").val());
105
109
  },
106
110
  oneditsave: function() {
107
111
  if($("#node-input-detailedOutput").prop('checked')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-mobius-flow-base",
3
- "version": "2.5.86-beta.60",
3
+ "version": "2.5.86-beta.64",
4
4
  "description": "Node-RED base nodes for Mobius Flow",
5
5
  "main": "index.js",
6
6
  "types": "dist/index.d.ts",