node-red-contrib-mobius-flow-base 2.5.86-beta.62 → 2.5.86-beta.66

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.
@@ -21,14 +21,14 @@ initMobsearch = {
21
21
  // opts.containerName
22
22
  // opts.containerSecondFieldName
23
23
 
24
- if (selectionIndex === undefined) {
24
+ if (typeof selectionIndex === undefined) {
25
25
  let selectionIndex = 0;
26
26
  }
27
27
 
28
- function addMobsearchListButton(field, i) {
28
+ function addMobsearchListButton(field, i, opts) {
29
29
  field.click(function () {
30
30
  selectionIndex = i;
31
- $('#node-input-resources-container-row').hide();
31
+ $(`#${opts.containerRowName}`).hide();
32
32
  $('#instance-search-sid').val('');
33
33
  $('#instance-search-pid').val('');
34
34
  $('#instance-search-ins').val('');
@@ -42,29 +42,31 @@ function addMobsearchListButton(field, i) {
42
42
  function getMobsearch(mobiusSrvc, useRid, listed, opts) {
43
43
  selectionIndex = 0;
44
44
 
45
- if (useRid) {
46
- $(`#${opts.uriFieldName}`).val($(`#${opts.uriFieldName}`).val());
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
+ const uriFieldValue = '';
61
+ if (!listed) {
62
+ uriFieldValue = $(`#${opts.uriFieldName}`).val();
47
63
  }
48
64
 
49
- //level dependent html
50
- let rows =
51
- useRid === true
52
- ? `
53
- <input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
54
- <input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
55
- <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
56
- <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
57
- <input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
58
- `
59
- : `
60
- <input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
61
- <input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
62
- <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
63
- <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
64
- `;
65
+ //set level dependent html
66
+ let rows = useRid === true ? resourceHtml : instanceHtml;
65
67
  let alertMsg = useRid === true ? `and/or RID ` : ``;
66
68
 
67
- //Add new html
69
+ //Inject new html
68
70
  document.getElementById(opts.htmlElementId).innerHTML += `
69
71
  <div id="instance-search-row">
70
72
  <div class="form-row">
@@ -290,40 +292,52 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
290
292
  //Function to update if accept button is grade out and functions based on conditions of fields
291
293
  function acceptCheck() {
292
294
  if (useRid) {
293
- if (
294
- ($('#instance-search-hid').val() !== '' &&
295
- $('#instance-search-sid').val() !== '' &&
296
- $('#instance-search-pid').val() !== '' &&
297
- $('#instance-search-ins').val() !== '' &&
298
- $('#instance-search-rid').val() !== '') ||
299
- $('#instance-search-sid').val() === '#' ||
300
- $('#instance-search-pid').val() === '#' ||
301
- $('#instance-search-ins').val() === '#' ||
302
- $('#instance-search-rid').val() === '#'
303
- ) {
304
- $('#node-search-accept').css('color', '#555555');
305
- readyToAccept = true;
306
- } else {
307
- $('#node-search-accept').css('color', '#CCCCCC');
308
- readyToAccept = false;
309
- }
295
+ checkFieldsToRid();
310
296
  } else {
311
- if (
312
- ($('#instance-search-hid').val() !== '' &&
313
- $('#instance-search-sid').val() !== '' &&
314
- $('#instance-search-pid').val() !== '' &&
315
- $('#instance-search-ins').val() !== '') ||
316
- $('#instance-search-sid').val() === '#' ||
317
- $('#instance-search-pid').val() === '#' ||
318
- $('#instance-search-ins').val() === '#'
319
- ) {
320
- $('#node-search-accept').css('color', '#555555');
321
- readyToAccept = true;
322
- } else {
323
- $('#node-search-accept').css('color', '#CCCCCC');
324
- readyToAccept = false;
325
- }
297
+ checkFieldsToIns();
326
298
  }
299
+ checkWildcards();
300
+ }
301
+
302
+ function checkFieldsToRid() {
303
+ if (
304
+ ($('#instance-search-hid').val() !== '' &&
305
+ $('#instance-search-sid').val() !== '' &&
306
+ $('#instance-search-pid').val() !== '' &&
307
+ $('#instance-search-ins').val() !== '' &&
308
+ $('#instance-search-rid').val() !== '') ||
309
+ $('#instance-search-sid').val() === '#' ||
310
+ $('#instance-search-pid').val() === '#' ||
311
+ $('#instance-search-ins').val() === '#' ||
312
+ $('#instance-search-rid').val() === '#'
313
+ ) {
314
+ $('#node-search-accept').css('color', '#555555');
315
+ readyToAccept = true;
316
+ } else {
317
+ $('#node-search-accept').css('color', '#CCCCCC');
318
+ readyToAccept = false;
319
+ }
320
+ }
321
+
322
+ function checkFieldsToIns() {
323
+ if (
324
+ ($('#instance-search-hid').val() !== '' &&
325
+ $('#instance-search-sid').val() !== '' &&
326
+ $('#instance-search-pid').val() !== '' &&
327
+ $('#instance-search-ins').val() !== '') ||
328
+ $('#instance-search-sid').val() === '#' ||
329
+ $('#instance-search-pid').val() === '#' ||
330
+ $('#instance-search-ins').val() === '#'
331
+ ) {
332
+ $('#node-search-accept').css('color', '#555555');
333
+ readyToAccept = true;
334
+ } else {
335
+ $('#node-search-accept').css('color', '#CCCCCC');
336
+ readyToAccept = false;
337
+ }
338
+ }
339
+
340
+ function checkWildcards() {
327
341
  if (
328
342
  $('#instance-search-sid').val() !== '+' &&
329
343
  $('#instance-search-pid').val() !== '+' &&
@@ -459,4 +473,8 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
459
473
  acceptCheck();
460
474
  });
461
475
  }
476
+
477
+ if (!listed) {
478
+ $(`#${opts.uriFieldName}`).val(uriFieldValue);
479
+ }
462
480
  }
@@ -123,7 +123,7 @@ POSSIBILITY OF SUCH DAMAGE.
123
123
  if (!node.resources[i]) {
124
124
  node.resources[i] = {uri: '', comment: ''}
125
125
  }
126
- addMobsearchListButton(searchField, i)
126
+ addMobsearchListButton(searchField, i, mobsearchOpts)
127
127
  // *** END MOBSEARCH *** //
128
128
  },
129
129
  resizeItem: resizeResource
@@ -136,14 +136,14 @@ POSSIBILITY OF SUCH DAMAGE.
136
136
 
137
137
  // *** MOBSEARCH *** //
138
138
 
139
- opts = {
139
+ mobsearchOpts = {
140
140
  htmlElementId: 'mobsearch',
141
141
  list: node.resources,
142
142
  containerRowName: 'node-input-resources-container-row',
143
143
  containerName: 'node-input-resources-container',
144
144
  containerSecondFieldName: 'node-input-resources-comment',
145
145
  };
146
- initMobsearch.toRid_listed(mobiusSrvc, opts);
146
+ initMobsearch.toRid_listed(mobiusSrvc, mobsearchOpts);
147
147
 
148
148
  // *** END MOBSEARCH *** //
149
149
 
@@ -98,11 +98,18 @@ POSSIBILITY OF SUCH DAMAGE.
98
98
  oneditprepare: function () {
99
99
  var node = this;
100
100
  let mobiusSrvc = $("#node-input-connection").val();
101
+
102
+ console.log('Foo');
103
+ console.log($("#node-input-resource").val());
104
+
101
105
  opts = {
102
106
  htmlElementId: 'mobsearch',
103
107
  uriFieldName: 'node-input-resource'
104
108
  };
105
109
  initMobsearch.toRid(mobiusSrvc, opts);
110
+
111
+ console.log('Bar');
112
+ console.log($("#node-input-resource").val());
106
113
  },
107
114
  oneditsave: function() {
108
115
  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.62",
3
+ "version": "2.5.86-beta.66",
4
4
  "description": "Node-RED base nodes for Mobius Flow",
5
5
  "main": "index.js",
6
6
  "types": "dist/index.d.ts",