node-red-contrib-mobius-flow-base 2.5.86-beta.61 → 2.5.86-beta.65

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