node-red-contrib-mobius-flow-base 2.5.86-beta.69 → 2.5.86-beta.72
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 +26 -16
- package/dist/nodes/mobius-clear-resource.html +10 -274
- package/dist/nodes/mobius-clear-resource.js +21 -8
- package/dist/nodes/mobius-discover-object-list.html +12 -248
- package/dist/nodes/mobius-discover-object-list.js +71 -53
- package/dist/nodes/mobius-flow-inject.html +12 -248
- package/dist/nodes/mobius-flow-inject.js +23 -9
- package/dist/nodes/mobius-get-multi-object.html +12 -248
- package/dist/nodes/mobius-get-multi-object.js +17 -9
- package/dist/nodes/mobius-get-object.html +2 -1
- package/dist/nodes/mobius-get-resource.html +2 -1
- package/dist/nodes/mobius-object-cov.html +10 -239
- package/dist/nodes/mobius-object-cov.js +8 -0
- package/dist/nodes/mobius-resource-cov.html +10 -274
- package/dist/nodes/mobius-resource-cov.js +13 -5
- package/dist/nodes/mobius-set-multi-resource.html +10 -239
- package/dist/nodes/mobius-set-multi-resource.js +8 -0
- package/dist/nodes/mobius-set-resource.html +11 -274
- package/dist/nodes/mobius-set-resource.js +31 -13
- package/package.json +1 -1
|
@@ -39,25 +39,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
39
39
|
<ol id="node-input-subs-container"></ol>
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
|
-
<div id="
|
|
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>
|
|
42
|
+
<div id="mobsearch"></div>
|
|
59
43
|
</script>
|
|
60
44
|
|
|
45
|
+
<script src="common/mobsearch.js"></script>
|
|
46
|
+
|
|
61
47
|
<script type="text/javascript">
|
|
62
48
|
RED.nodes.registerType('mobius flow inject', {
|
|
63
49
|
category: 'mobius',
|
|
@@ -87,214 +73,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
87
73
|
var node = this;
|
|
88
74
|
let mobiusSrvc = $("#node-input-connection").val();
|
|
89
75
|
|
|
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 *** //
|
|
297
|
-
|
|
298
76
|
/** Create the subs container and populate it */
|
|
299
77
|
$('#node-input-subs-container').css('min-height', '300px').css('min-width', '450px').editableList ({
|
|
300
78
|
addButton: "add",
|
|
@@ -332,17 +110,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
332
110
|
node.subscriptions[i] = {uri: '', type: 'include'}
|
|
333
111
|
}
|
|
334
112
|
|
|
335
|
-
searchField
|
|
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
|
-
});
|
|
113
|
+
addMobsearchListButton(searchField, i, mobsearchOpts)
|
|
346
114
|
// *** END MOBSEARCH *** //
|
|
347
115
|
}
|
|
348
116
|
});
|
|
@@ -354,18 +122,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
354
122
|
|
|
355
123
|
// *** MOBSEARCH *** //
|
|
356
124
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
let subscription = node.subscriptions[i];
|
|
366
|
-
$("#node-input-subs-container").editableList('addItem', subscription);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
125
|
+
mobsearchOpts = {
|
|
126
|
+
htmlElementId: 'mobsearch',
|
|
127
|
+
list: node.subscriptions,
|
|
128
|
+
containerRowName: 'node-input-subs-container-row',
|
|
129
|
+
containerName: 'node-input-subs-container',
|
|
130
|
+
containerSecondFieldName: 'node-input-sub-type',
|
|
131
|
+
};
|
|
132
|
+
initMobsearch.toIns_listed(mobiusSrvc, mobsearchOpts);
|
|
369
133
|
|
|
370
134
|
// *** END MOBSEARCH *** //
|
|
371
135
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
const _ = require('lodash');
|
|
31
31
|
|
|
32
32
|
module.exports = function (RED) {
|
|
33
|
-
function MobiusFlowNode
|
|
33
|
+
function MobiusFlowNode(n) {
|
|
34
34
|
RED.nodes.createNode(this, n);
|
|
35
35
|
this.subscriptions = n.subscriptions;
|
|
36
36
|
this.serviceConn = RED.nodes.getNode(n.connection);
|
|
@@ -40,7 +40,7 @@ module.exports = function (RED) {
|
|
|
40
40
|
node.status({
|
|
41
41
|
fill: 'red',
|
|
42
42
|
shape: 'ring',
|
|
43
|
-
text: 'Disconnected'
|
|
43
|
+
text: 'Disconnected',
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
for (const subscription of node.subscriptions) {
|
|
@@ -61,7 +61,7 @@ module.exports = function (RED) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
function validateSubscription
|
|
64
|
+
function validateSubscription(uri) {
|
|
65
65
|
let parts = uri.split('/');
|
|
66
66
|
for (let lp = 0; lp < parts.length; lp++) {
|
|
67
67
|
if (parts[lp] === null || parts[lp] === '') {
|
|
@@ -83,18 +83,24 @@ module.exports = function (RED) {
|
|
|
83
83
|
* @param {string} messageTopic - The topic in an actual message
|
|
84
84
|
* @return {boolean} - True if the topics match, else false
|
|
85
85
|
*/
|
|
86
|
-
function matchTopic
|
|
86
|
+
function matchTopic(topic, messageTopic) {
|
|
87
87
|
if (topic === '#') {
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
90
|
// eslint-disable-next-line no-useless-escape
|
|
91
|
-
var regex = new RegExp(
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
var regex = new RegExp(
|
|
92
|
+
'^' +
|
|
93
|
+
topic
|
|
94
|
+
.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g, '\\$1')
|
|
95
|
+
// eslint-disable-next-line no-useless-escape
|
|
96
|
+
.replace(/\+/g, '[^/]+')
|
|
97
|
+
.replace(/\/#$/, '(/.*)?') +
|
|
98
|
+
'$'
|
|
99
|
+
);
|
|
94
100
|
return regex.test(messageTopic);
|
|
95
101
|
}
|
|
96
102
|
|
|
97
|
-
function handleSubscription
|
|
103
|
+
function handleSubscription(node, response) {
|
|
98
104
|
for (const subscription of node.subscriptions) {
|
|
99
105
|
if (subscription.type === 'exclude') {
|
|
100
106
|
if (matchTopic(subscription.uri, response.uri)) {
|
|
@@ -106,7 +112,7 @@ module.exports = function (RED) {
|
|
|
106
112
|
node.status({
|
|
107
113
|
fill: 'green',
|
|
108
114
|
shape: 'dot',
|
|
109
|
-
text: JSON.stringify(response.uri)
|
|
115
|
+
text: JSON.stringify(response.uri),
|
|
110
116
|
});
|
|
111
117
|
let outObject = response.value;
|
|
112
118
|
try {
|
|
@@ -121,4 +127,12 @@ module.exports = function (RED) {
|
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
RED.nodes.registerType('mobius flow inject', MobiusFlowNode);
|
|
130
|
+
|
|
131
|
+
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
132
|
+
var options = {
|
|
133
|
+
root: __dirname + '/common/',
|
|
134
|
+
dotfiles: 'deny',
|
|
135
|
+
};
|
|
136
|
+
res.sendFile(req.params[0], options);
|
|
137
|
+
});
|
|
124
138
|
};
|
|
@@ -39,25 +39,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
39
39
|
<ol id="node-input-mobjects-container"></ol>
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
|
-
<div id="
|
|
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>
|
|
42
|
+
<div id="mobsearch"></div>
|
|
59
43
|
</script>
|
|
60
44
|
|
|
45
|
+
<script src="common/mobsearch.js"></script>
|
|
46
|
+
|
|
61
47
|
<script type="text/javascript">
|
|
62
48
|
RED.nodes.registerType('mobius get multi-object', {
|
|
63
49
|
category: 'mobius',
|
|
@@ -94,214 +80,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
94
80
|
|
|
95
81
|
let mobiusSrvc = $("#node-input-connection").val();
|
|
96
82
|
|
|
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
|
-
|
|
305
83
|
/** Create the objects container and populate it */
|
|
306
84
|
$('#node-input-mobjects-container').css('min-height', '300px').css('min-width', '450px').editableList ({
|
|
307
85
|
addButton: "add",
|
|
@@ -340,17 +118,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
340
118
|
node.mobjects[i] = {uri: '', comment: ''}
|
|
341
119
|
}
|
|
342
120
|
|
|
343
|
-
searchField
|
|
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
|
-
});
|
|
121
|
+
addMobsearchListButton(searchField, i, mobsearchOpts)
|
|
354
122
|
// *** END MOBSEARCH *** //
|
|
355
123
|
},
|
|
356
124
|
resizeItem: resizeObject
|
|
@@ -362,18 +130,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
362
130
|
}
|
|
363
131
|
// *** MOBSEARCH *** //
|
|
364
132
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
let mobject = node.mobjects[i];
|
|
374
|
-
$("#node-input-mobjects-container").editableList('addItem', mobject);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
133
|
+
mobsearchOpts = {
|
|
134
|
+
htmlElementId: 'mobsearch',
|
|
135
|
+
list: node.mobjects,
|
|
136
|
+
containerRowName: 'node-input-mobjects-container-row',
|
|
137
|
+
containerName: 'node-input-mobjects-container',
|
|
138
|
+
containerSecondFieldName: 'node-input-mobject-comment',
|
|
139
|
+
};
|
|
140
|
+
initMobsearch.toIns_listed(mobiusSrvc, mobsearchOpts);
|
|
377
141
|
|
|
378
142
|
// *** END MOBSEARCH *** //
|
|
379
143
|
|