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