node-red-contrib-mobius-flow-base 3.0.1-beta.2 → 3.1.0
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.
- package/dist/nodes/common/mobsearch.js +108 -48
- package/package.json +1 -1
|
@@ -42,19 +42,23 @@
|
|
|
42
42
|
initMobsearch = {
|
|
43
43
|
// Standard mobsearch to rid level
|
|
44
44
|
toRid: (mobiusSrvc, opts) => {
|
|
45
|
-
getMobsearch(mobiusSrvc,
|
|
45
|
+
getMobsearch(mobiusSrvc, 'rid', false, opts);
|
|
46
46
|
},
|
|
47
47
|
// Standard mobsearch to ins level
|
|
48
48
|
toIns: (mobiusSrvc, opts) => {
|
|
49
|
-
getMobsearch(mobiusSrvc,
|
|
49
|
+
getMobsearch(mobiusSrvc, 'ins', false, opts);
|
|
50
|
+
},
|
|
51
|
+
// Standard mobsearch to sid level
|
|
52
|
+
toSid: (mobiusSrvc, opts) => {
|
|
53
|
+
getMobsearch(mobiusSrvc, 'sid', false, opts);
|
|
50
54
|
},
|
|
51
55
|
// Mobsearch to rid level, for nodes using editable list
|
|
52
56
|
toRid_listed: (mobiusSrvc, opts) => {
|
|
53
|
-
getMobsearch(mobiusSrvc,
|
|
57
|
+
getMobsearch(mobiusSrvc, 'rid', true, opts);
|
|
54
58
|
},
|
|
55
59
|
// Mobsearch to ins level, for nodes using editable list
|
|
56
60
|
toIns_listed: (mobiusSrvc, opts) => {
|
|
57
|
-
getMobsearch(mobiusSrvc,
|
|
61
|
+
getMobsearch(mobiusSrvc, 'ins', true, opts);
|
|
58
62
|
},
|
|
59
63
|
};
|
|
60
64
|
|
|
@@ -96,11 +100,11 @@ function addMobsearchListButton(mobiusSrvc, field, rowIndex, opts) {
|
|
|
96
100
|
/**
|
|
97
101
|
*
|
|
98
102
|
* @param mobiusSrvc - Connection to Mobius
|
|
99
|
-
* @param {boolean}
|
|
103
|
+
* @param {boolean} level - Flag for Mobsearch to include rid field
|
|
100
104
|
* @param {boolean} listed - Flag for Mobsearch work with nodes using editableLists
|
|
101
105
|
* @param {object} opts - Mobsearhc options object
|
|
102
106
|
*/
|
|
103
|
-
function getMobsearch(mobiusSrvc,
|
|
107
|
+
function getMobsearch(mobiusSrvc, level, listed, opts) {
|
|
104
108
|
selectionIndex = 0;
|
|
105
109
|
// Get current state of input field
|
|
106
110
|
let uriFieldValue = '';
|
|
@@ -125,9 +129,24 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
125
129
|
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
126
130
|
`;
|
|
127
131
|
|
|
132
|
+
const serviceHtml = `
|
|
133
|
+
<input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
|
|
134
|
+
<input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
|
|
135
|
+
`;
|
|
136
|
+
|
|
128
137
|
//set level dependent html
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
switch (level) {
|
|
139
|
+
case 'sid':
|
|
140
|
+
rows = serviceHtml;
|
|
141
|
+
break;
|
|
142
|
+
case 'ins':
|
|
143
|
+
rows = instanceHtml;
|
|
144
|
+
break;
|
|
145
|
+
case 'rid':
|
|
146
|
+
rows = resourceHtml;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
let alertMsg = level === 'rid' ? `and/or RID ` : ``;
|
|
131
150
|
|
|
132
151
|
//Inject new html
|
|
133
152
|
document.getElementById(opts.htmlElementId).innerHTML += `
|
|
@@ -316,11 +335,15 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
316
335
|
$('#instance-search-pid').removeAttr('disabled');
|
|
317
336
|
$('#instance-search-ins').removeAttr('disabled');
|
|
318
337
|
$('#instance-search-rid').removeAttr('disabled');
|
|
319
|
-
let services = opts.removeWildcards
|
|
338
|
+
let services = opts.removeWildcards
|
|
339
|
+
? []
|
|
340
|
+
: level === 'sid'
|
|
341
|
+
? ['#']
|
|
342
|
+
: ['#', '+'];
|
|
320
343
|
for (let i = 0; i < response.length; i++) {
|
|
321
344
|
if (response[i].sid !== '009') {
|
|
322
345
|
if (opts.filterSpids) {
|
|
323
|
-
if (opts.filterSpids.includes(response[i].
|
|
346
|
+
if (opts.filterSpids.includes(response[i].spid)) {
|
|
324
347
|
services.push(`${response[i].sid} - ${response[i].name}`);
|
|
325
348
|
}
|
|
326
349
|
} else {
|
|
@@ -407,9 +430,15 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
407
430
|
*/
|
|
408
431
|
function finishSearch() {
|
|
409
432
|
$('#wildcard-alert-row').hide();
|
|
410
|
-
let uri = `${searchObject.hid}/${searchObject.sid}
|
|
411
|
-
|
|
412
|
-
|
|
433
|
+
let uri = `${searchObject.hid}/${searchObject.sid}`;
|
|
434
|
+
switch (level) {
|
|
435
|
+
case 'ins':
|
|
436
|
+
uri = uri + `/${searchObject.pid}/${searchObject.ins}`;
|
|
437
|
+
break;
|
|
438
|
+
case 'rid':
|
|
439
|
+
uri =
|
|
440
|
+
uri + `/${searchObject.pid}/${searchObject.ins}/${searchObject.rid}`;
|
|
441
|
+
break;
|
|
413
442
|
}
|
|
414
443
|
if (uri.includes('#')) {
|
|
415
444
|
uri = uri.substring(0, uri.indexOf('#') + 1);
|
|
@@ -442,14 +471,35 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
442
471
|
* Update if accept button is grade out and functional, based on conditions of fields
|
|
443
472
|
*/
|
|
444
473
|
function acceptCheck() {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
474
|
+
switch (level) {
|
|
475
|
+
case 'sid':
|
|
476
|
+
checkFieldsToSid();
|
|
477
|
+
break;
|
|
478
|
+
case 'ins':
|
|
479
|
+
checkFieldsToIns();
|
|
480
|
+
break;
|
|
481
|
+
case 'rid':
|
|
482
|
+
checkFieldsToRid();
|
|
483
|
+
break;
|
|
449
484
|
}
|
|
450
485
|
checkWildcards();
|
|
451
486
|
}
|
|
452
487
|
|
|
488
|
+
function checkFieldsToSid() {
|
|
489
|
+
const wildcardPass =
|
|
490
|
+
!opts.removeWildcards && $('#instance-search-sid').val() === '#';
|
|
491
|
+
if (
|
|
492
|
+
$('#instance-search-hid').val() !== '' &&
|
|
493
|
+
$('#instance-search-sid').val() !== ''
|
|
494
|
+
) {
|
|
495
|
+
$('#node-search-accept').css('color', '#555555');
|
|
496
|
+
readyToAccept = true;
|
|
497
|
+
} else {
|
|
498
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
499
|
+
readyToAccept = false;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
453
503
|
/**
|
|
454
504
|
* Check state of all field to rid level, change state of accept button accordingly
|
|
455
505
|
*/
|
|
@@ -541,11 +591,15 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
541
591
|
$(`#${opts.searchButtonId}`).click(function () {
|
|
542
592
|
if (mobConnected) {
|
|
543
593
|
//When search button is clicked
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
594
|
+
if (level === 'sid' || level === 'ins' || level === 'rid') {
|
|
595
|
+
$('#instance-search-sid').val('');
|
|
596
|
+
if (level === 'ins' || level === 'rid') {
|
|
597
|
+
$('#instance-search-pid').val('');
|
|
598
|
+
$('#instance-search-ins').val('');
|
|
599
|
+
if (level === 'rid') {
|
|
600
|
+
$('#instance-search-rid').val('');
|
|
601
|
+
}
|
|
602
|
+
}
|
|
549
603
|
}
|
|
550
604
|
$(`#${opts.searchButtonId}`).addClass('disabled');
|
|
551
605
|
$('#node-search-return').removeClass('disabled');
|
|
@@ -561,7 +615,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
561
615
|
$('#instance-search-ins').val('');
|
|
562
616
|
searchObject.pid = '';
|
|
563
617
|
searchObject.ins = '';
|
|
564
|
-
if (
|
|
618
|
+
if (level === 'rid') {
|
|
565
619
|
searchObject.rid = '';
|
|
566
620
|
}
|
|
567
621
|
searchObject.objects = [];
|
|
@@ -573,7 +627,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
573
627
|
|
|
574
628
|
searchObject.ins = '';
|
|
575
629
|
|
|
576
|
-
if (
|
|
630
|
+
if (level === 'rid') {
|
|
577
631
|
$('#instance-search-rid').val('');
|
|
578
632
|
searchObject.rid = '';
|
|
579
633
|
}
|
|
@@ -583,7 +637,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
583
637
|
});
|
|
584
638
|
$('#instance-search-ins').click(function () {
|
|
585
639
|
//INS field clicked
|
|
586
|
-
if (
|
|
640
|
+
if (level === 'rid') {
|
|
587
641
|
$('#instance-search-rid').val('');
|
|
588
642
|
searchObject.rid = '';
|
|
589
643
|
}
|
|
@@ -596,7 +650,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
596
650
|
}
|
|
597
651
|
});
|
|
598
652
|
|
|
599
|
-
if (
|
|
653
|
+
if (level === 'rid') {
|
|
600
654
|
$('#instance-search-rid').click(function () {
|
|
601
655
|
//RID clicked
|
|
602
656
|
if (
|
|
@@ -632,34 +686,40 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
632
686
|
|
|
633
687
|
$('#instance-search-hid').change(function () {
|
|
634
688
|
acceptCheck();
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
if (
|
|
639
|
-
$('#instance-search-
|
|
689
|
+
if (level === 'sid' || level === 'ins' || level === 'rid') {
|
|
690
|
+
$('#instance-search-sid').val('');
|
|
691
|
+
}
|
|
692
|
+
if (level === 'ins' || level === 'rid') {
|
|
693
|
+
$('#instance-search-pid').val('');
|
|
694
|
+
$('#instance-search-ins').val('');
|
|
695
|
+
if (level === 'rid') {
|
|
696
|
+
$('#instance-search-rid').val('');
|
|
697
|
+
}
|
|
640
698
|
}
|
|
641
699
|
});
|
|
642
700
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
searchObject.ins = $('#instance-search-ins').val();
|
|
655
|
-
acceptCheck();
|
|
656
|
-
});
|
|
701
|
+
if (level === 'sid' || level === 'ins' || level === 'rid') {
|
|
702
|
+
$('#instance-search-sid').change(function () {
|
|
703
|
+
searchObject.sid = $('#instance-search-sid').val();
|
|
704
|
+
acceptCheck();
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
if (level === 'ins' || level === 'rid') {
|
|
708
|
+
$('#instance-search-pid').change(function () {
|
|
709
|
+
searchObject.pid = $('#instance-search-pid').val();
|
|
710
|
+
acceptCheck();
|
|
711
|
+
});
|
|
657
712
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
searchObject.rid = $('#instance-search-rid').val();
|
|
713
|
+
$('#instance-search-ins').change(function () {
|
|
714
|
+
searchObject.ins = $('#instance-search-ins').val();
|
|
661
715
|
acceptCheck();
|
|
662
716
|
});
|
|
717
|
+
if (level === 'rid') {
|
|
718
|
+
$('#instance-search-rid').change(function () {
|
|
719
|
+
searchObject.rid = $('#instance-search-rid').val();
|
|
720
|
+
acceptCheck();
|
|
721
|
+
});
|
|
722
|
+
}
|
|
663
723
|
}
|
|
664
724
|
|
|
665
725
|
// * END CHANGE RESPONSE * //
|