node-red-contrib-mobius-flow-base 2.5.86-beta.5 → 2.5.86-beta.53

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.
@@ -41,10 +41,29 @@ POSSIBILITY OF SUCH DAMAGE.
41
41
  <option value="object">Object - Resource PVs, URIs and Names</option>
42
42
  </select>
43
43
  </div>
44
- <div class="form-row node-input-resources-container-row">
44
+ <div id="node-input-resources-container-row" class="form-row node-input-resources-container-row">
45
45
  <label for="node-input-resources-container"><i class="fa fa-bars"></i> Resources</label>
46
46
  <ol id="node-input-resources-container"></ol>
47
47
  </div>
48
+
49
+ <div id="instance-search-row">
50
+ <div class="form-row">
51
+ <label for="instance-search-sid"><i class="fa fa-search"></i> Search</label>
52
+ <input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
53
+ <input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
54
+ <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
55
+ <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
56
+ <input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
57
+ <a id="node-search-return" class="searchbutton" style="vertical-align: middle"><i id="node-search-return-icon" class="fa fa-arrow-left"></i></a>
58
+ <a id="node-search-accept" class="searchbutton" style="vertical-align: middle; color: #CCCCCC"><i id="node-search-accept-icon" class="fa fa-check"></i></a>
59
+ </div>
60
+ </div>
61
+ <div id="wildcard-alert-row" class="form-row hidden" style="color:#555555" align="center">
62
+ <p>Please note: The selection of wildcard '+'
63
+ means a search for a specific instance or resource
64
+ cannot be performed. As such, enter the
65
+ INS and/or RID manually.</p>
66
+ </div>
48
67
  </script>
49
68
 
50
69
  <script type="text/javascript">
@@ -82,6 +101,266 @@ POSSIBILITY OF SUCH DAMAGE.
82
101
  resource.find(".node-input-resource-comment").width(newWidth - 270);
83
102
  }
84
103
 
