node-red-contrib-mobius-flow-base 3.0.0-beta.19 → 3.0.0-rc.2

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.
@@ -17,3 +17,5 @@ export declare const filterObjectsByRIDValue: (apiClient: AxiosInstance, uri: st
17
17
  export declare const getHubId: (apiClient: AxiosInstance, callback: Function) => Promise<void>;
18
18
  export declare const getNodeConfig: (apiClient: AxiosInstance, uri: string, callback: Function) => Promise<void>;
19
19
  export declare const changeAdminPassword: (apiClient: AxiosInstance, password: string, callback: Function) => Promise<void>;
20
+ export declare const getNodeConfigTree: (apiClient: AxiosInstance, hid: string, callback: Function) => Promise<void>;
21
+ export declare const getProfileByPid: (apiClient: AxiosInstance, hid: string, pid: string, callback: Function) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.changeAdminPassword = exports.getNodeConfig = exports.getHubId = exports.filterObjectsByRIDValue = exports.updateObject = exports.getServiceConfig = exports.sendDirectCommand = exports.sendBroadcastCommand = exports.readObject = exports.readResource = exports.clearResource = exports.writeMultiResource = exports.writeResource = exports.discover = void 0;
3
+ exports.getProfileByPid = exports.getNodeConfigTree = exports.changeAdminPassword = exports.getNodeConfig = exports.getHubId = exports.filterObjectsByRIDValue = exports.updateObject = exports.getServiceConfig = exports.sendDirectCommand = exports.sendBroadcastCommand = exports.readObject = exports.readResource = exports.clearResource = exports.writeMultiResource = exports.writeResource = exports.discover = void 0;
4
4
  const discover = async (apiClient, uri, callback) => {
5
5
  try {
6
6
  const response = await apiClient({
@@ -232,3 +232,29 @@ const changeAdminPassword = async (apiClient, password, callback) => {
232
232
  }
233
233
  };
234
234
  exports.changeAdminPassword = changeAdminPassword;
235
+ const getNodeConfigTree = async (apiClient, hid, callback) => {
236
+ try {
237
+ const response = await apiClient({
238
+ method: 'get',
239
+ url: `/mobius/node/configtree/${hid}`,
240
+ });
241
+ callback(null, response.data);
242
+ }
243
+ catch (err) {
244
+ callback(err);
245
+ }
246
+ };
247
+ exports.getNodeConfigTree = getNodeConfigTree;
248
+ const getProfileByPid = async (apiClient, hid, pid, callback) => {
249
+ try {
250
+ const response = await apiClient({
251
+ method: 'get',
252
+ url: `/mobius/profile/object/${hid}/${pid}`,
253
+ });
254
+ callback(null, response.data);
255
+ }
256
+ catch (err) {
257
+ callback(err);
258
+ }
259
+ };
260
+ exports.getProfileByPid = getProfileByPid;
@@ -4,6 +4,6 @@ export declare let tokens: null | {
4
4
  refreshToken: string;
5
5
  };
6
6
  export declare let loggedIn: boolean;
7
- export declare const getApiClient: (protocol: 'http' | 'https', host: string, port: number, username: string, password: string) => AxiosInstance;
7
+ export declare const getApiClient: (protocol: 'http' | 'https', host: string, username: string, password: string) => AxiosInstance;
8
8
  export declare const setLoggedIn: (value: boolean) => void;
9
9
  export declare const closeApiClient: () => void;
@@ -11,7 +11,7 @@ exports.loggedIn = false;
11
11
  let reloginInterval = null;
12
12
  let client = null;
13
13
  let refreshLoop = null;
14
- const getApiClient = (protocol, host, port, username, password) => {
14
+ const getApiClient = (protocol, host, username, password) => {
15
15
  if (client) {
16
16
  try {
17
17
  (0, engine_websocket_1.disconnectFromWebSocket)();
@@ -23,20 +23,27 @@ const getApiClient = (protocol, host, port, username, password) => {
23
23
  clearInterval(refreshLoop);
24
24
  refreshLoop = null;
25
25
  }
26
- (0, engine_websocket_1.setWebSocketConnectParams)(host, port, protocol);
26
+ (0, engine_websocket_1.setWebSocketConnectParams)(host, protocol);
27
27
  //const baseURL = `http://localhost:8443/api/v1`;
28
- const baseURL = `${protocol}://${host}:${port}/api/v1`;
28
+ const baseURL = `${protocol}://${host}/api/v1`;
29
29
  client = axios_1.default.create({
30
30
  baseURL: baseURL,
31
31
  headers: {
32
32
  'Content-Type': 'application/json',
33
33
  },
34
34
  });
35
- reloginInterval = setInterval(() => {
36
- if (!exports.loggedIn) {
37
- login();
38
- }
39
- }, 30000);
35
+ if (username && password && host) {
36
+ reloginInterval = setInterval(() => {
37
+ if (!exports.loggedIn) {
38
+ login();
39
+ }
40
+ }, 30000);
41
+ }
42
+ else {
43
+ console.log('No username, password, host, or port provided. Not attempting to login to Mobius Engine API.');
44
+ clearInterval(reloginInterval);
45
+ reloginInterval = null;
46
+ }
40
47
  // Add auth headers to all axios calls
41
48
  client.interceptors.request.use((config) => {
42
49
  if (!config.url?.endsWith('/auth/login')) {
@@ -71,7 +78,14 @@ const getApiClient = (protocol, host, port, username, password) => {
71
78
  exports.loggedIn = false;
72
79
  }
73
80
  };
74
- login();
81
+ if (username && password && host) {
82
+ login();
83
+ }
84
+ else {
85
+ console.log('No username, password, host, or port provided. Not attempting to login to Mobius Engine API.');
86
+ clearInterval(reloginInterval);
87
+ reloginInterval = null;
88
+ }
75
89
  const refresh = async () => {
76
90
  if (!exports.tokens) {
77
91
  return;
@@ -1,6 +1,6 @@
1
1
  type WebSocketTopics = 'authorize' | 'subscribe' | 'unsubscribe' | 'connected' | 'authorized' | 'object-cov' | 'resource-cov' | 'service-status' | 'broadcast-command' | 'error' | 'ping' | 'pong';
2
2
  type Events = 'connected' | 'disconnected';
3
- export declare const setWebSocketConnectParams: (hostname: string, port: number, protocol: 'http' | 'https') => void;
3
+ export declare const setWebSocketConnectParams: (hostname: string, protocol: 'http' | 'https') => void;
4
4
  export declare const on: (eventName: Events, callback: Function) => void;
5
5
  export declare function registerCallback(topic: WebSocketTopics, callback: Function): void;
6
6
  export declare function clearAllCallbacks(): void;
@@ -15,8 +15,8 @@ let eventListeners = [];
15
15
  let reconnectInterval = null;
16
16
  let attemptReconnect = false;
17
17
  let connectParams = null;
18
- const setWebSocketConnectParams = (hostname, port, protocol) => {
19
- connectParams = { hostname, port, protocol };
18
+ const setWebSocketConnectParams = (hostname, protocol) => {
19
+ connectParams = { hostname, protocol };
20
20
  };
21
21
  exports.setWebSocketConnectParams = setWebSocketConnectParams;
22
22
  const on = (eventName, callback) => {
@@ -107,7 +107,7 @@ const connectToWebSocket = () => {
107
107
  if (connectParams.protocol === 'http') {
108
108
  webSocketProtocol = 'ws';
109
109
  }
110
- webSocket = new ws_1.default(`${webSocketProtocol}://${connectParams.hostname}:${connectParams.port}/api/v1/mobius/subscribe/connect`);
110
+ webSocket = new ws_1.default(`${webSocketProtocol}://${connectParams.hostname}/api/v1/mobius/subscribe/connect`);
111
111
  webSocket.onopen = () => {
112
112
  attemptReconnect = true;
113
113
  console.log('Engine API Subscription WebSocket Client Connected');
@@ -70,6 +70,32 @@ module.exports = {
70
70
  });
71
71
  },
72
72
 
73
+ // Promisified version of getNodeConfigTree
74
+ getNodeConfigTree (connection, hid) {
75
+ return new Promise((resolve, reject) => {
76
+ connection.getNodeConfigTree(hid, (err, response) => {
77
+ if (!err) {
78
+ resolve(response);
79
+ } else {
80
+ reject(err);
81
+ }
82
+ });
83
+ });
84
+ },
85
+
86
+ // Promisified version of getProfileByPid
87
+ getProfileByPid (connection, hid, pid) {
88
+ return new Promise((resolve, reject) => {
89
+ connection.getProfileByPid(hid, pid, (err, response) => {
90
+ if (!err) {
91
+ resolve(response);
92
+ } else {
93
+ reject(err);
94
+ }
95
+ });
96
+ });
97
+ },
98
+
73
99
  // Discover object by By PID
74
100
  async discoverDevicesByPID (RED, connection, hid, spids, pid) {
75
101
  let devices = [];
@@ -172,9 +198,75 @@ module.exports = {
172
198
  objectList.push(objResponse.data[0]);
173
199
  }
174
200
  }
201
+ console.log(objectList[0]);
202
+ console.log(objectList[0].resources);
175
203
  return objectList;
176
204
  } catch (err) {
177
205
  throw JSON.stringify(err);
178
206
  }
179
207
  },
208
+
209
+ async getConfigObjectsList(connection, hid, sid) {
210
+ try {
211
+ let objectList = [];
212
+ const configTreeResponse = await this.getNodeConfigTree(connection, hid);
213
+ const service = configTreeResponse.data.find((service) => service.sid === sid);
214
+ for (let i = 0; i < service.objects.length; i++) {
215
+ objectList = objectList.concat(service.objects[i].objects);
216
+ }
217
+ let formattedObjectList = [];
218
+ for (let i = 0; i < objectList.length; i++) {
219
+ const getProfileResponse = await this.getProfileByPid(connection, hid, objectList[i].pid);
220
+ const profile = getProfileResponse.data;
221
+ const profileName = profile.header.uiname;
222
+ const rids = objectList[i].rids;
223
+ let resources = [];
224
+ for (let j = 0; j < rids.length; j++) {
225
+ let resourceName = '';
226
+ const resKeys = Object.keys(profile.resources);
227
+ const resValues = Object.values(profile.resources);
228
+ for (let k = 0; k < resKeys.length; k++) {
229
+ if (resValues[k].rid === `${parseInt(rids[j].rid)}`) {
230
+ resourceName = resKeys[k];
231
+ }
232
+ }
233
+ resources.push({
234
+ rid: rids[j].rid,
235
+ name: resourceName,
236
+ pv: rids[j].pv,
237
+ })
238
+ }
239
+ const foundObjectName = objectList[i].rids.filter((rid) => rid.rid === '01');
240
+ const objName = foundObjectName.length > 0 ? foundObjectName[0].settings.pv : '';
241
+ formattedObjectList.push({
242
+ pid: objectList[i].pid,
243
+ ins: objectList[i].ins,
244
+ profileName,
245
+ resources,
246
+ name: objName,
247
+ });
248
+ }
249
+ return formattedObjectList;
250
+ } catch (err) {
251
+ throw JSON.stringify(err);
252
+ }
253
+ },
254
+
255
+ async getResourceOptions(connection, hid, pid) {
256
+ const getProfileResponse = await this.getProfileByPid(connection, hid, pid);
257
+ const profile = getProfileResponse.data;
258
+ const result = [];
259
+ const resValues = Object.values(profile.resources);
260
+ for (let i = 0; i < resValues.length; i++) {
261
+ let rid = parseInt(resValues[i].rid).toString(16).toUpperCase();
262
+ rid = rid.length === 1 ? `0${rid}` : rid;
263
+ result.push({
264
+ name: resValues[i].uiname,
265
+ rid,
266
+ });
267
+ }
268
+ return result;
269
+ }
270
+
180
271
  };
272
+
@@ -145,13 +145,6 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
145
145
  </div>
146
146
  `;
147
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
148
  // * END HTML INJECTION * //
156
149
 
157
150
  // * INIT SETUP * //
@@ -160,7 +153,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
160
153
  $.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
161
154
  mobConnected = response;
162
155
  if (!mobConnected) {
163
- $('#node-lookup-instance').css('color', '#CCCCCC');
156
+ $(`#${opts.searchButtonId}`).css('color', '#CCCCCC');
164
157
  $('#bad-connection-alert').show();
165
158
  } else {
166
159
  $('#bad-connection-alert').hide();
@@ -199,15 +192,15 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
199
192
  // * END INIT SETUP * //
200
193
 
201
194
  /**
202
- * Search for INSs present on selected PID
195
+ * Search for RIDs options for a given PID
203
196
  * @param {object} objects - Response from call to Mobiu, list of mobius objects
204
197
  * @param {string} pid - The chosen PID
205
198
  */
206
199
  function ridSearch(objects, ins) {
207
200
  $.getJSON(
208
- `mdiscover?mobius=${mobiusSrvc}&uri=${searchObject.hid}/${searchObject.sid}/${searchObject.pid}/${searchObject.ins}`,
201
+ `mgetresourceoptions?mobius=${mobiusSrvc}&hid=${searchObject.hid}&pid=${searchObject.pid}`,
209
202
  (response) => {
210
- resList = response.data[0].resources;
203
+ resList = response;
211
204
  ress = opts.removeWildcards ? [] : ['#'];
212
205
  for (let j = 0; j < resList.length; j++) {
213
206
  ress.push(`${resList[j].rid} - ${resList[j].name}`);
@@ -238,7 +231,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
238
231
  let inss = opts.removeWildcards ? [] : ['#', '+'];
239
232
  for (let i = 0; i < objects.length; i++) {
240
233
  if (objects[i].pid === pid) {
241
- const name = objects[i].resources[1].pv;
234
+ const name = objects[i].name ? objects[i].name : '';
242
235
  if (name === '') {
243
236
  inss.push(objects[i].ins);
244
237
  } else {
@@ -400,14 +393,16 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
400
393
  tempList = JSON.parse(JSON.stringify(opts.list));
401
394
  tempList[selectionIndex].uri = uri;
402
395
  updateList();
396
+ opts.list = JSON.parse(JSON.stringify(tempList));
403
397
  } else {
404
398
  $(`#${opts.uriFieldName}`).val(uri);
399
+ document.getElementById(opts.uriFieldName).dispatchEvent(new Event('change'));
405
400
  }
406
401
  $('#node-search-accept').css('color', '#CCCCCC');
407
402
  readyToAccept = false;
408
403
  $('#node-search-return').addClass('disabled');
409
404
  $('#node-search-accept').addClass('disabled');
410
- $('#node-lookup-instance').removeClass('disabled');
405
+ $(`#${opts.searchButtonId}`).removeClass('disabled');
411
406
  $('#instance-search-row').hide();
412
407
  $('#instance-row').show();
413
408
  }
@@ -492,7 +487,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
492
487
  .each(function (i) {
493
488
  let item = $(this);
494
489
  let secondField = item.find(`.${opts.containerSecondFieldName}`).val();
495
- tempList[i][Object.keys(tempList[i])[1]] = secondField;
490
+ tempList[i][Object.keys(tempList[i])[1]] = JSON.parse(JSON.stringify(secondField));
496
491
  });
497
492
  $(`#${opts.containerName}`).editableList('empty');
498
493
  for (let i = 0; i < tempList.length; i++) {
@@ -504,7 +499,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
504
499
 
505
500
  // * CLICK RESPONSE * //
506
501
 
507
- $('#node-lookup-instance').click(function () {
502
+ $(`#${opts.searchButtonId}`).click(function () {
508
503
  if (mobConnected) {
509
504
  //When search button is clicked
510
505
  $('#instance-search-sid').val('');
@@ -513,7 +508,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
513
508
  if (useRid) {
514
509
  $('#instance-search-rid').val('');
515
510
  }
516
- $('#node-lookup-instance').addClass('disabled');
511
+ $(`#${opts.searchButtonId}`).addClass('disabled');
517
512
  $('#node-search-return').removeClass('disabled');
518
513
  $('#node-search-accept').removeClass('disabled');
519
514
  $('#instance-row').hide();
@@ -576,7 +571,7 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
576
571
  //Return/Back button clicked
577
572
  $('#node-search-return').addClass('disabled');
578
573
  $('#node-search-accept').addClass('disabled');
579
- $('#node-lookup-instance').removeClass('disabled');
574
+ $(`#${opts.searchButtonId}`).removeClass('disabled');
580
575
  $('#instance-search-row').hide();
581
576
  $('#instance-row').show();
582
577
  $(`#${opts.containerRowName}`).show();
@@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
35
35
  <div class="form-row" id="input-row">
36
36
  <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
37
37
  <input type="text" id="node-input-resource" style="width:61%;" placeholder="Resource URI (hid/sid/pid/ins/rid)">
38
+ <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>
38
39
  </div>
39
40
  </div>
40
41
  <div id="mobsearch"></div>
@@ -111,7 +112,7 @@ POSSIBILITY OF SUCH DAMAGE.
111
112
  opts = {
112
113
  htmlElementId: 'mobsearch',
113
114
  uriFieldName: 'node-input-resource',
114
- inputRowId: 'input-row',
115
+ searchButtonId: 'node-lookup-instance',
115
116
  };
116
117
  initMobsearch.toRid(mobiusSrvc, opts);
117
118
  },
@@ -27,23 +27,25 @@ POSSIBILITY OF SUCH DAMAGE.
27
27
  <script type="text/x-red" data-template-name="mobius connection">
28
28
  <div class="form-row">
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
- <input class="input-append-left" type="text" id="node-config-input-host" placeholder="e.g. localhost" style="width: 40%;" >
31
- <label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
32
- <input type="text" id="node-config-input-port" placeholder="1890" style="width:50px">
30
+ <input class="input-append-left" type="text" id="node-config-input-host" placeholder="e.g. localhost" style="width: 70%;" >
33
31
  </div>
32
+ <p style="text-align:center"> Ensure port number is included in host path</p>
33
+ <p style="text-align:center"> e.g. <b>myHostname:8443</b></p>
34
+ <hr>
34
35
  <div class="form-row">
35
36
  <label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
36
- <input class="input-append-left" type="text" id="node-config-input-username" style="width: 40%;" >
37
+ <input class="input-append-left" type="text" id="node-config-input-username" style="width: 70%;" >
37
38
  </div>
38
39
  <div class="form-row">
39
40
  <label for="node-config-input-password"><i class="fa fa-key"></i> Password</label>
40
- <input class="input-append-left" type="text" id="node-config-input-password" style="width: 40%;" >
41
+ <input class="input-append-left" type="text" id="node-config-input-password" style="width: 70%;" >
41
42
  </div>
42
43
  <div class="form-row">
43
44
  <label for="node-config-input-secure" style="width: 100px;"> Use SSL/TLS</label>
44
45
  <input type="checkbox" id="node-config-input-secure" style="display: inline-block; width: auto; vertical-align: top;">
45
-
46
46
  </div>
47
+ <hr>
48
+ <p style="text-align:center; color:blue;"><u><a style="color:blue;" href="https://docs.mobiusflow.com/help/technical-docs/flows/connecting-to-flows-to-mobiusflow-engine">Link to MobiusFlow connection help article</a></u></p>
47
49
  </script>
48
50
 
49
51
  <script type="text/javascript">
@@ -51,14 +53,13 @@ POSSIBILITY OF SUCH DAMAGE.
51
53
  RED.nodes.registerType('mobius connection', {
52
54
  category: 'config',
53
55
  defaults: {
54
- host: { required: true, value: 'localhost' },
55
- port: { required: true, value: 8443, validate: RED.validators.number() },
56
- username: { required: true, value: 'admin' },
57
- password: { required: true, value: 'adm123' },
58
- secure: { required: true, value: true },
56
+ host: { required: true, value: 'mobius:8443' },
57
+ username: { required: true, value: '' },
58
+ password: { required: true, value: '' },
59
+ secure: { required: true, value: false },
59
60
  },
60
61
  label: function () {
61
- return `${this.host}:${this.port}`;
62
+ return `${this.host}`;
62
63
  },
63
64
  oneditprepare: function () {
64
65
  $('#node-config-input-secure').change(function () {
@@ -65,14 +65,12 @@ module.exports = function (RED) {
65
65
  function MobiusConnectionNode(n) {
66
66
  RED.nodes.createNode(this, n);
67
67
  this.host = n.host;
68
- this.port = n.port;
69
68
  this.username = n.username;
70
69
  this.password = n.password;
71
70
  this.secure = n.secure;
72
71
  this.apiClient = getApiClient(
73
72
  this.secure ? 'https' : 'http',
74
73
  this.host,
75
- this.port,
76
74
  this.username,
77
75
  this.password
78
76
  );
@@ -101,7 +99,7 @@ module.exports = function (RED) {
101
99
  // Connected to the mobius TCPIP spoke
102
100
  // Update the status indicators
103
101
  webSocket.on('connected', () => {
104
- this.log(`Connected to ${n.host} : ${n.port}`);
102
+ this.log(`Connected to ${n.host}`);
105
103
  apiCalls.getHubId(this.apiClient, (err, hubId) => {
106
104
  if (err) {
107
105
  node.error('Mobius error getting hub ID' + JSON.stringify(err));
@@ -144,7 +142,7 @@ module.exports = function (RED) {
144
142
  // Disconnected from the mobius TCPIP spoke
145
143
  // Update the status indicators
146
144
  webSocket.on('disconnected', () => {
147
- this.log(`Disconnected from ${n.host} : ${n.port}`);
145
+ this.log(`Disconnected from ${n.host}`);
148
146
  node.connected = false;
149
147
  for (var id in node.users) {
150
148
  if (node.users.hasOwnProperty(id)) {
@@ -566,6 +564,24 @@ module.exports = function (RED) {
566
564
  node.getNodeConfig = function (uri, callback) {
567
565
  apiCalls.getNodeConfig(this.apiClient, uri, callback);
568
566
  }
567
+
568
+ /**
569
+ * Get the list of services on a hub
570
+ * @param {string} hid - The hub ID of the hub to get the service list from
571
+ * @param {Function} callback - Callback when complete
572
+ */
573
+ node.getNodeConfigTree = function (hid, callback) {
574
+ apiCalls.getNodeConfigTree(this.apiClient, hid, callback);
575
+ }
576
+
577
+ /**
578
+ * Get the list of services on a hub
579
+ * @param {string} hid - The hub ID of the hub to get the service list from
580
+ * @param {Function} callback - Callback when complete
581
+ */
582
+ node.getProfileByPid = function (hid, pid, callback) {
583
+ apiCalls.getProfileByPid(this.apiClient, hid, pid, callback);
584
+ }
569
585
  }
570
586
 
571
587
  RED.nodes.registerType('mobius connection', MobiusConnectionNode);
@@ -645,6 +661,26 @@ module.exports = function (RED) {
645
661
  });
646
662
  }
647
663
  });
664
+
665
+ // Register the endpoint for node-red get resource options for object type
666
+ RED.httpAdmin.get('/mgetresourceoptions', RED.auth.needsPermission('serial.read'), function (req, res) {
667
+ let conn = RED.nodes.getNode(req.query.mobius);
668
+ let hid = req.query.hid;
669
+ let pid = req.query.pid;
670
+ if (conn === null || !conn.connected) {
671
+ RED.log.error('Fetching resource options failed - could not to connect to MOBiUS hub.');
672
+ throw new Error('Fetching resource options failed - could not to connect to MOBiUS hub.');
673
+ } else {
674
+ uiFuncs
675
+ .getResourceOptions(conn, hid, pid)
676
+ .then((response) => {
677
+ res.json(response);
678
+ })
679
+ .catch((err) => {
680
+ throw err;
681
+ });
682
+ }
683
+ });
648
684
 
649
685
  // Register the endpoint for node-red mobius discovery in node-red node config pages
650
686
  RED.httpAdmin.get('/mgetservices', RED.auth.needsPermission('serial.read'), function (req, res) {
@@ -674,12 +710,12 @@ module.exports = function (RED) {
674
710
  throw new Error('Get objects failed - could not to connect to MOBiUS hub.');
675
711
  } else {
676
712
  uiFuncs
677
- .getObjectList(conn, hid, sid)
713
+ .getConfigObjectsList(conn, hid, sid)
678
714
  .then((response) => {
679
715
  res.json(response);
680
716
  })
681
717
  .catch((err) => {
682
- RED.log.warn(`Get objects failed on service ${req.query.sid} ${err ? ` - ${err}` : ''}`);
718
+ RED.log.warn(`Get objects failed on service ${req.query.sid} ${err ? ` - ${JSON.stringify(err)}` : ''}`);
683
719
  });
684
720
  }
685
721
  });
@@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
36
36
  <div class="form-row" id="input-row">
37
37
  <label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
38
38
  <input type="text" id="node-input-mobject" style="width:61%;" placeholder="Object URI (hid/sid/pid/ins)">
39
+ <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>
39
40
  </div>
40
41
  </div>
41
42
 
@@ -116,7 +117,7 @@ POSSIBILITY OF SUCH DAMAGE.
116
117
  opts = {
117
118
  htmlElementId: 'mobsearch',
118
119
  uriFieldName: 'node-input-mobject',
119
- inputRowId: 'input-row',
120
+ searchButtonId: 'node-lookup-instance',
120
121
  };
121
122
  initMobsearch.toIns(mobiusSrvc, opts);
122
123
  },
@@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
36
36
  <div class="form-row" id="input-row">
37
37
  <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
38
38
  <input type="text" id="node-input-resource" style="width:61%;" placeholder="HID/SID/PID/INS/RID">
39
+ <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>
39
40
  </div>
40
41
  </div>
41
42
 
@@ -109,7 +110,7 @@ POSSIBILITY OF SUCH DAMAGE.
109
110
  opts = {
110
111
  htmlElementId: 'mobsearch',
111
112
  uriFieldName: 'node-input-resource',
112
- inputRowId: 'input-row',
113
+ searchButtonId: 'node-lookup-instance',
113
114
  };
114
115
  initMobsearch.toRid(mobiusSrvc, opts);
115
116
 
@@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
36
36
  <div class="form-row" id="input-row">
37
37
  <label for="node-input-object"><i class="fa fa-tasks"></i> URI</label>
38
38
  <input type="text" id="node-input-object" style="width:61%;" placeholder="Object URI (hid/sid/pid/ins)">
39
+ <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>
39
40
  </div>
40
41
  </div>
41
42
 
@@ -125,7 +126,7 @@ POSSIBILITY OF SUCH DAMAGE.
125
126
  opts = {
126
127
  htmlElementId: 'mobsearch',
127
128
  uriFieldName: 'node-input-object',
128
- inputRowId: 'input-row',
129
+ searchButtonId: 'node-lookup-instance',
129
130
  };
130
131
  initMobsearch.toIns(mobiusSrvc, opts);
131
132
  },
@@ -35,7 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
35
35
  <div id="instance-row">
36
36
  <div class="form-row" id="input-row">
37
37
  <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
38
- <input type="text" id="node-input-resource" placeholder="Resource URI (hid/sid/pid/ins/rid)">
38
+ <input type="text" id="node-input-resource" style="width:61%;" placeholder="Resource URI (hid/sid/pid/ins/rid)">
39
+ <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>
39
40
  </div>
40
41
  </div>
41
42
  <div id="mobsearch"></div>
@@ -106,7 +107,7 @@ POSSIBILITY OF SUCH DAMAGE.
106
107
  opts = {
107
108
  htmlElementId: 'mobsearch',
108
109
  uriFieldName: 'node-input-resource',
109
- inputRowId: 'input-row',
110
+ searchButtonId: 'node-lookup-instance',
110
111
  };
111
112
  initMobsearch.toRid(mobiusSrvc, opts);
112
113
  },
@@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
36
36
  <div class="form-row" id="input-row">
37
37
  <label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
38
38
  <input type="text" style="width:61%;" id="node-input-mobject" placeholder="Object URI (hid/sid/pid/ins)">
39
-
39
+ <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>
40
40
  </div>
41
41
  </div>
42
42
  <div id="mobsearch"></div>
@@ -105,7 +105,7 @@ POSSIBILITY OF SUCH DAMAGE.
105
105
  opts = {
106
106
  htmlElementId: 'mobsearch',
107
107
  uriFieldName: 'node-input-mobject',
108
- inputRowId: 'input-row',
108
+ searchButtonId: 'node-lookup-instance',
109
109
  removeWildcards: true,
110
110
  };
111
111
  initMobsearch.toIns(mobiusSrvc, opts);
@@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
36
36
  <div class="form-row" id="input-row">
37
37
  <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
38
38
  <input type="text" id="node-input-resource" style="width:61%;" placeholder="Resource URI (hid/sid/pid/ins/rid)">
39
+ <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>
39
40
  </div>
40
41
  </div>
41
42
 
@@ -113,7 +114,7 @@ POSSIBILITY OF SUCH DAMAGE.
113
114
  opts = {
114
115
  htmlElementId: 'mobsearch',
115
116
  uriFieldName: 'node-input-resource',
116
- inputRowId: 'input-row',
117
+ searchButtonId: 'node-lookup-instance',
117
118
  removeWildcards: true,
118
119
  };
119
120
  initMobsearch.toRid(mobiusSrvc, opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-mobius-flow-base",
3
- "version": "3.0.0-beta.19",
3
+ "version": "3.0.0-rc.2",
4
4
  "description": "Node-RED base nodes for Mobius Flow",
5
5
  "main": "index.js",
6
6
  "types": "dist/index.d.ts",