node-red-contrib-mobius-flow-base 2.5.91 → 3.0.0-beta.13
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/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +16 -0
- package/.github/ISSUE_TEMPLATE/general.md +7 -0
- package/.github/workflows/build_publish.yml +80 -0
- package/README.md +4 -10
- package/dist/engine-api-calls.d.ts +19 -0
- package/dist/engine-api-calls.js +235 -0
- package/dist/engine-api-client.d.ts +8 -0
- package/dist/engine-api-client.js +106 -0
- package/dist/engine-websocket.d.ts +60 -0
- package/dist/engine-websocket.js +264 -0
- package/dist/node-red-ui-funcs.js +180 -0
- package/dist/nodes/common/mobsearch.js +602 -0
- package/dist/nodes/mobius-change-admin-password.d.ts +26 -0
- package/dist/nodes/mobius-change-admin-password.html +98 -0
- package/dist/nodes/mobius-change-admin-password.js +87 -0
- package/dist/nodes/mobius-clear-resource.html +37 -12
- package/dist/nodes/mobius-clear-resource.js +17 -13
- package/dist/nodes/mobius-connection-interface.d.ts +45 -0
- package/dist/nodes/mobius-connection-interface.js +2 -0
- package/dist/nodes/mobius-connection.html +30 -8
- package/dist/nodes/mobius-connection.js +216 -85
- package/dist/nodes/mobius-discover-object-list.html +185 -126
- package/dist/nodes/mobius-discover-object-list.js +24 -5
- package/dist/nodes/mobius-discover.js +7 -7
- package/dist/nodes/mobius-filter-by-rid-value.html +62 -42
- package/dist/nodes/mobius-filter-by-rid-value.js +38 -31
- package/dist/nodes/mobius-flow-inject.html +32 -2
- package/dist/nodes/mobius-get-multi-object.html +39 -5
- package/dist/nodes/mobius-get-multi-resource.html +37 -4
- package/dist/nodes/mobius-get-multi-resource.js +13 -12
- package/dist/nodes/mobius-get-object.html +39 -11
- package/dist/nodes/mobius-get-object.js +12 -9
- package/dist/nodes/mobius-get-resource.html +41 -12
- package/dist/nodes/mobius-get-resource.js +17 -12
- package/dist/nodes/mobius-object-cov.html +40 -11
- package/dist/nodes/mobius-object-cov.js +9 -6
- package/dist/nodes/mobius-resource-cov.html +37 -11
- package/dist/nodes/mobius-resource-cov.js +5 -5
- package/dist/nodes/mobius-set-multi-resource.html +39 -12
- package/dist/nodes/mobius-set-multi-resource.js +9 -11
- package/dist/nodes/mobius-set-resource.html +38 -11
- package/package.json +15 -8
- package/dist/nodes/node-red-ui-discover-devices.js +0 -103
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param mobiusSrvc - Connection to Mobius
|
|
4
|
+
* @param {object} opts - Options object, field explained below
|
|
5
|
+
|
|
6
|
+
OPTS OBJECT (opts.)
|
|
7
|
+
ALL CASES
|
|
8
|
+
htmlElementId - The id of the HTML element that mobsearch will inject into
|
|
9
|
+
NON-LISTED ONLY
|
|
10
|
+
uriFieldName - The id of the URI HTML field, mobsearch will set the value of this field to be the result
|
|
11
|
+
inputRowId - The id of the main input, mobsearch will add the search button to this row
|
|
12
|
+
LISTED ONLY (Uses editable list)
|
|
13
|
+
list - Array containing current list items in object form
|
|
14
|
+
containerRowName - The id of the row containing the HTML container
|
|
15
|
+
containerName - The id of the HTML container
|
|
16
|
+
containerSecondFieldName - The id of the secondary field (Not URI field) within HTML container
|
|
17
|
+
|
|
18
|
+
EXAMPLE OPTS OBJECT - context of getMultiResource (node using editable list)
|
|
19
|
+
opts = {
|
|
20
|
+
htmlElementId: 'mobsearch',
|
|
21
|
+
list: node.resources,
|
|
22
|
+
containerRowName: 'node-input-resources-container-row',
|
|
23
|
+
containerName: 'node-input-resources-container',
|
|
24
|
+
containerSecondFieldName: 'node-input-resources-comment',
|
|
25
|
+
};
|
|
26
|
+
EXAMPLE OPTS OBJECT - context of getResource (standard node, not using editable list)
|
|
27
|
+
opts = {
|
|
28
|
+
htmlElementId: 'mobsearch',
|
|
29
|
+
uriFieldName: 'node-input-resource',
|
|
30
|
+
inputRowId: 'input-row',
|
|
31
|
+
};
|
|
32
|
+
*
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
initMobsearch = {
|
|
38
|
+
// Standard mobsearch to rid level
|
|
39
|
+
toRid: (mobiusSrvc, opts) => {
|
|
40
|
+
getMobsearch(mobiusSrvc, true, false, opts);
|
|
41
|
+
},
|
|
42
|
+
// Standard mobsearch to ins level
|
|
43
|
+
toIns: (mobiusSrvc, opts) => {
|
|
44
|
+
getMobsearch(mobiusSrvc, false, false, opts);
|
|
45
|
+
},
|
|
46
|
+
// Mobsearch to rid level, for nodes using editable list
|
|
47
|
+
toRid_listed: (mobiusSrvc, opts) => {
|
|
48
|
+
getMobsearch(mobiusSrvc, true, true, opts);
|
|
49
|
+
},
|
|
50
|
+
// Mobsearch to ins level, for nodes using editable list
|
|
51
|
+
toIns_listed: (mobiusSrvc, opts) => {
|
|
52
|
+
getMobsearch(mobiusSrvc, false, true, opts);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Make / Reset global selectionIndex vairable (variable to allow setting of correct list field)
|
|
57
|
+
if (typeof selectionIndex === undefined) {
|
|
58
|
+
let selectionIndex = 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* function to add search button functionality to list rows
|
|
63
|
+
* @param {object} field - The search field within a given list row
|
|
64
|
+
* @param {number} rowIndex - The list row index
|
|
65
|
+
* @param {object} opts - Mobsearch options object
|
|
66
|
+
*/
|
|
67
|
+
function addMobsearchListButton(mobiusSrvc, field, rowIndex, opts) {
|
|
68
|
+
if (mobiusSrvc !== '_ADD_') {
|
|
69
|
+
$.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
|
|
70
|
+
if (!response) {
|
|
71
|
+
field.css('color', '#CCCCCC');
|
|
72
|
+
} else {
|
|
73
|
+
field.click(function () {
|
|
74
|
+
selectionIndex = rowIndex;
|
|
75
|
+
$(`#${opts.containerRowName}`).hide();
|
|
76
|
+
$('#instance-search-sid').val('');
|
|
77
|
+
$('#instance-search-pid').val('');
|
|
78
|
+
$('#instance-search-ins').val('');
|
|
79
|
+
$('#instance-search-rid').val('');
|
|
80
|
+
$('#node-search-return').removeClass('disabled');
|
|
81
|
+
$('#node-search-accept').removeClass('disabled');
|
|
82
|
+
$('#instance-search-row').show();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
field.css('color', '#CCCCCC');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param mobiusSrvc - Connection to Mobius
|
|
94
|
+
* @param {boolean} useRid - Flag for Mobsearch to include rid field
|
|
95
|
+
* @param {boolean} listed - Flag for Mobsearch work with nodes using editableLists
|
|
96
|
+
* @param {object} opts - Mobsearhc options object
|
|
97
|
+
*/
|
|
98
|
+
function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
99
|
+
selectionIndex = 0;
|
|
100
|
+
// Get current state of input field
|
|
101
|
+
let uriFieldValue = '';
|
|
102
|
+
if (!listed) {
|
|
103
|
+
uriFieldValue = $(`#${opts.uriFieldName}`).val();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// * HTML INJECTION * //
|
|
107
|
+
|
|
108
|
+
const resourceHtml = `
|
|
109
|
+
<input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
|
|
110
|
+
<input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
|
|
111
|
+
<input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
|
|
112
|
+
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
113
|
+
<input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
const instanceHtml = `
|
|
117
|
+
<input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
|
|
118
|
+
<input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
|
|
119
|
+
<input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
|
|
120
|
+
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
//set level dependent html
|
|
124
|
+
let rows = useRid === true ? resourceHtml : instanceHtml;
|
|
125
|
+
let alertMsg = useRid === true ? `and/or RID ` : ``;
|
|
126
|
+
|
|
127
|
+
//Inject new html
|
|
128
|
+
document.getElementById(opts.htmlElementId).innerHTML += `
|
|
129
|
+
<div id="bad-connection-alert" style="color:#FF0000" align="center">
|
|
130
|
+
<p>Setup and deploy MOBiUS connection to allow search.</p>
|
|
131
|
+
</div>
|
|
132
|
+
<div id="instance-search-row">
|
|
133
|
+
<div class="form-row">
|
|
134
|
+
<label for="instance-search-sid"><i class="fa fa-tasks"></i> URI</label>
|
|
135
|
+
${rows}
|
|
136
|
+
<a id="node-search-return" class="searchbutton" style="vertical-align: middle"><i id="node-search-return-icon" class="fa fa-arrow-left"></i></a>
|
|
137
|
+
<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>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
<div id="wildcard-alert-row" class="form-row hidden" style="color:#555555" align="center">
|
|
141
|
+
<p>Please note: The selection of wildcard '+'
|
|
142
|
+
means a search for a specific instance or resource
|
|
143
|
+
cannot be performed. As such, enter the
|
|
144
|
+
INS ${alertMsg}manually.</p>
|
|
145
|
+
</div>
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
if (!listed) {
|
|
149
|
+
//Add search button
|
|
150
|
+
document.getElementById(opts.inputRowId).innerHTML += `
|
|
151
|
+
<a id="node-lookup-instance" class="searchbutton" style="margin-left: 13px; vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// * END HTML INJECTION * //
|
|
156
|
+
|
|
157
|
+
// * INIT SETUP * //
|
|
158
|
+
|
|
159
|
+
let mobConnected = false;
|
|
160
|
+
$.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
|
|
161
|
+
mobConnected = response;
|
|
162
|
+
if (!mobConnected) {
|
|
163
|
+
$('#node-lookup-instance').css('color', '#CCCCCC');
|
|
164
|
+
$('#bad-connection-alert').show();
|
|
165
|
+
} else {
|
|
166
|
+
$('#bad-connection-alert').hide();
|
|
167
|
+
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
168
|
+
$('#instance-search-hid').val(response);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
$('#instance-search-row').hide();
|
|
174
|
+
$('#wildcard-alert-row').hide();
|
|
175
|
+
$('#node-search-return').addClass('disabled');
|
|
176
|
+
let readyToAccept = false;
|
|
177
|
+
|
|
178
|
+
let searchObject = {};
|
|
179
|
+
if (listed) {
|
|
180
|
+
searchObject = {
|
|
181
|
+
hid: '',
|
|
182
|
+
sid: '',
|
|
183
|
+
pid: '',
|
|
184
|
+
ins: '',
|
|
185
|
+
rid: '',
|
|
186
|
+
objects: [],
|
|
187
|
+
};
|
|
188
|
+
} else {
|
|
189
|
+
searchObject = {
|
|
190
|
+
hid: $('#instance-search-hid').val(),
|
|
191
|
+
sid: $('#instance-search-sid').val(),
|
|
192
|
+
pid: $('#instance-search-pid').val(),
|
|
193
|
+
ins: $('#instance-search-ins').val(),
|
|
194
|
+
rid: $('#instance-search-rid').val(),
|
|
195
|
+
objects: [],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// * END INIT SETUP * //
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Search for INSs present on selected PID
|
|
203
|
+
* @param {object} objects - Response from call to Mobiu, list of mobius objects
|
|
204
|
+
* @param {string} pid - The chosen PID
|
|
205
|
+
*/
|
|
206
|
+
function ridSearch(objects, ins) {
|
|
207
|
+
$.getJSON(
|
|
208
|
+
`mdiscover?mobius=${mobiusSrvc}&uri=${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`,
|
|
209
|
+
(response) => {
|
|
210
|
+
resList = response.data[0].resources;
|
|
211
|
+
ress = ['#'];
|
|
212
|
+
for (let j = 0; j < resList.length; j++) {
|
|
213
|
+
ress.push(`${resList[j].rid} - ${resList[j].name}`);
|
|
214
|
+
}
|
|
215
|
+
$('#instance-search-rid')
|
|
216
|
+
.autocomplete({
|
|
217
|
+
source: ress,
|
|
218
|
+
minLength: 0,
|
|
219
|
+
close: function (event, ui) {
|
|
220
|
+
acceptCheck();
|
|
221
|
+
$('#instance-search-rid').autocomplete('destroy');
|
|
222
|
+
$('#instance-search-rid').val($('#instance-search-rid').val().substring(0, 2));
|
|
223
|
+
searchObject.rid = $('#instance-search-rid').val();
|
|
224
|
+
},
|
|
225
|
+
})
|
|
226
|
+
.autocomplete('search', '');
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Search for INSs present on selected PID
|
|
233
|
+
* @param {object} objects - Response from call to Mobius, list of mobius objects
|
|
234
|
+
* @param {string} pid - The chosen PID
|
|
235
|
+
*/
|
|
236
|
+
function insSearch(objects, pid) {
|
|
237
|
+
let inss = ['#', '+'];
|
|
238
|
+
for (let i = 0; i < objects.length; i++) {
|
|
239
|
+
if (objects[i].pid === pid) {
|
|
240
|
+
const name = objects[i].resources[1].pv;
|
|
241
|
+
if (name === '') {
|
|
242
|
+
inss.push(objects[i].ins);
|
|
243
|
+
} else {
|
|
244
|
+
inss.push(`${objects[i].ins} - ${name}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
$('#instance-search-ins')
|
|
249
|
+
.autocomplete({
|
|
250
|
+
source: inss,
|
|
251
|
+
minLength: 0,
|
|
252
|
+
close: function (event, ui) {
|
|
253
|
+
acceptCheck();
|
|
254
|
+
$('#instance-search-ins').autocomplete('destroy');
|
|
255
|
+
if ($('#instance-search-ins').val().length > 4) {
|
|
256
|
+
$('#instance-search-ins').val($('#instance-search-ins').val().substring(0, 4));
|
|
257
|
+
}
|
|
258
|
+
searchObject.ins = $('#instance-search-ins').val();
|
|
259
|
+
},
|
|
260
|
+
})
|
|
261
|
+
.autocomplete('search', '');
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Search for PIDs present on selected service
|
|
266
|
+
* @param {object} objects - Response from call to Mobius, list of mobius objects
|
|
267
|
+
*/
|
|
268
|
+
function pidsSearch(objects) {
|
|
269
|
+
searchObject.objects = objects;
|
|
270
|
+
let pids = ['#', '+'];
|
|
271
|
+
for (let i = 0; i < objects.length; i++) {
|
|
272
|
+
pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
|
|
273
|
+
}
|
|
274
|
+
pids = [...new Set(pids)];
|
|
275
|
+
$('#instance-search-pid')
|
|
276
|
+
.autocomplete({
|
|
277
|
+
source: pids,
|
|
278
|
+
minLength: 0,
|
|
279
|
+
close: function (event, ui) {
|
|
280
|
+
acceptCheck();
|
|
281
|
+
$('#instance-search-pid').autocomplete('destroy');
|
|
282
|
+
if ($('#instance-search-pid').val().length > 4) {
|
|
283
|
+
$('#instance-search-pid').val($('#instance-search-pid').val().substring(0, 4));
|
|
284
|
+
}
|
|
285
|
+
searchObject.pid = $('#instance-search-pid').val();
|
|
286
|
+
},
|
|
287
|
+
})
|
|
288
|
+
.autocomplete('search', '');
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Search for SIDs, and then fetch child objects based on selection
|
|
293
|
+
* @param {object} response - Response from call to Mobius
|
|
294
|
+
*/
|
|
295
|
+
function serviceSearch(response) {
|
|
296
|
+
let services = ['#', '+'];
|
|
297
|
+
for (let i = 0; i < response.length; i++) {
|
|
298
|
+
if (response[i].sid !== '009') {
|
|
299
|
+
services.push(`${response[i].sid} - ${response[i].name}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
$('#instance-search-sid')
|
|
303
|
+
.autocomplete({
|
|
304
|
+
source: services,
|
|
305
|
+
minLength: 0,
|
|
306
|
+
close: function (event, ui) {
|
|
307
|
+
acceptCheck();
|
|
308
|
+
$('#instance-search-sid').autocomplete('destroy');
|
|
309
|
+
if ($('#instance-search-sid').val().length > 3) {
|
|
310
|
+
$('#instance-search-sid').val($('#instance-search-sid').val().substring(0, 3));
|
|
311
|
+
}
|
|
312
|
+
searchObject.sid = $('#instance-search-sid').val();
|
|
313
|
+
if (searchObject.sid === '+') {
|
|
314
|
+
for (let i = 2; i < services.length; i++) {
|
|
315
|
+
$.getJSON(
|
|
316
|
+
`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[
|
|
317
|
+
i
|
|
318
|
+
].substring(0, 3)}`,
|
|
319
|
+
(objects) => {
|
|
320
|
+
searchObject.objects = searchObject.objects.concat(objects);
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
$.getJSON(
|
|
326
|
+
`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`,
|
|
327
|
+
(objects) => {
|
|
328
|
+
searchObject.objects = objects;
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
})
|
|
334
|
+
.autocomplete('search', '');
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Start mobsearch
|
|
339
|
+
*/
|
|
340
|
+
function startSearch() {
|
|
341
|
+
$('#wildcard-alert-row').hide();
|
|
342
|
+
$('#instance-search-sid').val('');
|
|
343
|
+
$('#instance-search-pid').val('');
|
|
344
|
+
$('#instance-search-ins').val('');
|
|
345
|
+
searchObject.hid = $('#instance-search-hid').val();
|
|
346
|
+
searchObject.sid = '';
|
|
347
|
+
searchObject.pid = '';
|
|
348
|
+
searchObject.ins = '';
|
|
349
|
+
if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
|
|
350
|
+
$.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch).fail(
|
|
351
|
+
(err) => {
|
|
352
|
+
console.log('Mobsearch failed to contact Mobius');
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Finish mobsearch, compile full URI and set value in host node
|
|
360
|
+
*/
|
|
361
|
+
function finishSearch() {
|
|
362
|
+
$('#wildcard-alert-row').hide();
|
|
363
|
+
let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`;
|
|
364
|
+
if (useRid) {
|
|
365
|
+
uri = uri + `/${searchObject.rid}`;
|
|
366
|
+
}
|
|
367
|
+
if (uri.includes('#')) {
|
|
368
|
+
uri = uri.substring(0, uri.indexOf('#') + 1);
|
|
369
|
+
}
|
|
370
|
+
if (listed) {
|
|
371
|
+
opts.list[selectionIndex].uri = uri;
|
|
372
|
+
updateList();
|
|
373
|
+
} else {
|
|
374
|
+
$(`#${opts.uriFieldName}`).val(uri);
|
|
375
|
+
}
|
|
376
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
377
|
+
readyToAccept = false;
|
|
378
|
+
$('#node-search-return').addClass('disabled');
|
|
379
|
+
$('#node-search-accept').addClass('disabled');
|
|
380
|
+
$('#node-lookup-instance').removeClass('disabled');
|
|
381
|
+
$('#instance-search-row').hide();
|
|
382
|
+
$('#instance-row').show();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Update if accept button is grade out and functional, based on conditions of fields
|
|
387
|
+
*/
|
|
388
|
+
function acceptCheck() {
|
|
389
|
+
if (useRid) {
|
|
390
|
+
checkFieldsToRid();
|
|
391
|
+
} else {
|
|
392
|
+
checkFieldsToIns();
|
|
393
|
+
}
|
|
394
|
+
checkWildcards();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Check state of all field to rid level, change state of accept button accordingly
|
|
399
|
+
*/
|
|
400
|
+
function checkFieldsToRid() {
|
|
401
|
+
if (
|
|
402
|
+
($('#instance-search-hid').val() !== '' &&
|
|
403
|
+
$('#instance-search-sid').val() !== '' &&
|
|
404
|
+
$('#instance-search-pid').val() !== '' &&
|
|
405
|
+
$('#instance-search-ins').val() !== '' &&
|
|
406
|
+
$('#instance-search-rid').val() !== '') ||
|
|
407
|
+
$('#instance-search-sid').val() === '#' ||
|
|
408
|
+
$('#instance-search-pid').val() === '#' ||
|
|
409
|
+
$('#instance-search-ins').val() === '#' ||
|
|
410
|
+
$('#instance-search-rid').val() === '#'
|
|
411
|
+
) {
|
|
412
|
+
$('#node-search-accept').css('color', '#555555');
|
|
413
|
+
readyToAccept = true;
|
|
414
|
+
} else {
|
|
415
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
416
|
+
readyToAccept = false;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Check state of all field to ins level, change state of accept button accordingly
|
|
422
|
+
*/
|
|
423
|
+
function checkFieldsToIns() {
|
|
424
|
+
if (
|
|
425
|
+
($('#instance-search-hid').val() !== '' &&
|
|
426
|
+
$('#instance-search-sid').val() !== '' &&
|
|
427
|
+
$('#instance-search-pid').val() !== '' &&
|
|
428
|
+
$('#instance-search-ins').val() !== '') ||
|
|
429
|
+
$('#instance-search-sid').val() === '#' ||
|
|
430
|
+
$('#instance-search-pid').val() === '#' ||
|
|
431
|
+
$('#instance-search-ins').val() === '#'
|
|
432
|
+
) {
|
|
433
|
+
$('#node-search-accept').css('color', '#555555');
|
|
434
|
+
readyToAccept = true;
|
|
435
|
+
} else {
|
|
436
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
437
|
+
readyToAccept = false;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Checks if + wildcard values are present, shows / hides alert message accordingly
|
|
443
|
+
*/
|
|
444
|
+
function checkWildcards() {
|
|
445
|
+
if (
|
|
446
|
+
$('#instance-search-sid').val() !== '+' &&
|
|
447
|
+
$('#instance-search-pid').val() !== '+' &&
|
|
448
|
+
$('#instance-search-ins').val() !== '+'
|
|
449
|
+
) {
|
|
450
|
+
$('#wildcard-alert-row').hide();
|
|
451
|
+
} else {
|
|
452
|
+
$('#wildcard-alert-row').show();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Update editable list with results from mobsearch
|
|
458
|
+
*/
|
|
459
|
+
function updateList() {
|
|
460
|
+
$(`#${opts.containerName}`)
|
|
461
|
+
.editableList('items')
|
|
462
|
+
.each(function (i) {
|
|
463
|
+
let item = $(this);
|
|
464
|
+
let secondField = item.find(`.${opts.containerSecondFieldName}`).val();
|
|
465
|
+
opts.list[i][Object.keys(opts.list[i])[1]] = secondField;
|
|
466
|
+
});
|
|
467
|
+
$(`#${opts.containerName}`).editableList('empty');
|
|
468
|
+
for (let i = 0; i < opts.list.length; i++) {
|
|
469
|
+
let item = opts.list[i];
|
|
470
|
+
$(`#${opts.containerName}`).editableList('addItem', item);
|
|
471
|
+
}
|
|
472
|
+
$(`#${opts.containerRowName}`).show();
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// * CLICK RESPONSE * //
|
|
476
|
+
|
|
477
|
+
$('#node-lookup-instance').click(function () {
|
|
478
|
+
if (mobConnected) {
|
|
479
|
+
//When search button is clicked
|
|
480
|
+
$('#instance-search-sid').val('');
|
|
481
|
+
$('#instance-search-pid').val('');
|
|
482
|
+
$('#instance-search-ins').val('');
|
|
483
|
+
if (useRid) {
|
|
484
|
+
$('#instance-search-rid').val('');
|
|
485
|
+
}
|
|
486
|
+
$('#node-lookup-instance').addClass('disabled');
|
|
487
|
+
$('#node-search-return').removeClass('disabled');
|
|
488
|
+
$('#node-search-accept').removeClass('disabled');
|
|
489
|
+
$('#instance-row').hide();
|
|
490
|
+
$('#instance-search-row').show();
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
$('#instance-search-sid').click(function () {
|
|
495
|
+
//SID field clicked
|
|
496
|
+
$('#instance-search-pid').val('');
|
|
497
|
+
$('#instance-search-ins').val('');
|
|
498
|
+
searchObject.pid = '';
|
|
499
|
+
searchObject.ins = '';
|
|
500
|
+
if (useRid) {
|
|
501
|
+
searchObject.rid = '';
|
|
502
|
+
}
|
|
503
|
+
searchObject.objects = [];
|
|
504
|
+
startSearch();
|
|
505
|
+
});
|
|
506
|
+
$('#instance-search-pid').click(function () {
|
|
507
|
+
//PID field clicked
|
|
508
|
+
$('#instance-search-ins').val('');
|
|
509
|
+
|
|
510
|
+
searchObject.ins = '';
|
|
511
|
+
|
|
512
|
+
if (useRid) {
|
|
513
|
+
$('#instance-search-rid').val('');
|
|
514
|
+
searchObject.rid = '';
|
|
515
|
+
}
|
|
516
|
+
if (searchObject.sid !== '') {
|
|
517
|
+
pidsSearch(searchObject.objects);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
$('#instance-search-ins').click(function () {
|
|
521
|
+
//INS field clicked
|
|
522
|
+
if (useRid) {
|
|
523
|
+
$('#instance-search-rid').val('');
|
|
524
|
+
searchObject.rid = '';
|
|
525
|
+
}
|
|
526
|
+
if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
|
|
527
|
+
insSearch(searchObject.objects, searchObject.pid);
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
if (useRid) {
|
|
532
|
+
$('#instance-search-rid').click(function () {
|
|
533
|
+
//RID clicked
|
|
534
|
+
if (
|
|
535
|
+
searchObject.ins !== '' &&
|
|
536
|
+
searchObject.ins !== '+' &&
|
|
537
|
+
searchObject.pid !== '+' &&
|
|
538
|
+
searchObject.sid !== '+'
|
|
539
|
+
) {
|
|
540
|
+
ridSearch(searchObject.objects, searchObject.ins);
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
$('#node-search-return').click(function () {
|
|
546
|
+
//Return/Back button clicked
|
|
547
|
+
$('#node-search-return').addClass('disabled');
|
|
548
|
+
$('#node-search-accept').addClass('disabled');
|
|
549
|
+
$('#node-lookup-instance').removeClass('disabled');
|
|
550
|
+
$('#instance-search-row').hide();
|
|
551
|
+
$('#instance-row').show();
|
|
552
|
+
});
|
|
553
|
+
$('#node-search-accept').click(function () {
|
|
554
|
+
//Accept button clicked
|
|
555
|
+
if (readyToAccept) {
|
|
556
|
+
finishSearch();
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// * END CLICK RESPONSE * //
|
|
561
|
+
|
|
562
|
+
// * CHANGE RESPONSE * //
|
|
563
|
+
|
|
564
|
+
$('#instance-search-hid').change(function () {
|
|
565
|
+
acceptCheck();
|
|
566
|
+
$('#instance-search-sid').val('');
|
|
567
|
+
$('#instance-search-pid').val('');
|
|
568
|
+
$('#instance-search-ins').val('');
|
|
569
|
+
if (useRid) {
|
|
570
|
+
$('#instance-search-rid').val('');
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
$('#instance-search-sid').change(function () {
|
|
575
|
+
searchObject.sid = $('#instance-search-sid').val();
|
|
576
|
+
acceptCheck();
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
$('#instance-search-pid').change(function () {
|
|
580
|
+
searchObject.pid = $('#instance-search-pid').val();
|
|
581
|
+
acceptCheck();
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
$('#instance-search-ins').change(function () {
|
|
585
|
+
searchObject.ins = $('#instance-search-ins').val();
|
|
586
|
+
acceptCheck();
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
if (useRid) {
|
|
590
|
+
$('#instance-search-rid').change(function () {
|
|
591
|
+
searchObject.rid = $('#instance-search-rid').val();
|
|
592
|
+
acceptCheck();
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// * END CHANGE RESPONSE * //
|
|
597
|
+
|
|
598
|
+
// reset input filed after init
|
|
599
|
+
if (!listed) {
|
|
600
|
+
$(`#${opts.uriFieldName}`).val(uriFieldValue);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright (C) 2016, IAConnects Technology Limited
|
|
3
|
+
All Rights Reserved
|
|
4
|
+
|
|
5
|
+
ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
|
|
6
|
+
THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
|
|
7
|
+
IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
|
|
8
|
+
HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
|
|
9
|
+
AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
|
|
10
|
+
DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
|
|
11
|
+
IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
|
|
12
|
+
FROM IACONNECTS TECHNOLOGY LIMITED.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
15
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
16
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
17
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
|
|
18
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
19
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
21
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
22
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
23
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
24
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
**/
|
|
26
|
+
export {};
|