104
+ let mobiusSrvc = $("#node-input-connection").val();
105
+
106
+ // *** MOBSEARCH *** //
107
+
108
+ $("#instance-search-row").hide();
109
+ $("#wildcard-alert-row").hide();
110
+ $("#node-search-return").addClass('disabled');
111
+ $.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
112
+ $("#instance-search-hid").val(response);
113
+ })
114
+
115
+ let globalSubscriptionIndex = 0;
116
+
117
+ let searchObject = {
118
+ hid: '',
119
+ sid: '',
120
+ pid: '',
121
+ ins: '',
122
+ rid: '',
123
+ objects: []
124
+ }
125
+
126
+ //Function to search for RIDs
127
+ function ridSearch (objects, ins) {
128
+ $.getJSON(`mdiscover?mobius=${mobiusSrvc}&uri=${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`, (response) => {
129
+ resList = response.value[0].resources
130
+ ress = ['#'];
131
+ for (let j = 0; j < resList.length; j++) {
132
+ ress.push(`${resList[j].rid} - ${resList[j].name}`)
133
+ }
134
+ $("#instance-search-rid").autocomplete({
135
+ source: ress,
136
+ minLength: 0,
137
+ close: function (event, ui) {
138
+ acceptCheck();
139
+ $("#instance-search-rid").autocomplete('destroy');
140
+ $("#instance-search-rid").val($("#instance-search-rid").val().substring(0, 2));
141
+ searchObject.rid = $("#instance-search-rid").val();
142
+ }
143
+ }).autocomplete('search', '');
144
+ })
145
+ }
146
+
147
+ //Function to search for INSs
148
+ function insSearch (objects, pid) {
149
+ let inss = ['#', '+'];
150
+ for (let i = 0; i < objects.length; i++) {
151
+ if (objects[i].pid === pid) {
152
+ const name = objects[i].resources[1].pv;
153
+ if (name === '') {
154
+ inss.push(objects[i].ins);
155
+ } else {
156
+ inss.push(`${objects[i].ins} - ${name}`);
157
+ }
158
+ }
159
+ }
160
+ $("#instance-search-ins").autocomplete({
161
+ source: inss,
162
+ minLength: 0,
163
+ close: function (event, ui) {
164
+ acceptCheck();
165
+ $("#instance-search-ins").autocomplete('destroy');
166
+ if ($("#instance-search-ins").val().length > 4) {
167
+ $("#instance-search-ins").val($("#instance-search-ins").val().substring(0, 4))
168
+ }
169
+ searchObject.ins = $("#instance-search-ins").val();
170
+ }
171
+ }).autocomplete('search', '');
172
+ }
173
+
174
+ //Function to search for PIDs
175
+ function pidsSearch(objects) {
176
+ searchObject.objects = objects;
177
+ let pids = ['#', '+'];
178
+ for (let i = 0; i < objects.length; i++) {
179
+ pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
180
+ }
181
+ pids = [...new Set(pids)];
182
+ $("#instance-search-pid").autocomplete({
183
+ source: pids,
184
+ minLength: 0,
185
+ close: function (event, ui) {
186
+ acceptCheck();
187
+ $("#instance-search-pid").autocomplete('destroy');
188
+ if ($("#instance-search-pid").val().length > 4) {
189
+ $("#instance-search-pid").val($("#instance-search-pid").val().substring(0, 4))
190
+ }
191
+ searchObject.pid = $("#instance-search-pid").val();
192
+ }
193
+ }).autocomplete('search', '');
194
+ }
195
+
196
+ //Function to search for SIDs, and then fetch child objects based on selection
197
+ function serviceSearch(response) {
198
+ let services = ['#', '+'];
199
+ for (let i = 0; i < response.length; i++) {
200
+ if (response[i].sid !== '009') {
201
+ services.push(`${response[i].sid} - ${response[i].name}`);
202
+ }
203
+ }
204
+ $("#instance-search-sid").autocomplete({
205
+ source: services,
206
+ minLength: 0,
207
+ close: function (event, ui) {
208
+ acceptCheck();
209
+ $("#instance-search-sid").autocomplete('destroy');
210
+ if ($("#instance-search-sid").val().length > 3) {
211
+ $("#instance-search-sid").val($("#instance-search-sid").val().substring(0, 3))
212
+ }
213
+ searchObject.sid = $("#instance-search-sid").val();
214
+ if (searchObject.sid === '+') {
215
+ for (let i = 2; i < services.length; i++) {
216
+ $.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[i].substring(0, 3)}`, (objects) => {
217
+ searchObject.objects = searchObject.objects.concat(objects);
218
+ })
219
+ }
220
+ } else {
221
+ $.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`, (objects) => {
222
+ searchObject.objects = objects;
223
+ })
224
+ }
225
+ }
226
+ }).autocomplete('search', '');
227
+ }
228
+
229
+ //Start a new search
230
+ function startSearch() {
231
+ $("#wildcard-alert-row").hide();
232
+ $("#instance-search-sid").val('');
233
+ $("#instance-search-pid").val('');
234
+ $("#instance-search-ins").val('');
235
+ searchObject.hid = $("#instance-search-hid").val()
236
+ searchObject.sid = '';
237
+ searchObject.pid = '';
238
+ searchObject.ins = '';
239
+ if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
240
+ $.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch)
241
+ .fail((err) => {
242
+ console.log('Some kind of html failure message on service discovery');
243
+ });
244
+ }
245
+ }
246
+
247
+ //Finish a search
248
+ function finishSearch() {
249
+ $("#wildcard-alert-row").hide();
250
+ let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}/${searchObject.rid}`
251
+ if (uri.includes('#')) {
252
+ uri = uri.substring(0,uri.indexOf('#') + 1)
253
+ }
254
+ node.resources[globalSubscriptionIndex].uri = uri;
255
+ updateList()
256
+ $("#node-search-accept").css('color', '#CCCCCC');
257
+ readyToAccept = false;
258
+ $("#node-search-return").addClass('disabled');
259
+ $("#node-search-accept").addClass('disabled');
260
+ $("#node-lookup-instance").removeClass('disabled');
261
+ $("#instance-search-row").hide();
262
+ $('#node-input-resources-container-row').show();
263
+ }
264
+
265
+ //Function to update if accept button is grade out and functions based on conditions of fields
266
+ function acceptCheck() {
267
+ if (($("#instance-search-hid").val() !== '' && $("#instance-search-sid").val() !== '' && $("#instance-search-pid").val() !== '' && $("#instance-search-ins").val() !== '' && $("#instance-search-rid").val() !== '') ||
268
+ $("#instance-search-sid").val() === '#' || $("#instance-search-pid").val() === '#' || $("#instance-search-ins").val() === '#' || $("#instance-search-rid").val() === '#') {
269
+ $("#node-search-accept").css('color', '#555555');
270
+ readyToAccept = true;
271
+ } else {
272
+ $("#node-search-accept").css('color', '#CCCCCC');
273
+ readyToAccept = false;
274
+ }
275
+ if ($("#instance-search-sid").val() !== '+' && $("#instance-search-pid").val() !== '+' && $("#instance-search-ins").val() !== '+') {
276
+ $("#wildcard-alert-row").hide();
277
+ } else {
278
+ $("#wildcard-alert-row").show();
279
+ }
280
+ }
281
+
282
+ // Respond to clicks
283
+ $("#node-lookup-instance").click(function () { //When search button is clicked
284
+ $("#instance-search-sid").val('');
285
+ $("#instance-search-pid").val('');
286
+ $("#instance-search-ins").val('');
287
+ $("#instance-search-rid").val('');
288
+ $("#node-lookup-instance").addClass('disabled');
289
+ $("#node-search-return").removeClass('disabled');
290
+ $("#node-search-accept").removeClass('disabled');
291
+ $("#instance-row").hide();
292
+ $("#instance-search-row").show();
293
+ });
294
+ $("#instance-search-sid").click(function () { //SID field clicked
295
+ $("#instance-search-pid").val('')
296
+ $("#instance-search-ins").val('')
297
+ searchObject.pid = '';
298
+ searchObject.ins = '';
299
+ searchObject.rid = '';
300
+ searchObject.objects = [];
301
+ startSearch();
302
+ })
303
+ $("#instance-search-pid").click(function () { //PID field clicked
304
+ $("#instance-search-ins").val('')
305
+ $("#instance-search-rid").val('')
306
+ searchObject.ins = '';
307
+ searchObject.rid = '';
308
+ if (searchObject.sid !== '') {
309
+ pidsSearch(searchObject.objects);
310
+ }
311
+ })
312
+ $("#instance-search-ins").click(function () { //INS field clicked
313
+ $("#instance-search-rid").val('')
314
+ searchObject.rid = '';
315
+ if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
316
+ insSearch(searchObject.objects, searchObject.pid);
317
+ }
318
+ })
319
+ $("#instance-search-rid").click(function () { //RID clicked
320
+ if (searchObject.ins !== '' && searchObject.ins !== '+' && searchObject.pid !== '+' && searchObject.sid !== '+') {
321
+ ridSearch(searchObject.objects, searchObject.ins);
322
+ }
323
+ });
324
+ $("#node-search-return").click(function () { //Return/Back button clicked
325
+ $("#node-search-return").addClass('disabled');
326
+ $("#node-search-accept").addClass('disabled');
327
+ $("#node-lookup-instance").removeClass('disabled');
328
+ $("#instance-search-row").hide();
329
+ $("#instance-row").show();
330
+ });
331
+ $("#node-search-accept").click(function () { //Accept button clicked
332
+ if (readyToAccept) {
333
+ finishSearch();
334
+ }
335
+ });
336
+
337
+ // Respond to search field changes
338
+ $("#instance-search-hid").change(function () {
339
+ acceptCheck();
340
+ $("#instance-search-sid").val('');
341
+ $("#instance-search-pid").val('');
342
+ $("#instance-search-ins").val('');
343
+ $("#instance-search-rid").val('');
344
+ });
345
+ $("#instance-search-sid").change(function () {
346
+ searchObject.sid = $("#instance-search-sid").val()
347
+ acceptCheck();
348
+ });
349
+ $("#instance-search-pid").change(function () {
350
+ searchObject.pid = $("#instance-search-pid").val()
351
+ acceptCheck();
352
+ });
353
+ $("#instance-search-ins").change(function () {
354
+ searchObject.ins = $("#instance-search-ins").val()
355
+ acceptCheck();
356
+ });
357
+ $("#instance-search-rid").change(function () {
358
+ searchObject.rid = $("#instance-search-rid").val()
359
+ acceptCheck();
360
+ });
361
+
362
+ // *** END MOBSEARCH *** //
363
+
85
364
  /** Create the subs container and populate it */
86
365
  $('#node-input-resources-container').css('min-height', '300px').css('min-width', '450px').editableList ({
87
366
  addButton: "add",
@@ -99,14 +378,39 @@ POSSIBILITY OF SUCH DAMAGE.
99
378
  }
100
379
 
101
380
  var row = $('<div>URI</div>').appendTo(container);
102
- var uriField = $('<input/>',{class: "node-input-resource-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
381
+ var uriField = $('<input/>',{class: "node-input-resource-uri", type: "text", style: "width: 190px; margin-left: 5px; text-align: left;"}).appendTo(row);
382
+
383
+ // *** MOBSEARCH *** //
384
+ var searchField = $('<a class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
385
+ // *** END MOBSEARCH *** //
386
+
103
387
  row.append('&nbsp;&nbsp;-&nbsp;');
104
- var commentField = $('<input/>',{class: "node-input-resource-comment", type: "text", style: "margin-left: 5px; text-align: left;"}).appendTo(row);
388
+ var commentField = $('<input/>',{class: "node-input-resource-comment", type: "text", style: "width: 110px; margin-left: 5px; text-align: left;"}).appendTo(row);
105
389
 
106
390
  // Populate the new stat
107
391
  uriField.val(resource.uri);
108
392
  commentField.val(resource.comment);
109
- resizeResource(container);
393
+ // resizeResource(container);
394
+
395
+ // *** MOBSEARCH *** //
396
+
397
+ if (!node.resources[i]) {
398
+ node.resources[i] = {uri: '', comment: ''}
399
+ }
400
+
401
+ searchField.click(function () {
402
+ globalSubscriptionIndex = i;
403
+ $('#node-input-resources-container-row').hide();
404
+ $("#instance-search-sid").val('');
405
+ $("#instance-search-pid").val('');
406
+ $("#instance-search-ins").val('');
407
+ $("#instance-search-rid").val('');
408
+ $("#node-search-return").removeClass('disabled');
409
+ $("#node-search-accept").removeClass('disabled');
410
+ $("#instance-search-row").show();
411
+
412
+ });
413
+ // *** END MOBSEARCH *** //
110
414
  },
111
415
  resizeItem: resizeResource
112
416
  });
@@ -115,19 +419,36 @@ POSSIBILITY OF SUCH DAMAGE.
115
419
  if (!node.resources) {
116
420
  node.resources = [resource = {uri: '', comment: ''}];
117
421
  }
118
- // Populate list with all saved filters
422
+
423
+ // *** MOBSEARCH *** //
424
+
425
+ function updateList() {
426
+ $("#node-input-resources-container").editableList('items').each(function (i) {
427
+ let resource = $(this);
428
+ let comment = resource.find(".node-input-resource-comment").val();
429
+ node.resources[i].comment = comment;
430
+ })
431
+ $("#node-input-resources-container").editableList('empty');
432
+ for (let i = 0; i < node.resources.length; i++) {
433
+ let resource = node.resources[i];
434
+ $("#node-input-resources-container").editableList('addItem', resource);
435
+ }
436
+ }
437
+
438
+ // *** END MOBSEARCH *** //
439
+
119
440
  for (let i = 0; i < node.resources.length; i++) {
120
441
  let resource = node.resources[i];
121
442
  $("#node-input-resources-container").editableList('addItem', resource);
122
443
  }
123
444
  },
124
445
  oneditresize(size) {
125
- var rows = $("#dialog-form>div:not(.node-input-resources-container-row)");
446
+ var rows = $("#dialog-form>div:not(.node-input-resources-container)");
126
447
  var height = size.height;
127
448
  for (var i=0; i<rows.size(); i++) {
128
449
  height -= $(rows[i]).outerHeight(true);
129
450
  }
130
- var editorRow = $("#dialog-form>div.node-input-resources-container-row");
451
+ var editorRow = $("#dialog-form>div.node-input-resources-container");
131
452
  height -= 4 * ((parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))));
132
453
 
133
454
  $("#node-input-resources-container").editableList('height',height);
@@ -29,9 +29,30 @@ POSSIBILITY OF SUCH DAMAGE.
29
29
  <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
30
  <input type="text" id="node-input-connection">
31
31
  </div>
32
- <div class="form-row">
33
- <label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
34
- <input type="text" id="node-input-mobject" placeholder="Object URI (hid/sid/pid/ins)">
32
+ <hr>
33
+ <div id="instance-row">
34
+ <div class="form-row">
35
+ <label for="node-input-instance"><i class="fa fa-tasks"></i> URI</label>
36
+ <input type="text" id="node-input-instance" style="width:61%;" placeholder="HID/SID/PID/INS (optional name)">
37
+ <a id="node-lookup-instance" class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>
38
+ </div>
39
+ </div>
40
+ <div id="instance-search-row">
41
+ <div class="form-row">
42
+ <label for="instance-search-sid"><i class="fa fa-tasks"></i> URI</label>
43
+ <input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
44
+ <input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
45
+ <input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
46
+ <input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
47
+ <a id="node-search-return" class="searchbutton" style="vertical-align: middle"><i id="node-search-return-icon" class="fa fa-arrow-left"></i></a>
48
+ <a id="node-search-accept" class="searchbutton" style="vertical-align: middle"><i id="node-search-accept-icon" class="fa fa-check"></i></a>
49
+ </div>
50
+ </div>
51
+ <div id="wildcard-alert-row" class="form-row hidden" style="color:#555555" align="center">
52
+ <p>Please note: The selection of wildcard '+'
53
+ means a search for a specific instance or resource
54
+ cannot be performed. As such, enter the
55
+ INS manually.</p>
35
56
  </div>
36
57
  <div class="form-row">
37
58
  <label for="node-input-format"><i class="fa fa-bars"></i> Format</label>
@@ -60,7 +81,7 @@ POSSIBILITY OF SUCH DAMAGE.
60
81
  name: {value: ""},
61
82
  detailedOutput: {value:false},
62
83
  format: {value: "name", required: true},
63
- mobject: {value: "", validate:function(v) {
84
+ instance: {value: "", validate:function(v) {
64
85
  if(v === '') { return true; }
65
86
  let parts = v.split('/');
66
87
  for(let lp = 0; lp < parts.length; lp++) {
@@ -86,12 +107,240 @@ POSSIBILITY OF SUCH DAMAGE.
86
107
  if(this.name) {
87
108
  return this.name;
88
109
  } else {
89
- return this.mobject ? `Get - ${this.mobject}` : "get object";
110
+ return this.instance ? `Get - ${this.instance}` : "get object";
90
111
  }
91
112
  },
92
113
  labelStyle: function() {
93
114
  return this.name ? "node_label_italic":"";
94
115
  },
116
+ oneditprepare: function () {
117
+
118
+ var node = this;
119
+ let mobiusSrvc = $("#node-input-connection").val();
120
+
121
+
122
+ // *** MOBSEARCH *** //
123
+
124
+ $("#instance-search-row").hide();
125
+
126
+ $("#node-search-return").addClass('disabled');
127
+
128
+ //Inital setup
129
+ $("#instance-search-row").hide();
130
+ $("#wildcard-alert-row").hide();
131
+ $("#node-search-return").addClass('disabled');
132
+ $.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
133
+ $("#instance-search-hid").val(response);
134
+ })
135
+ let readyToAccept = false;
136
+ let searchObject = {
137
+ hid: $("#instance-search-hid").val(),
138
+ sid: $("#instance-search-sid").val(),
139
+ pid: $("#instance-search-pid").val(),
140
+ ins: $("#instance-search-ins").val(),
141
+ objects: []
142
+ }
143
+
144
+ //Function to search for INSs
145
+ function insSearch (objects, pid) {
146
+ let inss = ['#'];
147
+ for (let i = 0; i < objects.length; i++) {
148
+ if (objects[i].pid === pid) {
149
+ const name = objects[i].resources[1].pv;
150
+ if (name === '') {
151
+ inss.push(objects[i].ins);
152
+ } else {
153
+ inss.push(`${objects[i].ins} - ${name}`);
154
+ }
155
+ }
156
+ }
157
+ $("#instance-search-ins").autocomplete({
158
+ source: inss,
159
+ minLength: 0,
160
+ close: function (event, ui) {
161
+ acceptCheck();
162
+ $("#instance-search-ins").autocomplete('destroy');
163
+ if ($("#instance-search-ins").val().length > 4) {
164
+ $("#instance-search-ins").val($("#instance-search-ins").val().substring(0, 4))
165
+ }
166
+ searchObject.ins = $("#instance-search-ins").val();
167
+ }
168
+ }).autocomplete('search', '');
169
+ }
170
+
171
+ //Function to search for PIDs
172
+ function pidsSearch(objects) {
173
+ searchObject.objects = objects;
174
+ let pids = ['#', '+'];
175
+ for (let i = 0; i < objects.length; i++) {
176
+ pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
177
+ }
178
+ pids = [...new Set(pids)];
179
+ $("#instance-search-pid").autocomplete({
180
+ source: pids,
181
+ minLength: 0,
182
+ close: function (event, ui) {
183
+ acceptCheck();
184
+ $("#instance-search-pid").autocomplete('destroy');
185
+ if ($("#instance-search-pid").val().length > 4) {
186
+ $("#instance-search-pid").val($("#instance-search-pid").val().substring(0, 4))
187
+ }
188
+ searchObject.pid = $("#instance-search-pid").val();
189
+ }
190
+ }).autocomplete('search', '');
191
+ }
192
+
193
+ //Function to search for SIDs, and then fetch child objects based on selection
194
+ function serviceSearch(response) {
195
+ let services = ['#', '+'];
196
+ for (let i = 0; i < response.length; i++) {
197
+ if (response[i].sid !== '009') {
198
+ services.push(`${response[i].sid} - ${response[i].name}`);
199
+ }
200
+ }
201
+ $("#instance-search-sid").autocomplete({
202
+ source: services,
203
+ minLength: 0,
204
+ close: function (event, ui) {
205
+ acceptCheck();
206
+ $("#instance-search-sid").autocomplete('destroy');
207
+ if ($("#instance-search-sid").val().length > 3) {
208
+ $("#instance-search-sid").val($("#instance-search-sid").val().substring(0, 3))
209
+ }
210
+ searchObject.sid = $("#instance-search-sid").val();
211
+ if (searchObject.sid === '+') {
212
+ for (let i = 2; i < services.length; i++) {
213
+ $.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[i].substring(0, 3)}`, (objects) => {
214
+ searchObject.objects = searchObject.objects.concat(objects);
215
+ })
216
+ }
217
+ } else {
218
+ $.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`, (objects) => {
219
+ searchObject.objects = objects;
220
+ })
221
+ }
222
+ }
223
+ }).autocomplete('search', '');
224
+ }
225
+
226
+ //Start a new search
227
+ function startSearch() {
228
+ $("#wildcard-alert-row").hide();
229
+ $("#instance-search-sid").val('');
230
+ $("#instance-search-pid").val('');
231
+ $("#instance-search-ins").val('');
232
+ searchObject.hid = $("#instance-search-hid").val()
233
+ searchObject.sid = '';
234
+ searchObject.pid = '';
235
+ searchObject.ins = '';
236
+ if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
237
+ $.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch)
238
+ .fail((err) => {
239
+ console.log('Some kind of html failure message on service discovery');
240
+ });
241
+ }
242
+ }
243
+
244
+ //Finish a search
245
+ function finishSearch() {
246
+ $("#wildcard-alert-row").hide();
247
+ let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`
248
+ if (uri.includes('#')) {
249
+ uri = uri.substring(0,uri.indexOf('#') + 1)
250
+ }
251
+ $("#node-input-instance").val(uri);
252
+ $("#node-search-accept").css('color', '#CCCCCC');
253
+ readyToAccept = false;
254
+ $("#node-search-return").addClass('disabled');
255
+ $("#node-search-accept").addClass('disabled');
256
+ $("#node-lookup-instance").removeClass('disabled');
257
+ $("#instance-search-row").hide();
258
+ $("#instance-row").show();
259
+ }
260
+
261
+ //Function to update if accept button is grade out and functions based on conditions of fields
262
+ function acceptCheck() {
263
+ if (($("#instance-search-hid").val() !== '' && $("#instance-search-sid").val() !== '' && $("#instance-search-pid").val() !== '' && $("#instance-search-ins").val() !== '') ||
264
+ $("#instance-search-sid").val() === '#' || $("#instance-search-pid").val() === '#' || $("#instance-search-ins").val() === '#') {
265
+ $("#node-search-accept").css('color', '#555555');
266
+ readyToAccept = true;
267
+ } else {
268
+ $("#node-search-accept").css('color', '#CCCCCC');
269
+ readyToAccept = false;
270
+ }
271
+ if ($("#instance-search-sid").val() !== '+' && $("#instance-search-pid").val() !== '+') {
272
+ $("#wildcard-alert-row").hide();
273
+ } else {
274
+ $("#wildcard-alert-row").show();
275
+ }
276
+ }
277
+
278
+ // Respond to clicks
279
+ $("#node-lookup-instance").click(function () { //When search button is clicked
280
+ $("#instance-search-sid").val('');
281
+ $("#instance-search-pid").val('');
282
+ $("#instance-search-ins").val('');
283
+ $("#node-lookup-instance").addClass('disabled');
284
+ $("#node-search-return").removeClass('disabled');
285
+ $("#node-search-accept").removeClass('disabled');
286
+ $("#instance-row").hide();
287
+ $("#instance-search-row").show();
288
+ });
289
+ $("#instance-search-sid").click(function () { //SID field clicked
290
+ $("#instance-search-pid").val('')
291
+ $("#instance-search-ins").val('')
292
+ searchObject.pid = '';
293
+ searchObject.ins = '';
294
+ searchObject.objects = [];
295
+ startSearch();
296
+ })
297
+ $("#instance-search-pid").click(function () { //PID field clicked
298
+ $("#instance-search-ins").val('')
299
+ searchObject.ins = '';
300
+ if (searchObject.sid !== '') {
301
+ pidsSearch(searchObject.objects);
302
+ }
303
+ })
304
+ $("#instance-search-ins").click(function () { //INS field clicked
305
+ if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
306
+ insSearch(searchObject.objects, searchObject.pid);
307
+ }
308
+ })
309
+ $("#node-search-return").click(function () { //Return/Back button clicked
310
+ $("#node-search-return").addClass('disabled');
311
+ $("#node-search-accept").addClass('disabled');
312
+ $("#node-lookup-instance").removeClass('disabled');
313
+ $("#instance-search-row").hide();
314
+ $("#instance-row").show();
315
+ });
316
+ $("#node-search-accept").click(function () { //Accept button clicked
317
+ if (readyToAccept) {
318
+ finishSearch();
319
+ }
320
+ });
321
+
322
+ // Respond to search field changes
323
+ $("#instance-search-hid").change(function () {
324
+ acceptCheck();
325
+ $("#instance-search-sid").val('');
326
+ $("#instance-search-pid").val('');
327
+ $("#instance-search-ins").val('');
328
+ });
329
+ $("#instance-search-sid").change(function () {
330
+ searchObject.sid = $("#instance-search-sid").val()
331
+ acceptCheck();
332
+ });
333
+ $("#instance-search-pid").change(function () {
334
+ searchObject.pid = $("#instance-search-pid").val()
335
+ acceptCheck();
336
+ });
337
+ $("#instance-search-ins").change(function () {
338
+ searchObject.ins = $("#instance-search-ins").val()
339
+ acceptCheck();
340
+ });
341
+
342
+ // *** MOBSEARCH *** //
343
+ },
95
344
  oneditsave: function() {
96
345
  if($("#node-input-detailedOutput").prop('checked')) {
97
346
  this.outputs = 3;