node-red-contrib-mobius-flow-base 3.0.0 → 3.0.1
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.
|
@@ -7,7 +7,7 @@ exports.EngineApiClient = void 0;
|
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const engine_websocket_1 = require("./engine-websocket");
|
|
9
9
|
const engine_api_calls_1 = require("./engine-api-calls");
|
|
10
|
-
// new class
|
|
10
|
+
// new class
|
|
11
11
|
class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
|
|
12
12
|
reloginInterval = null;
|
|
13
13
|
client = null;
|
|
@@ -60,12 +60,11 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
|
|
|
60
60
|
this.client.interceptors.response.use((res) => {
|
|
61
61
|
return res;
|
|
62
62
|
}, async (error) => {
|
|
63
|
-
console.log(error);
|
|
64
63
|
if (!error.response) {
|
|
65
64
|
// notify
|
|
66
65
|
}
|
|
67
66
|
if (!error.config.url?.endsWith('/auth/login')) {
|
|
68
|
-
console.log(`(${this.hostname}) -> Logged Out: ${
|
|
67
|
+
console.log(`(${this.hostname}) -> Logged Out: ${error.response}`);
|
|
69
68
|
clearInterval(this.refreshLoop);
|
|
70
69
|
this.loggedIn = false;
|
|
71
70
|
this.tokens = null;
|
|
@@ -94,7 +93,6 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
|
|
|
94
93
|
this.EngineWebSocket.connectToWebSocket(this.tokens.token);
|
|
95
94
|
}
|
|
96
95
|
catch (e) {
|
|
97
|
-
console.log(JSON.stringify(e, null, 2));
|
|
98
96
|
clearInterval(this.refreshLoop);
|
|
99
97
|
if (this.EngineWebSocket) {
|
|
100
98
|
this.EngineWebSocket.disconnectFromWebSocket();
|
|
@@ -118,7 +116,6 @@ class EngineApiClient extends engine_api_calls_1.EngineApiCalls {
|
|
|
118
116
|
this.loggedIn = true;
|
|
119
117
|
}
|
|
120
118
|
catch (err) {
|
|
121
|
-
console.log(JSON.stringify(err));
|
|
122
119
|
console.log(`(${this.hostname}) -> Failed to refresh Mobius Engine API token`);
|
|
123
120
|
}
|
|
124
121
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { EventEmitter } from 'stream';
|
|
4
2
|
type WebSocketTopics = 'authorize' | 'subscribe' | 'unsubscribe' | 'connected' | 'authorized' | 'object-cov' | 'resource-cov' | 'service-status' | 'broadcast-command' | 'error' | 'ping' | 'pong';
|
|
5
3
|
interface EngineWebSocketInterface {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
containerName: 'node-input-resources-container',
|
|
24
24
|
containerSecondFieldName: 'node-input-resources-comment',
|
|
25
25
|
filterPids: ['0050', '005A'],
|
|
26
|
+
filterSpids: ['0032']
|
|
26
27
|
};
|
|
27
28
|
EXAMPLE OPTS OBJECT - context of getResource (standard node, not using editable list)
|
|
28
29
|
opts = {
|
|
@@ -31,104 +32,105 @@
|
|
|
31
32
|
searchButtonId: 'node-lookup-instance',
|
|
32
33
|
removeWildcards: true,
|
|
33
34
|
filterPids: ['0050', '005A'],
|
|
35
|
+
filterSpids: ['0032']
|
|
34
36
|
};
|
|
35
37
|
*
|
|
36
38
|
*
|
|
37
39
|
*
|
|
38
40
|
*/
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
initMobsearch = {
|
|
43
|
+
// Standard mobsearch to rid level
|
|
44
|
+
toRid: (mobiusSrvc, opts) => {
|
|
45
|
+
getMobsearch(mobiusSrvc, true, false, opts);
|
|
46
|
+
},
|
|
47
|
+
// Standard mobsearch to ins level
|
|
48
|
+
toIns: (mobiusSrvc, opts) => {
|
|
49
|
+
getMobsearch(mobiusSrvc, false, false, opts);
|
|
50
|
+
},
|
|
51
|
+
// Mobsearch to rid level, for nodes using editable list
|
|
52
|
+
toRid_listed: (mobiusSrvc, opts) => {
|
|
53
|
+
getMobsearch(mobiusSrvc, true, true, opts);
|
|
54
|
+
},
|
|
55
|
+
// Mobsearch to ins level, for nodes using editable list
|
|
56
|
+
toIns_listed: (mobiusSrvc, opts) => {
|
|
57
|
+
getMobsearch(mobiusSrvc, false, true, opts);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Make / Reset global selectionIndex vairable (variable to allow setting of correct list field)
|
|
62
|
+
if (typeof selectionIndex === undefined) {
|
|
63
|
+
let selectionIndex = 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* function to add search button functionality to list rows
|
|
68
|
+
* @param {object} field - The search field within a given list row
|
|
69
|
+
* @param {number} rowIndex - The list row index
|
|
70
|
+
* @param {object} opts - Mobsearch options object
|
|
71
|
+
*/
|
|
72
|
+
function addMobsearchListButton(mobiusSrvc, field, rowIndex, opts) {
|
|
73
|
+
if (mobiusSrvc !== '_ADD_') {
|
|
74
|
+
$.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
|
|
75
|
+
if (!response) {
|
|
76
|
+
field.css('color', '#CCCCCC');
|
|
77
|
+
} else {
|
|
78
|
+
field.click(function () {
|
|
79
|
+
selectionIndex = rowIndex;
|
|
80
|
+
$(`#${opts.containerRowName}`).hide();
|
|
81
|
+
$('#instance-search-sid').val('');
|
|
82
|
+
$('#instance-search-pid').val('');
|
|
83
|
+
$('#instance-search-ins').val('');
|
|
84
|
+
$('#instance-search-rid').val('');
|
|
85
|
+
$('#node-search-return').removeClass('disabled');
|
|
86
|
+
$('#node-search-accept').removeClass('disabled');
|
|
87
|
+
$('#instance-search-row').show();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
field.css('color', '#CCCCCC');
|
|
62
93
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
$(`#${opts.containerRowName}`).hide();
|
|
79
|
-
$('#instance-search-sid').val('');
|
|
80
|
-
$('#instance-search-pid').val('');
|
|
81
|
-
$('#instance-search-ins').val('');
|
|
82
|
-
$('#instance-search-rid').val('');
|
|
83
|
-
$('#node-search-return').removeClass('disabled');
|
|
84
|
-
$('#node-search-accept').removeClass('disabled');
|
|
85
|
-
$('#instance-search-row').show();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
field.css('color', '#CCCCCC');
|
|
91
|
-
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @param mobiusSrvc - Connection to Mobius
|
|
99
|
+
* @param {boolean} useRid - Flag for Mobsearch to include rid field
|
|
100
|
+
* @param {boolean} listed - Flag for Mobsearch work with nodes using editableLists
|
|
101
|
+
* @param {object} opts - Mobsearhc options object
|
|
102
|
+
*/
|
|
103
|
+
function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
104
|
+
selectionIndex = 0;
|
|
105
|
+
// Get current state of input field
|
|
106
|
+
let uriFieldValue = '';
|
|
107
|
+
if (!listed) {
|
|
108
|
+
uriFieldValue = $(`#${opts.uriFieldName}`).val();
|
|
92
109
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
* @param {boolean} useRid - Flag for Mobsearch to include rid field
|
|
98
|
-
* @param {boolean} listed - Flag for Mobsearch work with nodes using editableLists
|
|
99
|
-
* @param {object} opts - Mobsearhc options object
|
|
100
|
-
*/
|
|
101
|
-
function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
102
|
-
selectionIndex = 0;
|
|
103
|
-
// Get current state of input field
|
|
104
|
-
let uriFieldValue = '';
|
|
105
|
-
if (!listed) {
|
|
106
|
-
uriFieldValue = $(`#${opts.uriFieldName}`).val();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// * HTML INJECTION * //
|
|
110
|
-
|
|
111
|
-
const resourceHtml = `
|
|
110
|
+
|
|
111
|
+
// * HTML INJECTION * //
|
|
112
|
+
|
|
113
|
+
const resourceHtml = `
|
|
112
114
|
<input type="text" id="instance-search-hid" style="width:13%;" placeholder="HID">
|
|
113
115
|
<input type="text" id="instance-search-sid" style="width:8%;" placeholder="SID">
|
|
114
116
|
<input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
|
|
115
117
|
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
116
118
|
<input type="text" id="instance-search-rid" style="width:8%;" placeholder="RID">
|
|
117
119
|
`;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
|
|
121
|
+
const instanceHtml = `
|
|
120
122
|
<input type="text" id="instance-search-hid" style="width:15%;" placeholder="HID">
|
|
121
123
|
<input type="text" id="instance-search-sid" style="width:10%;" placeholder="SID">
|
|
122
124
|
<input type="text" id="instance-search-pid" style="width:10%;" placeholder="PID">
|
|
123
125
|
<input type="text" id="instance-search-ins" style="width:10%;" placeholder="INS">
|
|
124
126
|
`;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
|
|
128
|
+
//set level dependent html
|
|
129
|
+
let rows = useRid === true ? resourceHtml : instanceHtml;
|
|
130
|
+
let alertMsg = useRid === true ? `and/or RID ` : ``;
|
|
131
|
+
|
|
132
|
+
//Inject new html
|
|
133
|
+
document.getElementById(opts.htmlElementId).innerHTML += `
|
|
132
134
|
<div id="bad-connection-alert" style="color:#FF0000" align="center">
|
|
133
135
|
<p>Setup and deploy MOBiUS connection to allow search.</p>
|
|
134
136
|
</div>
|
|
@@ -147,496 +149,523 @@
|
|
|
147
149
|
INS ${alertMsg}manually.</p>
|
|
148
150
|
</div>
|
|
149
151
|
`;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
} else {
|
|
162
|
-
$('#bad-connection-alert').hide();
|
|
163
|
-
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
164
|
-
$('#instance-search-hid').val(response);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
$('#instance-search-row').hide();
|
|
170
|
-
$('#wildcard-alert-row').hide();
|
|
171
|
-
$('#node-search-return').addClass('disabled');
|
|
172
|
-
let readyToAccept = false;
|
|
173
|
-
|
|
174
|
-
let searchObject = {};
|
|
175
|
-
if (listed) {
|
|
176
|
-
searchObject = {
|
|
177
|
-
hid: '',
|
|
178
|
-
sid: '',
|
|
179
|
-
pid: '',
|
|
180
|
-
ins: '',
|
|
181
|
-
rid: '',
|
|
182
|
-
objects: [],
|
|
183
|
-
};
|
|
152
|
+
|
|
153
|
+
// * END HTML INJECTION * //
|
|
154
|
+
|
|
155
|
+
// * INIT SETUP * //
|
|
156
|
+
|
|
157
|
+
let mobConnected = false;
|
|
158
|
+
$.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
|
|
159
|
+
mobConnected = response;
|
|
160
|
+
if (!mobConnected) {
|
|
161
|
+
$(`#${opts.searchButtonId}`).css('color', '#CCCCCC');
|
|
162
|
+
$('#bad-connection-alert').show();
|
|
184
163
|
} else {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
ins: $('#instance-search-ins').val(),
|
|
190
|
-
rid: $('#instance-search-rid').val(),
|
|
191
|
-
objects: [],
|
|
192
|
-
};
|
|
164
|
+
$('#bad-connection-alert').hide();
|
|
165
|
+
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
166
|
+
$('#instance-search-hid').val(response);
|
|
167
|
+
});
|
|
193
168
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
$('#instance-search-row').hide();
|
|
172
|
+
$('#wildcard-alert-row').hide();
|
|
173
|
+
$('#node-search-return').addClass('disabled');
|
|
174
|
+
let readyToAccept = false;
|
|
175
|
+
|
|
176
|
+
let searchObject = {};
|
|
177
|
+
if (listed) {
|
|
178
|
+
searchObject = {
|
|
179
|
+
hid: '',
|
|
180
|
+
sid: '',
|
|
181
|
+
pid: '',
|
|
182
|
+
ins: '',
|
|
183
|
+
rid: '',
|
|
184
|
+
objects: [],
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
searchObject = {
|
|
188
|
+
hid: $('#instance-search-hid').val(),
|
|
189
|
+
sid: $('#instance-search-sid').val(),
|
|
190
|
+
pid: $('#instance-search-pid').val(),
|
|
191
|
+
ins: $('#instance-search-ins').val(),
|
|
192
|
+
rid: $('#instance-search-rid').val(),
|
|
193
|
+
objects: [],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// * END INIT SETUP * //
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Search for RIDs options for a given PID
|
|
201
|
+
* @param {object} objects - Response from call to Mobiu, list of mobius objects
|
|
202
|
+
* @param {string} pid - The chosen PID
|
|
203
|
+
*/
|
|
204
|
+
function ridSearch(objects, ins) {
|
|
205
|
+
$.getJSON(
|
|
206
|
+
`mgetresourceoptions?mobius=${mobiusSrvc}&hid=${searchObject.hid}&pid=${searchObject.pid}`,
|
|
207
|
+
(response) => {
|
|
208
|
+
resList = response;
|
|
209
|
+
ress = opts.removeWildcards ? [] : ['#'];
|
|
210
|
+
for (let j = 0; j < resList.length; j++) {
|
|
211
|
+
ress.push(`${resList[j].rid} - ${resList[j].name}`);
|
|
223
212
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
213
|
+
$('#instance-search-rid')
|
|
214
|
+
.autocomplete({
|
|
215
|
+
source: ress,
|
|
216
|
+
minLength: 0,
|
|
217
|
+
close: function (event, ui) {
|
|
218
|
+
acceptCheck();
|
|
219
|
+
$('#instance-search-rid').autocomplete('destroy');
|
|
220
|
+
$('#instance-search-rid').val(
|
|
221
|
+
$('#instance-search-rid').val().substring(0, 2)
|
|
222
|
+
);
|
|
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
|
+
$('#instance-search-rid').removeAttr('disabled');
|
|
238
|
+
let inss = opts.removeWildcards ? [] : ['#', '+'];
|
|
239
|
+
for (let i = 0; i < objects.length; i++) {
|
|
240
|
+
if (objects[i].pid === pid) {
|
|
241
|
+
const name = objects[i].name ? objects[i].name : '';
|
|
242
|
+
if (name === '') {
|
|
243
|
+
inss.push(objects[i].ins);
|
|
244
|
+
} else {
|
|
245
|
+
inss.push(`${objects[i].ins} - ${name}`);
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
|
-
$('#instance-search-ins')
|
|
246
|
-
.autocomplete({
|
|
247
|
-
source: inss,
|
|
248
|
-
minLength: 0,
|
|
249
|
-
close: function (event, ui) {
|
|
250
|
-
acceptCheck();
|
|
251
|
-
$('#instance-search-ins').autocomplete('destroy');
|
|
252
|
-
if ($('#instance-search-ins').val().length > 4) {
|
|
253
|
-
$('#instance-search-ins').val($('#instance-search-ins').val().substring(0, 4));
|
|
254
|
-
}
|
|
255
|
-
searchObject.ins = $('#instance-search-ins').val();
|
|
256
|
-
if (searchObject.ins === '#') {
|
|
257
|
-
$('#instance-search-rid').attr("disabled", "disabled");
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
})
|
|
261
|
-
.autocomplete('search', '');
|
|
262
248
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if (opts.filterPids) {
|
|
275
|
-
console.log(opts.filterPids);
|
|
276
|
-
if (opts.filterPids.includes(objects[i].pid)) {
|
|
277
|
-
pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
|
|
249
|
+
$('#instance-search-ins')
|
|
250
|
+
.autocomplete({
|
|
251
|
+
source: inss,
|
|
252
|
+
minLength: 0,
|
|
253
|
+
close: function (event, ui) {
|
|
254
|
+
acceptCheck();
|
|
255
|
+
$('#instance-search-ins').autocomplete('destroy');
|
|
256
|
+
if ($('#instance-search-ins').val().length > 4) {
|
|
257
|
+
$('#instance-search-ins').val(
|
|
258
|
+
$('#instance-search-ins').val().substring(0, 4)
|
|
259
|
+
);
|
|
278
260
|
}
|
|
279
|
-
|
|
261
|
+
searchObject.ins = $('#instance-search-ins').val();
|
|
262
|
+
if (searchObject.ins === '#') {
|
|
263
|
+
$('#instance-search-rid').attr('disabled', 'disabled');
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
.autocomplete('search', '');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Search for PIDs present on selected service
|
|
272
|
+
* @param {object} objects - Response from call to Mobius, list of mobius objects
|
|
273
|
+
*/
|
|
274
|
+
function pidsSearch(objects) {
|
|
275
|
+
$('#instance-search-ins').removeAttr('disabled');
|
|
276
|
+
$('#instance-search-rid').removeAttr('disabled');
|
|
277
|
+
searchObject.objects = objects;
|
|
278
|
+
let pids = opts.removeWildcards ? [] : ['#', '+'];
|
|
279
|
+
for (let i = 0; i < objects.length; i++) {
|
|
280
|
+
if (opts.filterPids) {
|
|
281
|
+
if (opts.filterPids.includes(objects[i].pid)) {
|
|
280
282
|
pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
|
|
281
283
|
}
|
|
284
|
+
} else {
|
|
285
|
+
pids.push(`${objects[i].pid} - ${objects[i].profileName}`);
|
|
282
286
|
}
|
|
283
|
-
pids = [...new Set(pids)];
|
|
284
|
-
$('#instance-search-pid')
|
|
285
|
-
.autocomplete({
|
|
286
|
-
source: pids,
|
|
287
|
-
minLength: 0,
|
|
288
|
-
close: function (event, ui) {
|
|
289
|
-
acceptCheck();
|
|
290
|
-
$('#instance-search-pid').autocomplete('destroy');
|
|
291
|
-
if ($('#instance-search-pid').val().length > 4) {
|
|
292
|
-
$('#instance-search-pid').val($('#instance-search-pid').val().substring(0, 4));
|
|
293
|
-
}
|
|
294
|
-
searchObject.pid = $('#instance-search-pid').val();
|
|
295
|
-
if (searchObject.pid === '#') {
|
|
296
|
-
$('#instance-search-ins').attr("disabled", "disabled");
|
|
297
|
-
$('#instance-search-rid').attr("disabled", "disabled");
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
})
|
|
301
|
-
.autocomplete('search', '');
|
|
302
287
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
288
|
+
pids = [...new Set(pids)];
|
|
289
|
+
$('#instance-search-pid')
|
|
290
|
+
.autocomplete({
|
|
291
|
+
source: pids,
|
|
292
|
+
minLength: 0,
|
|
293
|
+
close: function (event, ui) {
|
|
294
|
+
acceptCheck();
|
|
295
|
+
$('#instance-search-pid').autocomplete('destroy');
|
|
296
|
+
if ($('#instance-search-pid').val().length > 4) {
|
|
297
|
+
$('#instance-search-pid').val(
|
|
298
|
+
$('#instance-search-pid').val().substring(0, 4)
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
searchObject.pid = $('#instance-search-pid').val();
|
|
302
|
+
if (searchObject.pid === '#') {
|
|
303
|
+
$('#instance-search-ins').attr('disabled', 'disabled');
|
|
304
|
+
$('#instance-search-rid').attr('disabled', 'disabled');
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
})
|
|
308
|
+
.autocomplete('search', '');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Search for SIDs, and then fetch child objects based on selection
|
|
313
|
+
* @param {object} response - Response from call to Mobius
|
|
314
|
+
*/
|
|
315
|
+
function serviceSearch(response) {
|
|
316
|
+
$('#instance-search-pid').removeAttr('disabled');
|
|
317
|
+
$('#instance-search-ins').removeAttr('disabled');
|
|
318
|
+
$('#instance-search-rid').removeAttr('disabled');
|
|
319
|
+
let services = opts.removeWildcards ? [] : ['#', '+'];
|
|
320
|
+
for (let i = 0; i < response.length; i++) {
|
|
321
|
+
if (response[i].sid !== '009') {
|
|
322
|
+
if (opts.filterSpids) {
|
|
323
|
+
if (opts.filterSpids.includes(response[i].sid)) {
|
|
324
|
+
services.push(`${response[i].sid} - ${response[i].name}`);
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
315
327
|
services.push(`${response[i].sid} - ${response[i].name}`);
|
|
316
328
|
}
|
|
317
329
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${services[
|
|
342
|
-
i
|
|
343
|
-
].substring(0, 3)}`,
|
|
344
|
-
(objects) => {
|
|
345
|
-
searchObject.objects = searchObject.objects.concat(objects);
|
|
346
|
-
}
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
} else {
|
|
350
|
-
if (searchObject.sid.length !== 3) {
|
|
330
|
+
}
|
|
331
|
+
$('#instance-search-sid')
|
|
332
|
+
.autocomplete({
|
|
333
|
+
source: services,
|
|
334
|
+
minLength: 0,
|
|
335
|
+
close: function (event, ui) {
|
|
336
|
+
acceptCheck();
|
|
337
|
+
$('#instance-search-sid').autocomplete('destroy');
|
|
338
|
+
if ($('#instance-search-sid').val().length > 3) {
|
|
339
|
+
$('#instance-search-sid').val(
|
|
340
|
+
$('#instance-search-sid').val().substring(0, 3)
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
searchObject.sid = $('#instance-search-sid').val();
|
|
344
|
+
if (searchObject.sid === '#') {
|
|
345
|
+
$('#instance-search-pid').attr('disabled', 'disabled');
|
|
346
|
+
$('#instance-search-ins').attr('disabled', 'disabled');
|
|
347
|
+
$('#instance-search-rid').attr('disabled', 'disabled');
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (searchObject.sid === '+') {
|
|
351
|
+
for (let i = 2; i < services.length; i++) {
|
|
352
|
+
if (services[i].substring(0, 3).length !== 3) {
|
|
351
353
|
return;
|
|
352
354
|
}
|
|
353
355
|
$.getJSON(
|
|
354
|
-
`mgetobjects?mobius=${mobiusSrvc}&hid=${
|
|
356
|
+
`mgetobjects?mobius=${mobiusSrvc}&hid=${
|
|
357
|
+
searchObject.hid
|
|
358
|
+
}&sid=${services[i].substring(0, 3)}`,
|
|
355
359
|
(objects) => {
|
|
356
|
-
searchObject.objects = objects;
|
|
360
|
+
searchObject.objects = searchObject.objects.concat(objects);
|
|
357
361
|
}
|
|
358
362
|
);
|
|
359
363
|
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
$('#instance-search-sid').val('');
|
|
371
|
-
$('#instance-search-pid').val('');
|
|
372
|
-
$('#instance-search-ins').val('');
|
|
373
|
-
searchObject.hid = $('#instance-search-hid').val();
|
|
374
|
-
searchObject.sid = '';
|
|
375
|
-
searchObject.pid = '';
|
|
376
|
-
searchObject.ins = '';
|
|
377
|
-
if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
|
|
378
|
-
$.getJSON(`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`, serviceSearch).fail(
|
|
379
|
-
(err) => {
|
|
380
|
-
console.log('Mobsearch failed to contact Mobius');
|
|
364
|
+
} else {
|
|
365
|
+
if (searchObject.sid.length !== 3) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
$.getJSON(
|
|
369
|
+
`mgetobjects?mobius=${mobiusSrvc}&hid=${searchObject.hid}&sid=${searchObject.sid}`,
|
|
370
|
+
(objects) => {
|
|
371
|
+
searchObject.objects = objects;
|
|
372
|
+
}
|
|
373
|
+
);
|
|
381
374
|
}
|
|
382
|
-
|
|
383
|
-
}
|
|
375
|
+
},
|
|
376
|
+
})
|
|
377
|
+
.autocomplete('search', '');
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Start mobsearch
|
|
382
|
+
*/
|
|
383
|
+
function startSearch() {
|
|
384
|
+
$('#wildcard-alert-row').hide();
|
|
385
|
+
$('#instance-search-sid').val('');
|
|
386
|
+
$('#instance-search-pid').val('');
|
|
387
|
+
$('#instance-search-ins').val('');
|
|
388
|
+
searchObject.hid = $('#instance-search-hid').val();
|
|
389
|
+
searchObject.sid = '';
|
|
390
|
+
searchObject.pid = '';
|
|
391
|
+
searchObject.ins = '';
|
|
392
|
+
if (/((^([0-9A-F]){6}$)|^$)/.test(searchObject.hid)) {
|
|
393
|
+
$.getJSON(
|
|
394
|
+
`mgetservices?mobius=${mobiusSrvc}&hid=${searchObject.hid}`,
|
|
395
|
+
serviceSearch
|
|
396
|
+
).fail((err) => {
|
|
397
|
+
console.log('Mobsearch failed to contact Mobius');
|
|
398
|
+
});
|
|
384
399
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
if (uri.includes('#')) {
|
|
399
|
-
uri = uri.substring(0, uri.indexOf('#') + 1);
|
|
400
|
-
}
|
|
401
|
-
if (listed) {
|
|
402
|
-
tempList = JSON.parse(JSON.stringify(opts.list)); // Pre List
|
|
403
|
-
if (tempList.length === selectionIndex) {
|
|
404
|
-
tempList.push({uri, type: 'unknown'})
|
|
405
|
-
} else {
|
|
406
|
-
tempList[selectionIndex].uri = uri;
|
|
407
|
-
}
|
|
408
|
-
updateList();
|
|
409
|
-
opts.list = JSON.parse(JSON.stringify(tempList)); // Set log
|
|
410
|
-
} else {
|
|
411
|
-
$(`#${opts.uriFieldName}`).val(uri);
|
|
412
|
-
document.getElementById(opts.uriFieldName).dispatchEvent(new Event('change'));
|
|
413
|
-
$(`#${opts.searchButtonId}`).removeClass('disabled');
|
|
414
|
-
}
|
|
415
|
-
$('#node-search-accept').css('color', '#CCCCCC');
|
|
416
|
-
readyToAccept = false;
|
|
417
|
-
$('#node-search-return').addClass('disabled');
|
|
418
|
-
$('#node-search-accept').addClass('disabled');
|
|
419
|
-
$('#instance-search-row').hide();
|
|
420
|
-
$('#instance-row').show();
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Used to temporarily store updated list items
|
|
403
|
+
let tempList = [];
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Finish mobsearch, compile full URI and set value in host node
|
|
407
|
+
*/
|
|
408
|
+
function finishSearch() {
|
|
409
|
+
$('#wildcard-alert-row').hide();
|
|
410
|
+
let uri = `${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`;
|
|
411
|
+
if (useRid) {
|
|
412
|
+
uri = uri + `/${searchObject.rid}`;
|
|
421
413
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
* Update if accept button is grade out and functional, based on conditions of fields
|
|
425
|
-
*/
|
|
426
|
-
function acceptCheck() {
|
|
427
|
-
if (useRid) {
|
|
428
|
-
checkFieldsToRid();
|
|
429
|
-
} else {
|
|
430
|
-
checkFieldsToIns();
|
|
431
|
-
}
|
|
432
|
-
checkWildcards();
|
|
414
|
+
if (uri.includes('#')) {
|
|
415
|
+
uri = uri.substring(0, uri.indexOf('#') + 1);
|
|
433
416
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
function checkFieldsToRid() {
|
|
439
|
-
const wildcardPass = !opts.removeWildcards && ($('#instance-search-sid').val() === '#' ||
|
|
440
|
-
$('#instance-search-pid').val() === '#' ||
|
|
441
|
-
$('#instance-search-ins').val() === '#' ||
|
|
442
|
-
$('#instance-search-rid').val() === '#')
|
|
443
|
-
if (
|
|
444
|
-
($('#instance-search-hid').val() !== '' &&
|
|
445
|
-
$('#instance-search-sid').val() !== '' &&
|
|
446
|
-
$('#instance-search-pid').val() !== '' &&
|
|
447
|
-
$('#instance-search-ins').val() !== '' &&
|
|
448
|
-
$('#instance-search-rid').val() !== '') || wildcardPass
|
|
449
|
-
) {
|
|
450
|
-
$('#node-search-accept').css('color', '#555555');
|
|
451
|
-
readyToAccept = true;
|
|
417
|
+
if (listed) {
|
|
418
|
+
tempList = JSON.parse(JSON.stringify(opts.list)); // Pre List
|
|
419
|
+
if (tempList.length === selectionIndex) {
|
|
420
|
+
tempList.push({ uri, type: 'unknown' });
|
|
452
421
|
} else {
|
|
453
|
-
|
|
454
|
-
readyToAccept = false;
|
|
422
|
+
tempList[selectionIndex].uri = uri;
|
|
455
423
|
}
|
|
424
|
+
updateList();
|
|
425
|
+
opts.list = JSON.parse(JSON.stringify(tempList)); // Set log
|
|
426
|
+
} else {
|
|
427
|
+
$(`#${opts.uriFieldName}`).val(uri);
|
|
428
|
+
document
|
|
429
|
+
.getElementById(opts.uriFieldName)
|
|
430
|
+
.dispatchEvent(new Event('change'));
|
|
431
|
+
$(`#${opts.searchButtonId}`).removeClass('disabled');
|
|
456
432
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
)
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
} else {
|
|
474
|
-
$('#node-search-accept').css('color', '#CCCCCC');
|
|
475
|
-
readyToAccept = false;
|
|
476
|
-
}
|
|
433
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
434
|
+
readyToAccept = false;
|
|
435
|
+
$('#node-search-return').addClass('disabled');
|
|
436
|
+
$('#node-search-accept').addClass('disabled');
|
|
437
|
+
$('#instance-search-row').hide();
|
|
438
|
+
$('#instance-row').show();
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Update if accept button is grade out and functional, based on conditions of fields
|
|
443
|
+
*/
|
|
444
|
+
function acceptCheck() {
|
|
445
|
+
if (useRid) {
|
|
446
|
+
checkFieldsToRid();
|
|
447
|
+
} else {
|
|
448
|
+
checkFieldsToIns();
|
|
477
449
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
)
|
|
488
|
-
$('#
|
|
489
|
-
|
|
490
|
-
$('#
|
|
491
|
-
|
|
450
|
+
checkWildcards();
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Check state of all field to rid level, change state of accept button accordingly
|
|
455
|
+
*/
|
|
456
|
+
function checkFieldsToRid() {
|
|
457
|
+
const wildcardPass =
|
|
458
|
+
!opts.removeWildcards &&
|
|
459
|
+
($('#instance-search-sid').val() === '#' ||
|
|
460
|
+
$('#instance-search-pid').val() === '#' ||
|
|
461
|
+
$('#instance-search-ins').val() === '#' ||
|
|
462
|
+
$('#instance-search-rid').val() === '#');
|
|
463
|
+
if (
|
|
464
|
+
($('#instance-search-hid').val() !== '' &&
|
|
465
|
+
$('#instance-search-sid').val() !== '' &&
|
|
466
|
+
$('#instance-search-pid').val() !== '' &&
|
|
467
|
+
$('#instance-search-ins').val() !== '' &&
|
|
468
|
+
$('#instance-search-rid').val() !== '') ||
|
|
469
|
+
wildcardPass
|
|
470
|
+
) {
|
|
471
|
+
$('#node-search-accept').css('color', '#555555');
|
|
472
|
+
readyToAccept = true;
|
|
473
|
+
} else {
|
|
474
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
475
|
+
readyToAccept = false;
|
|
492
476
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
$(
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
$(
|
|
509
|
-
|
|
510
|
-
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Check state of all field to ins level, change state of accept button accordingly
|
|
481
|
+
*/
|
|
482
|
+
function checkFieldsToIns() {
|
|
483
|
+
const wildcardPass =
|
|
484
|
+
!opts.removeWildcards &&
|
|
485
|
+
($('#instance-search-sid').val() === '#' ||
|
|
486
|
+
$('#instance-search-pid').val() === '#' ||
|
|
487
|
+
$('#instance-search-ins').val() === '#');
|
|
488
|
+
if (
|
|
489
|
+
($('#instance-search-hid').val() !== '' &&
|
|
490
|
+
$('#instance-search-sid').val() !== '' &&
|
|
491
|
+
$('#instance-search-pid').val() !== '' &&
|
|
492
|
+
$('#instance-search-ins').val() !== '') ||
|
|
493
|
+
wildcardPass
|
|
494
|
+
) {
|
|
495
|
+
$('#node-search-accept').css('color', '#555555');
|
|
496
|
+
readyToAccept = true;
|
|
497
|
+
} else {
|
|
498
|
+
$('#node-search-accept').css('color', '#CCCCCC');
|
|
499
|
+
readyToAccept = false;
|
|
511
500
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
searchObject.objects = [];
|
|
542
|
-
startSearch();
|
|
543
|
-
});
|
|
544
|
-
$('#instance-search-pid').click(function () {
|
|
545
|
-
//PID field clicked
|
|
546
|
-
$('#instance-search-ins').val('');
|
|
547
|
-
|
|
548
|
-
searchObject.ins = '';
|
|
549
|
-
|
|
550
|
-
if (useRid) {
|
|
551
|
-
$('#instance-search-rid').val('');
|
|
552
|
-
searchObject.rid = '';
|
|
553
|
-
}
|
|
554
|
-
if (searchObject.sid !== '') {
|
|
555
|
-
pidsSearch(searchObject.objects);
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
$('#instance-search-ins').click(function () {
|
|
559
|
-
//INS field clicked
|
|
560
|
-
if (useRid) {
|
|
561
|
-
$('#instance-search-rid').val('');
|
|
562
|
-
searchObject.rid = '';
|
|
563
|
-
}
|
|
564
|
-
if (searchObject.pid !== '' && searchObject.pid !== '+' && searchObject.sid !== '+') {
|
|
565
|
-
insSearch(searchObject.objects, searchObject.pid);
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
if (useRid) {
|
|
570
|
-
$('#instance-search-rid').click(function () {
|
|
571
|
-
//RID clicked
|
|
572
|
-
if (
|
|
573
|
-
searchObject.ins !== '' &&
|
|
574
|
-
searchObject.ins !== '+' &&
|
|
575
|
-
searchObject.pid !== '+' &&
|
|
576
|
-
searchObject.sid !== '+'
|
|
577
|
-
) {
|
|
578
|
-
ridSearch(searchObject.objects, searchObject.ins);
|
|
579
|
-
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Checks if + wildcard values are present, shows / hides alert message accordingly
|
|
505
|
+
*/
|
|
506
|
+
function checkWildcards() {
|
|
507
|
+
if (
|
|
508
|
+
$('#instance-search-sid').val() !== '+' &&
|
|
509
|
+
$('#instance-search-pid').val() !== '+' &&
|
|
510
|
+
$('#instance-search-ins').val() !== '+'
|
|
511
|
+
) {
|
|
512
|
+
$('#wildcard-alert-row').hide();
|
|
513
|
+
} else {
|
|
514
|
+
$('#wildcard-alert-row').show();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Update editable list with results from mobsearch
|
|
520
|
+
*/
|
|
521
|
+
function updateList() {
|
|
522
|
+
$(`#${opts.containerName}`)
|
|
523
|
+
.editableList('items')
|
|
524
|
+
.each(function (i) {
|
|
525
|
+
let item = $(this);
|
|
526
|
+
let secondField = item.find(`.${opts.containerSecondFieldName}`).val();
|
|
527
|
+
tempList[i][Object.keys(tempList[i])[1]] = JSON.parse(
|
|
528
|
+
JSON.stringify(secondField)
|
|
529
|
+
);
|
|
580
530
|
});
|
|
531
|
+
$(`#${opts.containerName}`).editableList('empty');
|
|
532
|
+
for (let i = 0; i < tempList.length; i++) {
|
|
533
|
+
let item = tempList[i];
|
|
534
|
+
$(`#${opts.containerName}`).editableList('addItem', item);
|
|
581
535
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
$(`#${opts.containerRowName}`).show();
|
|
591
|
-
});
|
|
592
|
-
$('#node-search-accept').click(function () {
|
|
593
|
-
//Accept button clicked
|
|
594
|
-
if (readyToAccept) {
|
|
595
|
-
finishSearch();
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
// * END CLICK RESPONSE * //
|
|
600
|
-
|
|
601
|
-
// * CHANGE RESPONSE * //
|
|
602
|
-
|
|
603
|
-
$('#instance-search-hid').change(function () {
|
|
604
|
-
acceptCheck();
|
|
536
|
+
$(`#${opts.containerRowName}`).show();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// * CLICK RESPONSE * //
|
|
540
|
+
|
|
541
|
+
$(`#${opts.searchButtonId}`).click(function () {
|
|
542
|
+
if (mobConnected) {
|
|
543
|
+
//When search button is clicked
|
|
605
544
|
$('#instance-search-sid').val('');
|
|
606
545
|
$('#instance-search-pid').val('');
|
|
607
546
|
$('#instance-search-ins').val('');
|
|
608
547
|
if (useRid) {
|
|
609
548
|
$('#instance-search-rid').val('');
|
|
610
549
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
acceptCheck();
|
|
626
|
-
});
|
|
627
|
-
|
|
550
|
+
$(`#${opts.searchButtonId}`).addClass('disabled');
|
|
551
|
+
$('#node-search-return').removeClass('disabled');
|
|
552
|
+
$('#node-search-accept').removeClass('disabled');
|
|
553
|
+
$('#instance-row').hide();
|
|
554
|
+
$('#instance-search-row').show();
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
$('#instance-search-sid').click(function () {
|
|
559
|
+
//SID field clicked
|
|
560
|
+
$('#instance-search-pid').val('');
|
|
561
|
+
$('#instance-search-ins').val('');
|
|
562
|
+
searchObject.pid = '';
|
|
563
|
+
searchObject.ins = '';
|
|
628
564
|
if (useRid) {
|
|
629
|
-
|
|
630
|
-
searchObject.rid = $('#instance-search-rid').val();
|
|
631
|
-
acceptCheck();
|
|
632
|
-
});
|
|
565
|
+
searchObject.rid = '';
|
|
633
566
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
567
|
+
searchObject.objects = [];
|
|
568
|
+
startSearch();
|
|
569
|
+
});
|
|
570
|
+
$('#instance-search-pid').click(function () {
|
|
571
|
+
//PID field clicked
|
|
572
|
+
$('#instance-search-ins').val('');
|
|
573
|
+
|
|
574
|
+
searchObject.ins = '';
|
|
575
|
+
|
|
576
|
+
if (useRid) {
|
|
577
|
+
$('#instance-search-rid').val('');
|
|
578
|
+
searchObject.rid = '';
|
|
579
|
+
}
|
|
580
|
+
if (searchObject.sid !== '') {
|
|
581
|
+
pidsSearch(searchObject.objects);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
$('#instance-search-ins').click(function () {
|
|
585
|
+
//INS field clicked
|
|
586
|
+
if (useRid) {
|
|
587
|
+
$('#instance-search-rid').val('');
|
|
588
|
+
searchObject.rid = '';
|
|
589
|
+
}
|
|
590
|
+
if (
|
|
591
|
+
searchObject.pid !== '' &&
|
|
592
|
+
searchObject.pid !== '+' &&
|
|
593
|
+
searchObject.sid !== '+'
|
|
594
|
+
) {
|
|
595
|
+
insSearch(searchObject.objects, searchObject.pid);
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
if (useRid) {
|
|
600
|
+
$('#instance-search-rid').click(function () {
|
|
601
|
+
//RID clicked
|
|
602
|
+
if (
|
|
603
|
+
searchObject.ins !== '' &&
|
|
604
|
+
searchObject.ins !== '+' &&
|
|
605
|
+
searchObject.pid !== '+' &&
|
|
606
|
+
searchObject.sid !== '+'
|
|
607
|
+
) {
|
|
608
|
+
ridSearch(searchObject.objects, searchObject.ins);
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
$('#node-search-return').click(function () {
|
|
614
|
+
//Return/Back button clicked
|
|
615
|
+
$('#node-search-return').addClass('disabled');
|
|
616
|
+
$('#node-search-accept').addClass('disabled');
|
|
617
|
+
$(`#${opts.searchButtonId}`).removeClass('disabled');
|
|
618
|
+
$('#instance-search-row').hide();
|
|
619
|
+
$('#instance-row').show();
|
|
620
|
+
$(`#${opts.containerRowName}`).show();
|
|
621
|
+
});
|
|
622
|
+
$('#node-search-accept').click(function () {
|
|
623
|
+
//Accept button clicked
|
|
624
|
+
if (readyToAccept) {
|
|
625
|
+
finishSearch();
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// * END CLICK RESPONSE * //
|
|
630
|
+
|
|
631
|
+
// * CHANGE RESPONSE * //
|
|
632
|
+
|
|
633
|
+
$('#instance-search-hid').change(function () {
|
|
634
|
+
acceptCheck();
|
|
635
|
+
$('#instance-search-sid').val('');
|
|
636
|
+
$('#instance-search-pid').val('');
|
|
637
|
+
$('#instance-search-ins').val('');
|
|
638
|
+
if (useRid) {
|
|
639
|
+
$('#instance-search-rid').val('');
|
|
640
640
|
}
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
$('#instance-search-sid').change(function () {
|
|
644
|
+
searchObject.sid = $('#instance-search-sid').val();
|
|
645
|
+
acceptCheck();
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
$('#instance-search-pid').change(function () {
|
|
649
|
+
searchObject.pid = $('#instance-search-pid').val();
|
|
650
|
+
acceptCheck();
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
$('#instance-search-ins').change(function () {
|
|
654
|
+
searchObject.ins = $('#instance-search-ins').val();
|
|
655
|
+
acceptCheck();
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
if (useRid) {
|
|
659
|
+
$('#instance-search-rid').change(function () {
|
|
660
|
+
searchObject.rid = $('#instance-search-rid').val();
|
|
661
|
+
acceptCheck();
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// * END CHANGE RESPONSE * //
|
|
666
|
+
|
|
667
|
+
// reset input filed after init
|
|
668
|
+
if (!listed) {
|
|
669
|
+
$(`#${opts.uriFieldName}`).val(uriFieldValue);
|
|
641
670
|
}
|
|
642
|
-
|
|
671
|
+
}
|