node-red-contrib-mobius-flow-base 2.5.86-beta.6 → 2.5.86-beta.63
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 +477 -0
- package/dist/nodes/mobius-clear-resource.html +288 -3
- package/dist/nodes/mobius-connection.js +29 -0
- package/dist/nodes/mobius-discover-object-list.html +272 -3
- package/dist/nodes/mobius-flow-inject.html +270 -2
- package/dist/nodes/mobius-get-multi-object.html +276 -7
- package/dist/nodes/mobius-get-multi-resource.html +38 -7
- package/dist/nodes/mobius-get-multi-resource.js +19 -11
- package/dist/nodes/mobius-get-object.html +25 -5
- package/dist/nodes/mobius-get-object.js +21 -10
- package/dist/nodes/mobius-get-resource.html +22 -3
- package/dist/nodes/mobius-get-resource.js +21 -8
- package/dist/nodes/mobius-object-cov.html +256 -5
- package/dist/nodes/mobius-object-cov.js +10 -7
- package/dist/nodes/mobius-resource-cov.html +290 -4
- package/dist/nodes/mobius-set-multi-resource.html +254 -4
- package/dist/nodes/mobius-set-multi-resource.js +10 -12
- package/dist/nodes/mobius-set-resource.html +288 -3
- package/dist/nodes/node-red-ui-discover-devices.js +63 -36
- package/package.json +2 -2
|
@@ -34,10 +34,28 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
34
34
|
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
35
35
|
<input type="text" id="node-input-connection">
|
|
36
36
|
</div>
|
|
37
|
-
<div class="form-row node-input-subs-container-row">
|
|
37
|
+
<div id="node-input-subs-container-row" class="form-row node-input-subs-container-row">
|
|
38
38
|
<label for="node-input-subs-container"><i class="fa fa-bars"></i> Subscriptions</label>
|
|
39
39
|
<ol id="node-input-subs-container"></ol>
|
|
40
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<div id="instance-search-row">
|
|
43
|
+
<div class="form-row">
|
|
44
|
+
<label for="instance-search-sid"><i class="fa fa-search"></i> Search</label>
|
|
45
|
+
<input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
|
|
46
|
+
<input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
|
|
47
|
+
<input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
|
|
48
|
+
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
49
|
+
<a id="node-search-return" class="searchbutton" style="vertical-align: middle"><i id="node-search-return-icon" class="fa fa-arrow-left"></i></a>
|
|
50
|
+
<a id="node-search-accept" class="searchbutton" style="vertical-align: middle"><i id="node-search-accept-icon" class="fa fa-check"></i></a>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div id="wildcard-alert-row" class="form-row hidden" style="color:#555555" align="center">
|
|
54
|
+
<p>Please note: The selection of wildcard '+'
|
|
55
|
+
means a search for a specific instance or resource
|
|
56
|
+
cannot be performed. As such, enter the
|
|
57
|
+
INS manually.</p>
|
|
58
|
+
</div>
|
|
41
59
|
</script>
|
|
42
60
|
|
|
43
61
|
<script type="text/javascript">
|
|
@@ -67,6 +85,215 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
67
85
|
},
|
|
68
86
|
oneditprepare: function () {
|
|
69
87
|
var node = this;
|
|
88
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
89
|
+
|
|
90
|
+
// *** MOBSEARCH *** //
|
|
91
|
+
|
|
92
|
+
$("#instance-search-row").hide();
|
|
93
|
+
$("#wildcard-alert-row").hide();
|
|
94
|
+
$("#node-search-return").addClass('disabled');
|
|
95
|
+
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
96
|
+
$("#instance-search-hid").val(response);
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
let globalSubscriptionIndex = 0;
|
|
100
|
+
|
|
101
|
+
let searchObject = {
|
|
102
|
+
hid: '',
|
|
103
|
+
sid: '',
|
|
104
|
+
pid: '',
|
|
105
|
+
ins: '',
|
|
106
|
+
objects: []
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//Function to search for INSs
|
|
110
|
+
function insSearch (objects, pid) {
|
|
111
|
+
let inss = ['#'];
|
|
112
|
+
for (let i = 0; i < objects.length; i++) {
|
|
113
|
+
if (objects[i].pid === pid) {
|
|
114
|
+
const name = objects[i].resources[1].pv;
|
|
115
|
+
if (name === '') {
|
|
116
|
+
inss.push(objects[i].ins);
|
|
117
|
+
} else {
|
|
118
|
+
inss.push(`${objects[i].ins} - ${name}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
$("#instance-search-ins").autocomplete({
|
|
123
|
+
source: inss,
|
|
124
|
+
minLength: 0,
|
|
125
|
+
close: function (event, ui) {
|
|
126
|
+
acceptCheck();
|
|
127
|
+
$("#instance-search-ins").autocomplete('destroy');
|
|
128
|
+
if ($("#instance-search-ins").val().length > 4) {
|
|
129
|
+
$("#instance-search-ins").val($("#instance-search-ins").val().substring(0, 4))
|
|
130
|
+
}
|
|
131
|
+
searchObject.ins = $("#instance-search-ins").val();
|
|
132
|
+
}
|
|
133
|
+
}).autocomplete('search', '');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//Function to search for PIDs
|
|
137
|
+
function pidsSearch(objects) {
|
|
138
|
+
searchObject.objects = objects;
|
|
139
|
+
let pids = ['#', '+'];
|
|
140
|
+
for (let i = 0; i < objects.length; i++) {
|
|
141
|
+
pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
|
|
142
|
+
}
|
|
143
|
+
pids = [...new Set(pids)];
|
|
144
|
+
$("#instance-search-pid").autocomplete({
|
|
145
|
+
source: pids,
|
|
146
|
+
minLength: 0,
|
|
147
|
+
close: function (event, ui) {
|
|
148
|
+
acceptCheck();
|
|
149
|
+
$("#instance-search-pid").autocomplete('destroy');
|
|
150
|
+
if ($("#instance-search-pid").val().length > 4) {
|
|
151
|
+
$("#instance-search-pid").val($("#instance-search-pid").val().substring(0, 4))
|
|
152
|
+
}
|
|
153
|
+
searchObject.pid = $("#instance-search-pid").val();
|
|
154
|
+
}
|
|
155
|
+
}).autocomplete('search', '');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//Function to search for SIDs, and then fetch child objects based on selection
|
|
159
|
+
function serviceSearch(response) {
|
|
160
|
+
let services = ['#', '+'];
|
|
161
|
+
for (let i = 0; i < response.length; i++) {
|
|
162
|
+
if (response[i].sid !== '009') {
|
|
163
|
+
services.push(`${response[i].sid} - ${response[i].name}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
$("#instance-search-sid").autocomplete({
|
|
167
|
+
source: services,
|
|
168
|
+
minLength: 0,
|
|
169
|
+
close: function (event, ui) {
|
|
170
|
+
acceptCheck();
|
|
171
|
+
$("#instance-search-sid").autocomplete('destroy');
|
|
172
|
+
if ($("#instance-search-sid").val().length > 3) {
|
|
173
|
+
$("#instance-search-sid").val($("#instance-search-sid").val().substring(0, 3))
|
|
174
|
+
}
|
|
175
|
+
searchObject.sid = $("#instance-search-sid").val();
|
|
176
|
+
if (searchObject.sid === '+') {
|
|
177
|
+
for (let i = 2; i < services.length; i++) {
|
|
178
|
+
$.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[i].substring(0, 3)}`, (objects) => {
|
|
179
|
+
searchObject.objects = searchObject.objects.concat(objects);
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
$.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`, (objects) => {
|
|
184
|
+
searchObject.objects = objects;
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}).autocomplete('search', '');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
//Start a new search
|
|
192
|
+
function startSearch() {
|
|
193
|
+
$("#wildcard-alert-row").hide();
|
|
194
|
+
$("#instance-search-sid").val('');
|
|
195
|
+
$("#instance-search-pid").val('');
|
|
196
|
+
$("#instance-search-ins").val('');
|
|
197
|
+
searchObject.hid = $("#instance-search-hid").val()
|
|
198
|
+
searchObject.sid = '';
|
|
199
|
+
searchObject.pid = '';
|
|
200
|
+
searchObject.ins = '';
|
|
201
|
+
searchObject.objects = [];
|
|
202
|
+
if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
|
|
203
|
+
$.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch)
|
|
204
|
+
.fail((err) => {
|
|
205
|
+
console.log('Some kind of html failure message on service discovery');
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
//Finish a search
|
|
211
|
+
function finishSearch() {
|
|
212
|
+
$("#wildcard-alert-row").hide();
|
|
213
|
+
let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`
|
|
214
|
+
if (uri.includes('#')) {
|
|
215
|
+
uri = uri.substring(0,uri.indexOf('#') + 1)
|
|
216
|
+
}
|
|
217
|
+
node.subscriptions[globalSubscriptionIndex].uri = uri;
|
|
218
|
+
updateList()
|
|
219
|
+
$("#node-search-accept").css('color', '#CCCCCC');
|
|
220
|
+
readyToAccept = false;
|
|
221
|
+
$("#node-search-return").addClass('disabled');
|
|
222
|
+
$("#node-search-accept").addClass('disabled');
|
|
223
|
+
$("#instance-search-row").hide();
|
|
224
|
+
$('#node-input-subs-container-row').show();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
//Function to update if accept button is grade out and functions based on conditions of fields
|
|
228
|
+
function acceptCheck() {
|
|
229
|
+
if (($("#instance-search-hid").val() !== '' && $("#instance-search-sid").val() !== '' && $("#instance-search-pid").val() !== '' && $("#instance-search-ins").val() !== '') ||
|
|
230
|
+
$("#instance-search-sid").val() === '#' || $("#instance-search-pid").val() === '#' || $("#instance-search-ins").val() === '#') {
|
|
231
|
+
$("#node-search-accept").css('color', '#555555');
|
|
232
|
+
readyToAccept = true;
|
|
233
|
+
} else {
|
|
234
|
+
$("#node-search-accept").css('color', '#CCCCCC');
|
|
235
|
+
readyToAccept = false;
|
|
236
|
+
}
|
|
237
|
+
if ($("#instance-search-sid").val() !== '+' && $("#instance-search-pid").val() !== '+') {
|
|
238
|
+
$("#wildcard-alert-row").hide();
|
|
239
|
+
} else {
|
|
240
|
+
$("#wildcard-alert-row").show();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
$("#instance-search-sid").click(function () { //SID field clicked
|
|
245
|
+
$("#instance-search-pid").val('')
|
|
246
|
+
$("#instance-search-ins").val('')
|
|
247
|
+
searchObject.pid = '';
|
|
248
|
+
searchObject.ins = '';
|
|
249
|
+
searchObject.objects = [];
|
|
250
|
+
startSearch();
|
|
251
|
+
})
|
|
252
|
+
$("#instance-search-pid").click(function () { //PID field clicked
|
|
253
|
+
$("#instance-search-ins").val('')
|
|
254
|
+
searchObject.ins = '';
|
|
255
|
+
if (searchObject.sid !== '') {
|
|
256
|
+
pidsSearch(searchObject.objects);
|
|
257
|
+
}
|
|
258
|
+
})
|
|
259
|
+
$("#instance-search-ins").click(function () { //INS field clicked
|
|
260
|
+
if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
|
|
261
|
+
insSearch(searchObject.objects, searchObject.pid);
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
$("#node-search-return").click(function () { //Return/Back button clicked
|
|
265
|
+
$("#node-search-return").addClass('disabled');
|
|
266
|
+
$("#node-search-accept").addClass('disabled');
|
|
267
|
+
$("#instance-search-row").hide();
|
|
268
|
+
$('#node-input-subs-container-row').show();
|
|
269
|
+
});
|
|
270
|
+
$("#node-search-accept").click(function () { //Accept button clicked
|
|
271
|
+
if (readyToAccept) {
|
|
272
|
+
finishSearch();
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// Respond to search field changes
|
|
277
|
+
$("#instance-search-hid").change(function () {
|
|
278
|
+
acceptCheck();
|
|
279
|
+
$("#instance-search-sid").val('');
|
|
280
|
+
$("#instance-search-pid").val('');
|
|
281
|
+
$("#instance-search-ins").val('');
|
|
282
|
+
});
|
|
283
|
+
$("#instance-search-sid").change(function () {
|
|
284
|
+
searchObject.sid = $("#instance-search-sid").val()
|
|
285
|
+
acceptCheck();
|
|
286
|
+
});
|
|
287
|
+
$("#instance-search-pid").change(function () {
|
|
288
|
+
searchObject.pid = $("#instance-search-pid").val()
|
|
289
|
+
acceptCheck();
|
|
290
|
+
});
|
|
291
|
+
$("#instance-search-ins").change(function () {
|
|
292
|
+
searchObject.ins = $("#instance-search-ins").val()
|
|
293
|
+
acceptCheck();
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// *** END MOBSEARCH *** //
|
|
70
297
|
|
|
71
298
|
/** Create the subs container and populate it */
|
|
72
299
|
$('#node-input-subs-container').css('min-height', '300px').css('min-width', '450px').editableList ({
|
|
@@ -86,6 +313,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
86
313
|
|
|
87
314
|
var row = $('<div>URI</div>').appendTo(container);
|
|
88
315
|
var uriField = $('<input/>',{class: "node-input-sub-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
|
|
316
|
+
|
|
317
|
+
// *** MOBSEARCH *** //
|
|
318
|
+
var searchField = $('<a class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
|
|
319
|
+
// *** END MOBSEARCH *** //
|
|
320
|
+
|
|
89
321
|
var typeField = $('<select/>',{class: "node-input-sub-type", style: "width:auto; margin-left: 5px; text-align: center;"}).appendTo(row);
|
|
90
322
|
typeField.append($("<option></option>").val('include').text('Include'));
|
|
91
323
|
typeField.append($("<option></option>").val('exclude').text('Exclude'));
|
|
@@ -93,6 +325,25 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
93
325
|
// Populate the new stat
|
|
94
326
|
uriField.val(subscription.uri);
|
|
95
327
|
typeField.val(subscription.type);
|
|
328
|
+
|
|
329
|
+
// *** MOBSEARCH *** //
|
|
330
|
+
|
|
331
|
+
if (!node.subscriptions[i]) {
|
|
332
|
+
node.subscriptions[i] = {uri: '', type: 'include'}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
searchField.click(function () {
|
|
336
|
+
globalSubscriptionIndex = i;
|
|
337
|
+
$('#node-input-subs-container-row').hide();
|
|
338
|
+
$("#instance-search-sid").val('');
|
|
339
|
+
$("#instance-search-pid").val('');
|
|
340
|
+
$("#instance-search-ins").val('');
|
|
341
|
+
$("#node-search-return").removeClass('disabled');
|
|
342
|
+
$("#node-search-accept").removeClass('disabled');
|
|
343
|
+
$("#instance-search-row").show();
|
|
344
|
+
|
|
345
|
+
});
|
|
346
|
+
// *** END MOBSEARCH *** //
|
|
96
347
|
}
|
|
97
348
|
});
|
|
98
349
|
|
|
@@ -100,7 +351,24 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
100
351
|
if (!node.subscriptions) {
|
|
101
352
|
node.subscriptions = [subscription = {uri: '', type: 'include'}];
|
|
102
353
|
}
|
|
103
|
-
|
|
354
|
+
|
|
355
|
+
// *** MOBSEARCH *** //
|
|
356
|
+
|
|
357
|
+
function updateList() {
|
|
358
|
+
$("#node-input-subs-container").editableList('items').each(function (i) {
|
|
359
|
+
let sub = $(this);
|
|
360
|
+
let type = sub.find(".node-input-sub-type").val();
|
|
361
|
+
node.subscriptions[i].type = type;
|
|
362
|
+
})
|
|
363
|
+
$("#node-input-subs-container").editableList('empty');
|
|
364
|
+
for (let i = 0; i < node.subscriptions.length; i++) {
|
|
365
|
+
let subscription = node.subscriptions[i];
|
|
366
|
+
$("#node-input-subs-container").editableList('addItem', subscription);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// *** END MOBSEARCH *** //
|
|
371
|
+
|
|
104
372
|
for (let i = 0; i < node.subscriptions.length; i++) {
|
|
105
373
|
let subscription = node.subscriptions[i];
|
|
106
374
|
$("#node-input-subs-container").editableList('addItem', subscription);
|
|
@@ -34,10 +34,28 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
34
34
|
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
35
35
|
<input type="text" id="node-input-connection">
|
|
36
36
|
</div>
|
|
37
|
-
<div class="form-row node-input-mobjects-container-row">
|
|
37
|
+
<div id="node-input-mobjects-container-row" class="form-row node-input-mobjects-container-row">
|
|
38
38
|
<label for="node-input-mobjects-container"><i class="fa fa-bars"></i> Objects</label>
|
|
39
39
|
<ol id="node-input-mobjects-container"></ol>
|
|
40
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<div id="instance-search-row">
|
|
43
|
+
<div class="form-row">
|
|
44
|
+
<label for="instance-search-sid"><i class="fa fa-search"></i> Search</label>
|
|
45
|
+
<input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
|
|
46
|
+
<input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
|
|
47
|
+
<input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
|
|
48
|
+
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
49
|
+
<a id="node-search-return" class="searchbutton" style="vertical-align: middle"><i id="node-search-return-icon" class="fa fa-arrow-left"></i></a>
|
|
50
|
+
<a id="node-search-accept" class="searchbutton" style="vertical-align: middle"><i id="node-search-accept-icon" class="fa fa-check"></i></a>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div id="wildcard-alert-row" class="form-row hidden" style="color:#555555" align="center">
|
|
54
|
+
<p>Please note: The selection of wildcard '+'
|
|
55
|
+
means a search for a specific instance or resource
|
|
56
|
+
cannot be performed. As such, enter the
|
|
57
|
+
INS manually.</p>
|
|
58
|
+
</div>
|
|
41
59
|
</script>
|
|
42
60
|
|
|
43
61
|
<script type="text/javascript">
|
|
@@ -74,6 +92,216 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
74
92
|
mobject.find(".node-input-mobject-comment").width(newWidth - 270);
|
|
75
93
|
}
|
|
76
94
|
|
|
95
|
+
let mobiusSrvc = $("#node-input-connection").val();
|
|
96
|
+
|
|
97
|
+
// *** MOBSEARCH *** //
|
|
98
|
+
|
|
99
|
+
$("#instance-search-row").hide();
|
|
100
|
+
$("#wildcard-alert-row").hide();
|
|
101
|
+
$("#node-search-return").addClass('disabled');
|
|
102
|
+
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
103
|
+
$("#instance-search-hid").val(response);
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
let globalSubscriptionIndex = 0;
|
|
107
|
+
|
|
108
|
+
let searchObject = {
|
|
109
|
+
hid: '',
|
|
110
|
+
sid: '',
|
|
111
|
+
pid: '',
|
|
112
|
+
ins: '',
|
|
113
|
+
objects: []
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//Function to search for INSs
|
|
117
|
+
function insSearch (objects, pid) {
|
|
118
|
+
let inss = ['#'];
|
|
119
|
+
for (let i = 0; i < objects.length; i++) {
|
|
120
|
+
if (objects[i].pid === pid) {
|
|
121
|
+
const name = objects[i].resources[1].pv;
|
|
122
|
+
if (name === '') {
|
|
123
|
+
inss.push(objects[i].ins);
|
|
124
|
+
} else {
|
|
125
|
+
inss.push(`${objects[i].ins} - ${name}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
$("#instance-search-ins").autocomplete({
|
|
130
|
+
source: inss,
|
|
131
|
+
minLength: 0,
|
|
132
|
+
close: function (event, ui) {
|
|
133
|
+
acceptCheck();
|
|
134
|
+
$("#instance-search-ins").autocomplete('destroy');
|
|
135
|
+
if ($("#instance-search-ins").val().length > 4) {
|
|
136
|
+
$("#instance-search-ins").val($("#instance-search-ins").val().substring(0, 4))
|
|
137
|
+
}
|
|
138
|
+
searchObject.ins = $("#instance-search-ins").val();
|
|
139
|
+
}
|
|
140
|
+
}).autocomplete('search', '');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//Function to search for PIDs
|
|
144
|
+
function pidsSearch(objects) {
|
|
145
|
+
searchObject.objects = objects;
|
|
146
|
+
let pids = ['#', '+'];
|
|
147
|
+
for (let i = 0; i < objects.length; i++) {
|
|
148
|
+
pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
|
|
149
|
+
}
|
|
150
|
+
pids = [...new Set(pids)];
|
|
151
|
+
$("#instance-search-pid").autocomplete({
|
|
152
|
+
source: pids,
|
|
153
|
+
minLength: 0,
|
|
154
|
+
close: function (event, ui) {
|
|
155
|
+
acceptCheck();
|
|
156
|
+
$("#instance-search-pid").autocomplete('destroy');
|
|
157
|
+
if ($("#instance-search-pid").val().length > 4) {
|
|
158
|
+
$("#instance-search-pid").val($("#instance-search-pid").val().substring(0, 4))
|
|
159
|
+
}
|
|
160
|
+
searchObject.pid = $("#instance-search-pid").val();
|
|
161
|
+
}
|
|
162
|
+
}).autocomplete('search', '');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//Function to search for SIDs, and then fetch child objects based on selection
|
|
166
|
+
function serviceSearch(response) {
|
|
167
|
+
let services = ['#', '+'];
|
|
168
|
+
for (let i = 0; i < response.length; i++) {
|
|
169
|
+
if (response[i].sid !== '009') {
|
|
170
|
+
services.push(`${response[i].sid} - ${response[i].name}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
$("#instance-search-sid").autocomplete({
|
|
174
|
+
source: services,
|
|
175
|
+
minLength: 0,
|
|
176
|
+
close: function (event, ui) {
|
|
177
|
+
acceptCheck();
|
|
178
|
+
$("#instance-search-sid").autocomplete('destroy');
|
|
179
|
+
if ($("#instance-search-sid").val().length > 3) {
|
|
180
|
+
$("#instance-search-sid").val($("#instance-search-sid").val().substring(0, 3))
|
|
181
|
+
}
|
|
182
|
+
searchObject.sid = $("#instance-search-sid").val();
|
|
183
|
+
if (searchObject.sid === '+') {
|
|
184
|
+
for (let i = 2; i < services.length; i++) {
|
|
185
|
+
$.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[i].substring(0, 3)}`, (objects) => {
|
|
186
|
+
searchObject.objects = searchObject.objects.concat(objects);
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
$.getJSON(`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`, (objects) => {
|
|
191
|
+
searchObject.objects = objects;
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}).autocomplete('search', '');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
//Start a new search
|
|
199
|
+
function startSearch() {
|
|
200
|
+
$("#wildcard-alert-row").hide();
|
|
201
|
+
$("#instance-search-sid").val('');
|
|
202
|
+
$("#instance-search-pid").val('');
|
|
203
|
+
$("#instance-search-ins").val('');
|
|
204
|
+
searchObject.hid = $("#instance-search-hid").val()
|
|
205
|
+
searchObject.sid = '';
|
|
206
|
+
searchObject.pid = '';
|
|
207
|
+
searchObject.ins = '';
|
|
208
|
+
searchObject.objects = [];
|
|
209
|
+
if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
|
|
210
|
+
$.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch)
|
|
211
|
+
.fail((err) => {
|
|
212
|
+
console.log('Some kind of html failure message on service discovery');
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//Finish a search
|
|
218
|
+
function finishSearch() {
|
|
219
|
+
$("#wildcard-alert-row").hide();
|
|
220
|
+
let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`
|
|
221
|
+
if (uri.includes('#')) {
|
|
222
|
+
uri = uri.substring(0,uri.indexOf('#') + 1)
|
|
223
|
+
}
|
|
224
|
+
node.mobjects[globalSubscriptionIndex].uri = uri;
|
|
225
|
+
updateList()
|
|
226
|
+
$("#node-search-accept").css('color', '#CCCCCC');
|
|
227
|
+
readyToAccept = false;
|
|
228
|
+
$("#node-search-return").addClass('disabled');
|
|
229
|
+
$("#node-search-accept").addClass('disabled');
|
|
230
|
+
$("#instance-search-row").hide();
|
|
231
|
+
$('#node-input-mobjects-container-row').show();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
//Function to update if accept button is grade out and functions based on conditions of fields
|
|
235
|
+
function acceptCheck() {
|
|
236
|
+
if (($("#instance-search-hid").val() !== '' && $("#instance-search-sid").val() !== '' && $("#instance-search-pid").val() !== '' && $("#instance-search-ins").val() !== '') ||
|
|
237
|
+
$("#instance-search-sid").val() === '#' || $("#instance-search-pid").val() === '#' || $("#instance-search-ins").val() === '#') {
|
|
238
|
+
$("#node-search-accept").css('color', '#555555');
|
|
239
|
+
readyToAccept = true;
|
|
240
|
+
} else {
|
|
241
|
+
$("#node-search-accept").css('color', '#CCCCCC');
|
|
242
|
+
readyToAccept = false;
|
|
243
|
+
}
|
|
244
|
+
if ($("#instance-search-sid").val() !== '+' && $("#instance-search-pid").val() !== '+') {
|
|
245
|
+
$("#wildcard-alert-row").hide();
|
|
246
|
+
} else {
|
|
247
|
+
$("#wildcard-alert-row").show();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
$("#instance-search-sid").click(function () { //SID field clicked
|
|
252
|
+
$("#instance-search-pid").val('')
|
|
253
|
+
$("#instance-search-ins").val('')
|
|
254
|
+
searchObject.pid = '';
|
|
255
|
+
searchObject.ins = '';
|
|
256
|
+
searchObject.objects = [];
|
|
257
|
+
startSearch();
|
|
258
|
+
})
|
|
259
|
+
$("#instance-search-pid").click(function () { //PID field clicked
|
|
260
|
+
$("#instance-search-ins").val('')
|
|
261
|
+
searchObject.ins = '';
|
|
262
|
+
if (searchObject.sid !== '') {
|
|
263
|
+
pidsSearch(searchObject.objects);
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
$("#instance-search-ins").click(function () { //INS field clicked
|
|
267
|
+
if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
|
|
268
|
+
insSearch(searchObject.objects, searchObject.pid);
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
$("#node-search-return").click(function () { //Return/Back button clicked
|
|
272
|
+
$("#node-search-return").addClass('disabled');
|
|
273
|
+
$("#node-search-accept").addClass('disabled');
|
|
274
|
+
$("#instance-search-row").hide();
|
|
275
|
+
$('#node-input-mobjects-container-row').show();
|
|
276
|
+
});
|
|
277
|
+
$("#node-search-accept").click(function () { //Accept button clicked
|
|
278
|
+
if (readyToAccept) {
|
|
279
|
+
finishSearch();
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// Respond to search field changes
|
|
284
|
+
$("#instance-search-hid").change(function () {
|
|
285
|
+
acceptCheck();
|
|
286
|
+
$("#instance-search-sid").val('');
|
|
287
|
+
$("#instance-search-pid").val('');
|
|
288
|
+
$("#instance-search-ins").val('');
|
|
289
|
+
});
|
|
290
|
+
$("#instance-search-sid").change(function () {
|
|
291
|
+
searchObject.sid = $("#instance-search-sid").val()
|
|
292
|
+
acceptCheck();
|
|
293
|
+
});
|
|
294
|
+
$("#instance-search-pid").change(function () {
|
|
295
|
+
searchObject.pid = $("#instance-search-pid").val()
|
|
296
|
+
acceptCheck();
|
|
297
|
+
});
|
|
298
|
+
$("#instance-search-ins").change(function () {
|
|
299
|
+
searchObject.ins = $("#instance-search-ins").val()
|
|
300
|
+
acceptCheck();
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// *** END MOBSEARCH *** //
|
|
304
|
+
|
|
77
305
|
/** Create the objects container and populate it */
|
|
78
306
|
$('#node-input-mobjects-container').css('min-height', '300px').css('min-width', '450px').editableList ({
|
|
79
307
|
addButton: "add",
|
|
@@ -91,14 +319,39 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
91
319
|
}
|
|
92
320
|
|
|
93
321
|
var row = $('<div>URI</div>').appendTo(container);
|
|
94
|
-
var uriField = $('<input/>',{class: "node-input-mobject-uri", type: "text", style: "width:
|
|
322
|
+
var uriField = $('<input/>',{class: "node-input-mobject-uri", type: "text", style: "width: 180px; margin-left: 5px; text-align: left;"}).appendTo(row);
|
|
323
|
+
|
|
324
|
+
// *** MOBSEARCH *** //
|
|
325
|
+
var searchField = $('<a class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
|
|
326
|
+
// *** END MOBSEARCH *** //
|
|
327
|
+
|
|
95
328
|
row.append(' - ');
|
|
96
|
-
|
|
329
|
+
|
|
330
|
+
var commentField = $('<input/>',{class: "node-input-mobject-comment", type: "text", style: "width: 120px; margin-left: 5px; text-align: left;"}).appendTo(row);
|
|
97
331
|
|
|
98
332
|
// Populate the new stat
|
|
99
333
|
uriField.val(mobject.uri);
|
|
100
334
|
commentField.val(mobject.comment);
|
|
101
|
-
resizeObject(container);
|
|
335
|
+
// resizeObject(container);
|
|
336
|
+
|
|
337
|
+
// *** MOBSEARCH *** //
|
|
338
|
+
|
|
339
|
+
if (!node.mobjects[i]) {
|
|
340
|
+
node.mobjects[i] = {uri: '', comment: ''}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
searchField.click(function () {
|
|
344
|
+
globalSubscriptionIndex = i;
|
|
345
|
+
$('#node-input-mobjects-container-row').hide();
|
|
346
|
+
$("#instance-search-sid").val('');
|
|
347
|
+
$("#instance-search-pid").val('');
|
|
348
|
+
$("#instance-search-ins").val('');
|
|
349
|
+
$("#node-search-return").removeClass('disabled');
|
|
350
|
+
$("#node-search-accept").removeClass('disabled');
|
|
351
|
+
$("#instance-search-row").show();
|
|
352
|
+
|
|
353
|
+
});
|
|
354
|
+
// *** END MOBSEARCH *** //
|
|
102
355
|
},
|
|
103
356
|
resizeItem: resizeObject
|
|
104
357
|
});
|
|
@@ -107,19 +360,35 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
107
360
|
if (!node.mobjects) {
|
|
108
361
|
node.mobjects = [mobject = {uri: '', comment: ''}];
|
|
109
362
|
}
|
|
110
|
-
//
|
|
363
|
+
// *** MOBSEARCH *** //
|
|
364
|
+
|
|
365
|
+
function updateList() {
|
|
366
|
+
$("#node-input-mobjects-container").editableList('items').each(function (i) {
|
|
367
|
+
let mobject = $(this);
|
|
368
|
+
let comment = mobject.find(".node-input-mobject-comment").val();
|
|
369
|
+
node.mobjects[i].comment = comment;
|
|
370
|
+
})
|
|
371
|
+
$("#node-input-mobjects-container").editableList('empty');
|
|
372
|
+
for (let i = 0; i < node.mobjects.length; i++) {
|
|
373
|
+
let mobject = node.mobjects[i];
|
|
374
|
+
$("#node-input-mobjects-container").editableList('addItem', mobject);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// *** END MOBSEARCH *** //
|
|
379
|
+
|
|
111
380
|
for (let i = 0; i < node.mobjects.length; i++) {
|
|
112
381
|
let mobject = node.mobjects[i];
|
|
113
382
|
$("#node-input-mobjects-container").editableList('addItem', mobject);
|
|
114
383
|
}
|
|
115
384
|
},
|
|
116
385
|
oneditresize(size) {
|
|
117
|
-
var rows = $("#dialog-form>div:not(.node-input-mobjects-container
|
|
386
|
+
var rows = $("#dialog-form>div:not(.node-input-mobjects-container)");
|
|
118
387
|
var height = size.height;
|
|
119
388
|
for (var i=0; i<rows.size(); i++) {
|
|
120
389
|
height -= $(rows[i]).outerHeight(true);
|
|
121
390
|
}
|
|
122
|
-
var editorRow = $("#dialog-form>div.node-input-mobjects-container
|
|
391
|
+
var editorRow = $("#dialog-form>div.node-input-mobjects-container");
|
|
123
392
|
height -= 4 * ((parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))));
|
|
124
393
|
|
|
125
394
|
$("#node-input-mobjects-container").editableList('height',height);
|