node-red-contrib-mobius-flow-base 2.5.86-beta.54 → 2.5.86-beta.58
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.
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
initMobsearch = {
|
|
2
|
+
toRid: () => {
|
|
3
|
+
return 'Hello World';
|
|
4
|
+
},
|
|
5
|
+
toIns: () => {
|
|
6
|
+
return 'Hello World';
|
|
7
|
+
},
|
|
8
|
+
toRidList: () => {
|
|
9
|
+
return 'Hello World';
|
|
10
|
+
},
|
|
11
|
+
toInsList: () => {
|
|
12
|
+
return 'Hello World';
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function getMobsearch(mobiusSrvc, level, listed, fieldName, list, updateList, globalIndex) {
|
|
2
17
|
//level dependent html
|
|
3
18
|
let rows =
|
|
4
19
|
level === 'rid'
|
|
@@ -35,10 +50,12 @@ function getMobsearch(mobiusSrvc, level, fieldName) {
|
|
|
35
50
|
</div>
|
|
36
51
|
`;
|
|
37
52
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
if (!listed) {
|
|
54
|
+
//Add search button
|
|
55
|
+
document.getElementById('input-row').innerHTML += `
|
|
56
|
+
<a id="node-lookup-instance" class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
42
59
|
|
|
43
60
|
//Inital setup
|
|
44
61
|
$('#instance-search-row').hide();
|
|
@@ -49,17 +66,29 @@ function getMobsearch(mobiusSrvc, level, fieldName) {
|
|
|
49
66
|
});
|
|
50
67
|
let readyToAccept = false;
|
|
51
68
|
|
|
52
|
-
let searchObject = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
let searchObject = {};
|
|
70
|
+
if (listed) {
|
|
71
|
+
searchObject = {
|
|
72
|
+
hid: '',
|
|
73
|
+
sid: '',
|
|
74
|
+
pid: '',
|
|
75
|
+
ins: '',
|
|
76
|
+
rid: '',
|
|
77
|
+
objects: [],
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
searchObject = {
|
|
81
|
+
hid: $('#instance-search-hid').val(),
|
|
82
|
+
sid: $('#instance-search-sid').val(),
|
|
83
|
+
pid: $('#instance-search-pid').val(),
|
|
84
|
+
ins: $('#instance-search-ins').val(),
|
|
85
|
+
rid: $('#instance-search-rid').val(),
|
|
86
|
+
objects: [],
|
|
87
|
+
};
|
|
61
88
|
}
|
|
62
89
|
|
|
90
|
+
//End init setup
|
|
91
|
+
|
|
63
92
|
//Function to search for RIDs
|
|
64
93
|
function ridSearch(objects, ins) {
|
|
65
94
|
$.getJSON(
|
|
@@ -211,7 +240,12 @@ function getMobsearch(mobiusSrvc, level, fieldName) {
|
|
|
211
240
|
if (uri.includes('#')) {
|
|
212
241
|
uri = uri.substring(0, uri.indexOf('#') + 1);
|
|
213
242
|
}
|
|
214
|
-
|
|
243
|
+
if (listed) {
|
|
244
|
+
list[globalIndex].uri = uri;
|
|
245
|
+
updateList();
|
|
246
|
+
} else {
|
|
247
|
+
$(`#${fieldName}`).val(uri);
|
|
248
|
+
}
|
|
215
249
|
$('#node-search-accept').css('color', '#CCCCCC');
|
|
216
250
|
readyToAccept = false;
|
|
217
251
|
$('#node-search-return').addClass('disabled');
|
|
@@ -46,26 +46,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
46
46
|
<ol id="node-input-resources-container"></ol>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
-
<div id="
|
|
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>
|
|
49
|
+
<div id="mobsearch"></div>
|
|
67
50
|
</script>
|
|
68
51
|
|
|
52
|
+
<script src="common/mobsearch.js"></script>
|
|
53
|
+
|
|
69
54
|
<script type="text/javascript">
|
|
70
55
|
RED.nodes.registerType('mobius get multi-resource', {
|
|
71
56
|
category: 'mobius',
|
|
@@ -102,264 +87,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
102
87
|
}
|
|
103
88
|
|
|
104
89
|
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 *** //
|
|
90
|
+
let globalIndex = 0;
|
|
363
91
|
|
|
364
92
|
/** Create the subs container and populate it */
|
|
365
93
|
$('#node-input-resources-container').css('min-height', '300px').css('min-width', '450px').editableList ({
|
|
@@ -399,7 +127,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
399
127
|
}
|
|
400
128
|
|
|
401
129
|
searchField.click(function () {
|
|
402
|
-
|
|
130
|
+
globalIndex = i;
|
|
403
131
|
$('#node-input-resources-container-row').hide();
|
|
404
132
|
$("#instance-search-sid").val('');
|
|
405
133
|
$("#instance-search-pid").val('');
|
|
@@ -433,8 +161,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
433
161
|
let resource = node.resources[i];
|
|
434
162
|
$("#node-input-resources-container").editableList('addItem', resource);
|
|
435
163
|
}
|
|
164
|
+
$('#node-input-resources-container-row').show();
|
|
436
165
|
}
|
|
437
166
|
|
|
167
|
+
getMobsearch(mobiusSrvc, 'rid', true, null, node.resources, updateList, globalIndex)
|
|
168
|
+
|
|
438
169
|
// *** END MOBSEARCH *** //
|
|
439
170
|
|
|
440
171
|
for (let i = 0; i < node.resources.length; i++) {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
30
|
module.exports = function (RED) {
|
|
31
|
-
function MobiusFlowNode
|
|
31
|
+
function MobiusFlowNode(n) {
|
|
32
32
|
RED.nodes.createNode(this, n);
|
|
33
33
|
this.resources = n.resources;
|
|
34
34
|
this.sendFormat = n.send;
|
|
@@ -39,7 +39,7 @@ module.exports = function (RED) {
|
|
|
39
39
|
node.status({
|
|
40
40
|
fill: 'red',
|
|
41
41
|
shape: 'ring',
|
|
42
|
-
text: 'Disconnected'
|
|
42
|
+
text: 'Disconnected',
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
node.serviceConn.register(node);
|
|
@@ -48,7 +48,7 @@ module.exports = function (RED) {
|
|
|
48
48
|
node.status({
|
|
49
49
|
fill: 'green',
|
|
50
50
|
shape: 'ring',
|
|
51
|
-
text: 'Busy'
|
|
51
|
+
text: 'Busy',
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
for (const resource of node.resources) {
|
|
@@ -56,7 +56,7 @@ module.exports = function (RED) {
|
|
|
56
56
|
node.status({
|
|
57
57
|
fill: 'yellow',
|
|
58
58
|
shape: 'dot',
|
|
59
|
-
text: 'URIs not Valid'
|
|
59
|
+
text: 'URIs not Valid',
|
|
60
60
|
});
|
|
61
61
|
if (done) {
|
|
62
62
|
return done();
|
|
@@ -72,23 +72,23 @@ module.exports = function (RED) {
|
|
|
72
72
|
node.status({
|
|
73
73
|
fill: 'green',
|
|
74
74
|
shape: 'dot',
|
|
75
|
-
text: 'Done'
|
|
75
|
+
text: 'Done',
|
|
76
76
|
});
|
|
77
77
|
if (node.sendFormat === 'array') {
|
|
78
|
-
node.send({topic: msg.topic, payload: values});
|
|
78
|
+
node.send({ topic: msg.topic, payload: values });
|
|
79
79
|
} else {
|
|
80
80
|
let payload = values.reduce((obj, item) => {
|
|
81
81
|
obj[item.uri] = { pv: item.pv, name: item.name };
|
|
82
82
|
return obj;
|
|
83
83
|
}, {});
|
|
84
|
-
node.send({topic: msg.topic, payload: payload});
|
|
84
|
+
node.send({ topic: msg.topic, payload: payload });
|
|
85
85
|
}
|
|
86
86
|
})
|
|
87
87
|
.catch((err) => {
|
|
88
88
|
node.status({
|
|
89
89
|
fill: 'yellow',
|
|
90
90
|
shape: 'dot',
|
|
91
|
-
text: 'Error: ' + JSON.stringify(err.code)
|
|
91
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
92
92
|
});
|
|
93
93
|
node.error('Mobius error reading resource ' + JSON.stringify(err));
|
|
94
94
|
})
|
|
@@ -107,7 +107,7 @@ module.exports = function (RED) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
function validateResourceURI
|
|
110
|
+
function validateResourceURI(uri) {
|
|
111
111
|
let parts = uri.split('/');
|
|
112
112
|
for (let lp = 0; lp < parts.length; lp++) {
|
|
113
113
|
if (parts[lp] === null || parts[lp] === '') {
|
|
@@ -120,7 +120,7 @@ module.exports = function (RED) {
|
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
function readResource
|
|
123
|
+
function readResource(node, uri) {
|
|
124
124
|
return new Promise((resolve, reject) => {
|
|
125
125
|
node.serviceConn.readResource(uri, (err, response) => {
|
|
126
126
|
if (err) {
|
|
@@ -129,7 +129,7 @@ module.exports = function (RED) {
|
|
|
129
129
|
if (node.sendFormat === 'array') {
|
|
130
130
|
resolve(response.value.pv);
|
|
131
131
|
} else {
|
|
132
|
-
resolve({uri: uri, pv: response.value.pv, name: response.value.name});
|
|
132
|
+
resolve({ uri: uri, pv: response.value.pv, name: response.value.name });
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
});
|
|
@@ -137,4 +137,12 @@ module.exports = function (RED) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
RED.nodes.registerType('mobius get multi-resource', MobiusFlowNode);
|
|
140
|
+
|
|
141
|
+
RED.httpAdmin.get('/common/*', function (req, res) {
|
|
142
|
+
var options = {
|
|
143
|
+
root: __dirname + '/common/',
|
|
144
|
+
dotfiles: 'deny',
|
|
145
|
+
};
|
|
146
|
+
res.sendFile(req.params[0], options);
|
|
147
|
+
});
|
|
140
148
|
};
|
|
@@ -38,6 +38,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
|
+
<div id="mobsearch"></div>
|
|
42
|
+
|
|
41
43
|
<div class="form-row">
|
|
42
44
|
<label for="node-input-format"><i class="fa fa-bars"></i> Format</label>
|
|
43
45
|
<select type="text" id="node-input-format" style="display: inline-block; width: auto; vertical-align: center;">
|
|
@@ -104,7 +106,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
104
106
|
var node = this;
|
|
105
107
|
let mobiusSrvc = $("#node-input-connection").val();
|
|
106
108
|
|
|
107
|
-
getMobsearch(mobiusSrvc, 'ins', 'node-input-instance')
|
|
109
|
+
getMobsearch(mobiusSrvc, 'ins', false, 'node-input-instance', null, null, null)
|
|
108
110
|
},
|
|
109
111
|
oneditsave: function() {
|
|
110
112
|
if($("#node-input-detailedOutput").prop('checked')) {
|
|
@@ -98,7 +98,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
98
98
|
oneditprepare: function () {
|
|
99
99
|
var node = this;
|
|
100
100
|
let mobiusSrvc = $("#node-input-connection").val();
|
|
101
|
-
|
|
101
|
+
console.log(initMobsearch.toRid());
|
|
102
|
+
getMobsearch(mobiusSrvc, 'rid', false, 'node-input-resource', null, null, null);
|
|
102
103
|
},
|
|
103
104
|
oneditsave: function() {
|
|
104
105
|
if($("#node-input-detailedOutput").prop('checked')) {
|