node-red-contrib-mobius-flow-base 2.5.86-beta.7 → 2.5.86-beta.70

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.
@@ -642,4 +642,33 @@ module.exports = function (RED) {
642
642
  });
643
643
  }
644
644
  });
645
+
646
+ RED.httpAdmin.get('/mgetobjects', RED.auth.needsPermission('serial.read'), function (req, res) {
647
+ let conn = RED.nodes.getNode(req.query.mobius);
648
+ let hid = req.query.hid;
649
+ let sid = req.query.sid;
650
+ if (conn === null || !conn.service.connected) {
651
+ RED.log.error('Get objects failed - could not to connect to MOBiUS hub.');
652
+ throw new Error('Get objects failed - could not to connect to MOBiUS hub.');
653
+ } else {
654
+ uiDeviceDiscovery
655
+ .getObjectList(conn, hid, sid)
656
+ .then((response) => {
657
+ res.json(response);
658
+ })
659
+ .catch((err) => {
660
+ RED.log.warn(`Get objects failed - ${err}`);
661
+ });
662
+ }
663
+ });
664
+
665
+ RED.httpAdmin.get('/mgethid', RED.auth.needsPermission('serial.read'), function (req, res) {
666
+ let conn = RED.nodes.getNode(req.query.mobius);
667
+ if (conn === null || !conn.service.connected) {
668
+ RED.log.error('Get hid failed - could not to connect to MOBiUS hub.');
669
+ throw new Error('Get hid failed - could not to connect to MOBiUS hub.');
670
+ } else {
671
+ res.json(conn.service.srvcAPI.status.hubId);
672
+ }
673
+ });
645
674
  };
@@ -53,10 +53,13 @@ POSSIBILITY OF SUCH DAMAGE.
53
53
  <option value="array">Array of Items</option>
54
54
  </select>
55
55
  </div>
56
- <div class="form-row node-input-subs-container-row">
56
+ <div id="node-input-subs-container-row" class="form-row node-input-subs-container-row">
57
57
  <label for="node-input-subs-container" style="width:105px;float:left;"><i class="fa fa-bars"></i> Discover</label>
58
58
  <ol id="node-input-subs-container"></ol>
59
59
  </div>
60
+
61
+ <div id="mobsearch"></div>
62
+
60
63
  <div class="form-row">
61
64
  <label for="node-input-useRIDValueFiltering" style="width:178px;float:left;"><i class="fa fa-filter"></i> Filter by Resource Value</label>
62
65
  <input type="checkbox" id="node-input-useRIDValueFiltering" style="display: inline-block; width: auto; vertical-align: top;">
@@ -77,6 +80,8 @@ POSSIBILITY OF SUCH DAMAGE.
77
80
  </div>
78
81
  </script>
79
82
 
83
+ <script src="common/mobsearch.js"></script>
84
+
80
85
  <script type="text/javascript">
81
86
  RED.nodes.registerType('mobius discover object list', {
82
87
  category: 'mobius',
@@ -119,6 +124,7 @@ POSSIBILITY OF SUCH DAMAGE.
119
124
  },
120
125
  oneditprepare: function () {
121
126
  var node = this;
127
+ let mobiusSrvc = $("#node-input-connection").val();
122
128
 
123
129
  /** Create the subs container and populate it */
124
130
  $('#node-input-subs-container').css('min-height', '200px').css('min-width', '345px').editableList ({
@@ -137,7 +143,12 @@ POSSIBILITY OF SUCH DAMAGE.
137
143
  }
138
144
 
139
145
  var row = $('<div>URI</div>').appendTo(container);
140
- var uriField = $('<input/>',{class: "node-input-sub-uri", type: "text", style: "width: 170px; margin-left: 5px; text-align: left;"}).appendTo(row);
146
+ var uriField = $('<input/>',{class: "node-input-sub-uri", type: "text", style: "width: 150px; margin-left: 5px; text-align: left;"}).appendTo(row);
147
+
148
+ // *** MOBSEARCH *** //
149
+ var searchField = $('<a class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
150
+ // *** END MOBSEARCH *** //
151
+
141
152
  var typeField = $('<select/>',{class: "node-input-sub-type", style: "width:auto; margin-left: 5px; text-align: center;"}).appendTo(row);
142
153
  typeField.append($("<option></option>").val('include').text('Include'));
143
154
  typeField.append($("<option></option>").val('exclude').text('Exclude'));
@@ -145,6 +156,15 @@ POSSIBILITY OF SUCH DAMAGE.
145
156
  // Populate the new stat
146
157
  uriField.val(subscription.uri);
147
158
  typeField.val(subscription.type);
159
+
160
+ // *** MOBSEARCH *** //
161
+
162
+ if (!node.subscriptions[i]) {
163
+ node.subscriptions[i] = {uri: '', type: 'include'}
164
+ }
165
+
166
+ addMobsearchListButton(searchField, i, mobsearchOpts)
167
+ // *** END MOBSEARCH *** //
148
168
  }
149
169
  });
150
170
 
@@ -154,7 +174,20 @@ POSSIBILITY OF SUCH DAMAGE.
154
174
  if (!node.subscriptions) {
155
175
  node.subscriptions = [subscription = {uri: '', type: 'include'}];
156
176
  }
157
- // Populate list with all saved filters
177
+
178
+ // *** MOBSEARCH *** //
179
+
180
+ mobsearchOpts = {
181
+ htmlElementId: 'mobsearch',
182
+ list: node.subscriptions,
183
+ containerRowName: 'node-input-subs-container-row',
184
+ containerName: 'node-input-subs-container',
185
+ containerSecondFieldName: 'node-input-sub-type',
186
+ };
187
+ initMobsearch.toIns_listed(mobiusSrvc, mobsearchOpts);
188
+
189
+ // *** END MOBSEARCH *** //
190
+
158
191
  for (let i = 0; i < node.subscriptions.length; i++) {
159
192
  let subscription = node.subscriptions[i];
160
193
  $("#node-input-subs-container").editableList('addItem', subscription);
@@ -28,7 +28,7 @@
28
28
  'use strict';
29
29
 
30
30
  module.exports = function (RED) {
31
- function MobiusFlowNode (n) {
31
+ function MobiusFlowNode(n) {
32
32
  RED.nodes.createNode(this, n);
33
33
  this.subscriptions = n.subscriptions;
34
34
  this.sendType = n.send;
@@ -45,7 +45,7 @@ module.exports = function (RED) {
45
45
  node.status({
46
46
  fill: 'red',
47
47
  shape: 'ring',
48
- text: 'Disconnected'
48
+ text: 'Disconnected',
49
49
  });
50
50
 
51
51
  node.serviceConn.register(node);
@@ -54,54 +54,57 @@ module.exports = function (RED) {
54
54
  node.status({
55
55
  fill: 'green',
56
56
  shape: 'ring',
57
- text: 'Busy'
57
+ text: 'Busy',
58
58
  });
59
59
 
60
- node.discoverAllObjectURIs(msg).then((objectList) => {
61
- if (node.sendType === 'individual') {
62
- objectList.forEach((mobiusObject) => {
60
+ node
61
+ .discoverAllObjectURIs(msg)
62
+ .then((objectList) => {
63
+ if (node.sendType === 'individual') {
64
+ objectList.forEach((mobiusObject) => {
65
+ if (node.outputType === 'uris') {
66
+ node.send({
67
+ topic: mobiusObject.uri,
68
+ payload: mobiusObject.uri,
69
+ });
70
+ } else {
71
+ node.send({
72
+ topic: mobiusObject.uri,
73
+ payload: mobiusObject,
74
+ });
75
+ }
76
+ });
77
+ } else {
63
78
  if (node.outputType === 'uris') {
79
+ const uris = [];
80
+ objectList.forEach((mobiusObject) => {
81
+ uris.push(mobiusObject.uri);
82
+ });
64
83
  node.send({
65
- topic: mobiusObject.uri,
66
- payload: mobiusObject.uri
84
+ topic: msg.topic,
85
+ payload: uris,
67
86
  });
68
87
  } else {
69
88
  node.send({
70
- topic: mobiusObject.uri,
71
- payload: mobiusObject
89
+ topic: msg.topic,
90
+ payload: objectList,
72
91
  });
73
- }
74
- });
75
- } else {
76
- if (node.outputType === 'uris') {
77
- const uris = [];
78
- objectList.forEach((mobiusObject) => {
79
- uris.push(mobiusObject.uri);
80
- });
81
- node.send({
82
- topic: msg.topic,
83
- payload: uris
84
- });
85
- } else {
86
- node.send({
87
- topic: msg.topic,
88
- payload: objectList
89
- });
92
+ }
90
93
  }
91
- }
92
-
93
- node.status({
94
- fill: 'green',
95
- shape: 'dot',
96
- text: 'Done'
97
- });
98
- }).catch(() => {
99
- node.status({
100
- fill: 'yellow',
101
- shape: 'dot',
102
- text: 'Failed discovery'
94
+
95
+ node.status({
96
+ fill: 'green',
97
+ shape: 'dot',
98
+ text: 'Done',
99
+ });
100
+ })
101
+ .catch(() => {
102
+ node.status({
103
+ fill: 'yellow',
104
+ shape: 'dot',
105
+ text: 'Failed discovery',
106
+ });
103
107
  });
104
- });
105
108
  if (done) {
106
109
  done();
107
110
  }
@@ -131,7 +134,7 @@ module.exports = function (RED) {
131
134
  pids: pids,
132
135
  rid: node.rid,
133
136
  func: node.func,
134
- limit: node.limit
137
+ limit: node.limit,
135
138
  };
136
139
  } else {
137
140
  discoverParams = {
@@ -139,19 +142,21 @@ module.exports = function (RED) {
139
142
  pids: pids,
140
143
  rid: '00',
141
144
  func: 'return true;',
142
- limit: 512
145
+ limit: 512,
143
146
  };
144
147
  }
145
148
  try {
146
149
  let objects = await discover(node.serviceConn, discoverParams);
147
150
  for (let lp = 0; lp < objects.value.length; lp++) {
148
- objects.value[lp]['uri'] = `${serviceURI}/${objects.value[lp].pid}/${objects.value[lp].ins}`;
151
+ objects.value[lp][
152
+ 'uri'
153
+ ] = `${serviceURI}/${objects.value[lp].pid}/${objects.value[lp].ins}`;
149
154
  objectList.push(objects.value[lp]);
150
155
  }
151
156
  } catch (err) {
152
157
  node.warn(`Discover object failed for service (${serviceURI}) - ${err.message}`);
153
158
  }
154
- }
159
+ }
155
160
 
156
161
  if (objectList.length === 0) {
157
162
  throw new Error('No discovery data found');
@@ -176,23 +181,28 @@ module.exports = function (RED) {
176
181
  let profiles = await discover(serviceConn, `${hid}/${sid}`);
177
182
  let pids = [];
178
183
  for (const pid of profiles.value) {
179
- if (isIncluded(`${hid}/${sid}/${pid}/#`, subscriptions) && !isExcluded(`${hid}/${sid}/${pid}/#`, subscriptions)) {
184
+ if (
185
+ isIncluded(`${hid}/${sid}/${pid}/#`, subscriptions) &&
186
+ !isExcluded(`${hid}/${sid}/${pid}/#`, subscriptions)
187
+ ) {
180
188
  pids.push(pid);
181
- }
189
+ }
182
190
  }
183
191
  if (pids.length > 0) {
184
192
  discoveredProfiles.set(`${hid}/${sid}`, pids);
185
193
  }
186
194
  }
187
195
  } else {
188
- RED.log.warn(`Failed to discover objects for service ${service.id.split('/')[1]} as it is offline.`);
196
+ RED.log.warn(
197
+ `Failed to discover objects for service ${service.id.split('/')[1]} as it is offline.`
198
+ );
189
199
  }
190
200
  }
191
201
  resolve(discoveredProfiles);
192
202
  });
193
203
  }
194
204
 
195
- async function discover (serviceConn, params) {
205
+ async function discover(serviceConn, params) {
196
206
  return new Promise((resolve, reject) => {
197
207
  serviceConn.discover(params, (err, response) => {
198
208
  if (err) {
@@ -202,7 +212,7 @@ module.exports = function (RED) {
202
212
  }
203
213
  });
204
214
  });
205
- };
215
+ }
206
216
 
207
217
  function isIncluded(uri, subscriptions) {
208
218
  let include = false;
@@ -216,7 +226,7 @@ module.exports = function (RED) {
216
226
  return include;
217
227
  }
218
228
 
219
- function isExcluded (uri, subscriptions) {
229
+ function isExcluded(uri, subscriptions) {
220
230
  let exclude = false;
221
231
  for (const subscription of subscriptions) {
222
232
  if (subscription.type === 'exclude' && validateSubscription(subscription.uri)) {
@@ -228,7 +238,7 @@ module.exports = function (RED) {
228
238
  return exclude;
229
239
  }
230
240
 
231
- function validateSubscription (uri) {
241
+ function validateSubscription(uri) {
232
242
  let parts = uri.split('/');
233
243
  for (let lp = 0; lp < parts.length; lp++) {
234
244
  if (parts[lp] === null || parts[lp] === '') {
@@ -244,11 +254,11 @@ module.exports = function (RED) {
244
254
  return false;
245
255
  }
246
256
 
247
- function matchTopic (filter, topic) {
257
+ function matchTopic(filter, topic) {
248
258
  const filterArray = filter.split('/');
249
259
  const topicArray = topic.split('/');
250
260
  const length = filterArray.length < topicArray.length ? filterArray.length : topicArray.length;
251
-
261
+
252
262
  for (let i = 0; i < length; ++i) {
253
263
  const left = filterArray[i];
254
264
  const right = topicArray[i];
@@ -260,4 +270,12 @@ module.exports = function (RED) {
260
270
  }
261
271
 
262
272
  RED.nodes.registerType('mobius discover object list', MobiusFlowNode);
273
+
274
+ RED.httpAdmin.get('/common/*', function (req, res) {
275
+ var options = {
276
+ root: __dirname + '/common/',
277
+ dotfiles: 'deny',
278
+ };
279
+ res.sendFile(req.params[0], options);
280
+ });
263
281
  };
@@ -34,12 +34,16 @@ POSSIBILITY OF SUCH DAMAGE.
34
34
  <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
35
35
  <input type="text" id="node-input-connection">
36
36
  </div>
37
- <div class="form-row node-input-subs-container-row">
37
+ <div id="node-input-subs-container-row" class="form-row node-input-subs-container-row">
38
38
  <label for="node-input-subs-container"><i class="fa fa-bars"></i> Subscriptions</label>
39
39
  <ol id="node-input-subs-container"></ol>
40
40
  </div>
41
+
42
+ <div id="mobsearch"></div>
41
43
  </script>
42
44
 
45
+ <script src="common/mobsearch.js"></script>
46
+
43
47
  <script type="text/javascript">
44
48
  RED.nodes.registerType('mobius flow inject', {
45
49
  category: 'mobius',
@@ -67,6 +71,7 @@ POSSIBILITY OF SUCH DAMAGE.
67
71
  },
68
72
  oneditprepare: function () {
69
73
  var node = this;
74
+ let mobiusSrvc = $("#node-input-connection").val();
70
75
 
71
76
  /** Create the subs container and populate it */
72
77
  $('#node-input-subs-container').css('min-height', '300px').css('min-width', '450px').editableList ({
@@ -86,6 +91,11 @@ POSSIBILITY OF SUCH DAMAGE.
86
91
 
87
92
  var row = $('<div>URI</div>').appendTo(container);
88
93
  var uriField = $('<input/>',{class: "node-input-sub-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
94
+
95
+ // *** MOBSEARCH *** //
96
+ var searchField = $('<a class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
97
+ // *** END MOBSEARCH *** //
98
+
89
99
  var typeField = $('<select/>',{class: "node-input-sub-type", style: "width:auto; margin-left: 5px; text-align: center;"}).appendTo(row);
90
100
  typeField.append($("<option></option>").val('include').text('Include'));
91
101
  typeField.append($("<option></option>").val('exclude').text('Exclude'));
@@ -93,6 +103,15 @@ POSSIBILITY OF SUCH DAMAGE.
93
103
  // Populate the new stat
94
104
  uriField.val(subscription.uri);
95
105
  typeField.val(subscription.type);
106
+
107
+ // *** MOBSEARCH *** //
108
+
109
+ if (!node.subscriptions[i]) {
110
+ node.subscriptions[i] = {uri: '', type: 'include'}
111
+ }
112
+
113
+ addMobsearchListButton(searchField, i, mobsearchOpts)
114
+ // *** END MOBSEARCH *** //
96
115
  }
97
116
  });
98
117
 
@@ -100,7 +119,20 @@ POSSIBILITY OF SUCH DAMAGE.
100
119
  if (!node.subscriptions) {
101
120
  node.subscriptions = [subscription = {uri: '', type: 'include'}];
102
121
  }
103
- // Populate list with all saved filters
122
+
123
+ // *** MOBSEARCH *** //
124
+
125
+ mobsearchOpts = {
126
+ htmlElementId: 'mobsearch',
127
+ list: node.subscriptions,
128
+ containerRowName: 'node-input-subs-container-row',
129
+ containerName: 'node-input-subs-container',
130
+ containerSecondFieldName: 'node-input-sub-type',
131
+ };
132
+ initMobsearch.toIns_listed(mobiusSrvc, mobsearchOpts);
133
+
134
+ // *** END MOBSEARCH *** //
135
+
104
136
  for (let i = 0; i < node.subscriptions.length; i++) {
105
137
  let subscription = node.subscriptions[i];
106
138
  $("#node-input-subs-container").editableList('addItem', subscription);
@@ -30,7 +30,7 @@
30
30
  const _ = require('lodash');
31
31
 
32
32
  module.exports = function (RED) {
33
- function MobiusFlowNode (n) {
33
+ function MobiusFlowNode(n) {
34
34
  RED.nodes.createNode(this, n);
35
35
  this.subscriptions = n.subscriptions;
36
36
  this.serviceConn = RED.nodes.getNode(n.connection);
@@ -40,7 +40,7 @@ module.exports = function (RED) {
40
40
  node.status({
41
41
  fill: 'red',
42
42
  shape: 'ring',
43
- text: 'Disconnected'
43
+ text: 'Disconnected',
44
44
  });
45
45
 
46
46
  for (const subscription of node.subscriptions) {
@@ -61,7 +61,7 @@ module.exports = function (RED) {
61
61
  }
62
62
  }
63
63
 
64
- function validateSubscription (uri) {
64
+ function validateSubscription(uri) {
65
65
  let parts = uri.split('/');
66
66
  for (let lp = 0; lp < parts.length; lp++) {
67
67
  if (parts[lp] === null || parts[lp] === '') {
@@ -83,18 +83,24 @@ module.exports = function (RED) {
83
83
  * @param {string} messageTopic - The topic in an actual message
84
84
  * @return {boolean} - True if the topics match, else false
85
85
  */
86
- function matchTopic (topic, messageTopic) {
86
+ function matchTopic(topic, messageTopic) {
87
87
  if (topic === '#') {
88
88
  return true;
89
89
  }
90
90
  // eslint-disable-next-line no-useless-escape
91
- var regex = new RegExp('^' + topic.replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g, '\\$1')
92
- // eslint-disable-next-line no-useless-escape
93
- .replace(/\+/g, '[^/]+').replace(/\/#$/, '(\/.*)?') + '$');
91
+ var regex = new RegExp(
92
+ '^' +
93
+ topic
94
+ .replace(/([\[\]\?\(\)\\\\$\^\*\.|])/g, '\\$1')
95
+ // eslint-disable-next-line no-useless-escape
96
+ .replace(/\+/g, '[^/]+')
97
+ .replace(/\/#$/, '(/.*)?') +
98
+ '$'
99
+ );
94
100
  return regex.test(messageTopic);
95
101
  }
96
102
 
97
- function handleSubscription (node, response) {
103
+ function handleSubscription(node, response) {
98
104
  for (const subscription of node.subscriptions) {
99
105
  if (subscription.type === 'exclude') {
100
106
  if (matchTopic(subscription.uri, response.uri)) {
@@ -106,7 +112,7 @@ module.exports = function (RED) {
106
112
  node.status({
107
113
  fill: 'green',
108
114
  shape: 'dot',
109
- text: JSON.stringify(response.uri)
115
+ text: JSON.stringify(response.uri),
110
116
  });
111
117
  let outObject = response.value;
112
118
  try {
@@ -121,4 +127,12 @@ module.exports = function (RED) {
121
127
  }
122
128
 
123
129
  RED.nodes.registerType('mobius flow inject', MobiusFlowNode);
130
+
131
+ RED.httpAdmin.get('/common/*', function (req, res) {
132
+ var options = {
133
+ root: __dirname + '/common/',
134
+ dotfiles: 'deny',
135
+ };
136
+ res.sendFile(req.params[0], options);
137
+ });
124
138
  };
@@ -34,12 +34,16 @@ POSSIBILITY OF SUCH DAMAGE.
34
34
  <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
35
35
  <input type="text" id="node-input-connection">
36
36
  </div>
37
- <div class="form-row node-input-mobjects-container-row">
37
+ <div id="node-input-mobjects-container-row" class="form-row node-input-mobjects-container-row">
38
38
  <label for="node-input-mobjects-container"><i class="fa fa-bars"></i> Objects</label>
39
39
  <ol id="node-input-mobjects-container"></ol>
40
40
  </div>
41
+
42
+ <div id="mobsearch"></div>
41
43
  </script>
42
44
 
45
+ <script src="common/mobsearch.js"></script>
46
+
43
47
  <script type="text/javascript">
44
48
  RED.nodes.registerType('mobius get multi-object', {
45
49
  category: 'mobius',
@@ -74,6 +78,8 @@ POSSIBILITY OF SUCH DAMAGE.
74
78
  mobject.find(".node-input-mobject-comment").width(newWidth - 270);
75
79
  }
76
80
 
81
+ let mobiusSrvc = $("#node-input-connection").val();
82
+
77
83
  /** Create the objects container and populate it */
78
84
  $('#node-input-mobjects-container').css('min-height', '300px').css('min-width', '450px').editableList ({
79
85
  addButton: "add",
@@ -91,14 +97,29 @@ POSSIBILITY OF SUCH DAMAGE.
91
97
  }
92
98
 
93
99
  var row = $('<div>URI</div>').appendTo(container);
94
- var uriField = $('<input/>',{class: "node-input-mobject-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
100
+ var uriField = $('<input/>',{class: "node-input-mobject-uri", type: "text", style: "width: 180px; margin-left: 5px; text-align: left;"}).appendTo(row);
101
+
102
+ // *** MOBSEARCH *** //
103
+ var searchField = $('<a class="searchbutton" style="vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
104
+ // *** END MOBSEARCH *** //
105
+
95
106
  row.append('&nbsp;&nbsp;-&nbsp;');
96
- var commentField = $('<input/>',{class: "node-input-mobject-comment", type: "text", style: "margin-left: 5px; text-align: left;"}).appendTo(row);
107
+
108
+ var commentField = $('<input/>',{class: "node-input-mobject-comment", type: "text", style: "width: 120px; margin-left: 5px; text-align: left;"}).appendTo(row);
97
109
 
98
110
  // Populate the new stat
99
111
  uriField.val(mobject.uri);
100
112
  commentField.val(mobject.comment);
101
- resizeObject(container);
113
+ // resizeObject(container);
114
+
115
+ // *** MOBSEARCH *** //
116
+
117
+ if (!node.mobjects[i]) {
118
+ node.mobjects[i] = {uri: '', comment: ''}
119
+ }
120
+
121
+ addMobsearchListButton(searchField, i, mobsearchOpts)
122
+ // *** END MOBSEARCH *** //
102
123
  },
103
124
  resizeItem: resizeObject
104
125
  });
@@ -107,19 +128,31 @@ POSSIBILITY OF SUCH DAMAGE.
107
128
  if (!node.mobjects) {
108
129
  node.mobjects = [mobject = {uri: '', comment: ''}];
109
130
  }
110
- // Populate list with all saved filters
131
+ // *** MOBSEARCH *** //
132
+
133
+ mobsearchOpts = {
134
+ htmlElementId: 'mobsearch',
135
+ list: node.mobjects,
136
+ containerRowName: 'node-input-mobjects-container-row',
137
+ containerName: 'node-input-mobjects-container',
138
+ containerSecondFieldName: 'node-input-mobject-comment',
139
+ };
140
+ initMobsearch.toIns_listed(mobiusSrvc, mobsearchOpts);
141
+
142
+ // *** END MOBSEARCH *** //
143
+
111
144
  for (let i = 0; i < node.mobjects.length; i++) {
112
145
  let mobject = node.mobjects[i];
113
146
  $("#node-input-mobjects-container").editableList('addItem', mobject);
114
147
  }
115
148
  },
116
149
  oneditresize(size) {
117
- var rows = $("#dialog-form>div:not(.node-input-mobjects-container-row)");
150
+ var rows = $("#dialog-form>div:not(.node-input-mobjects-container)");
118
151
  var height = size.height;
119
152
  for (var i=0; i<rows.size(); i++) {
120
153
  height -= $(rows[i]).outerHeight(true);
121
154
  }
122
- var editorRow = $("#dialog-form>div.node-input-mobjects-container-row");
155
+ var editorRow = $("#dialog-form>div.node-input-mobjects-container");
123
156
  height -= 4 * ((parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))));
124
157
 
125
158
  $("#node-input-mobjects-container").editableList('height',height);
@@ -28,7 +28,7 @@
28
28
  'use strict';
29
29
 
30
30
  module.exports = function (RED) {
31
- function MobiusFlowNode (n) {
31
+ function MobiusFlowNode(n) {
32
32
  RED.nodes.createNode(this, n);
33
33
  this.mobjects = n.mobjects;
34
34
  this.serviceConn = RED.nodes.getNode(n.connection);
@@ -38,7 +38,7 @@ module.exports = function (RED) {
38
38
  node.status({
39
39
  fill: 'red',
40
40
  shape: 'ring',
41
- text: 'Disconnected'
41
+ text: 'Disconnected',
42
42
  });
43
43
 
44
44
  node.serviceConn.register(node);
@@ -47,7 +47,7 @@ module.exports = function (RED) {
47
47
  node.status({
48
48
  fill: 'green',
49
49
  shape: 'ring',
50
- text: 'Busy'
50
+ text: 'Busy',
51
51
  });
52
52
 
53
53
  for (const mobject of node.mobjects) {
@@ -55,7 +55,7 @@ module.exports = function (RED) {
55
55
  node.status({
56
56
  fill: 'yellow',
57
57
  shape: 'dot',
58
- text: 'URIs not Valid'
58
+ text: 'URIs not Valid',
59
59
  });
60
60
  if (done) {
61
61
  return done();
@@ -71,15 +71,15 @@ module.exports = function (RED) {
71
71
  node.status({
72
72
  fill: 'green',
73
73
  shape: 'dot',
74
- text: 'Done'
74
+ text: 'Done',
75
75
  });
76
- node.send({topic: msg.topic, payload: values});
76
+ node.send({ topic: msg.topic, payload: values });
77
77
  })
78
78
  .catch((err) => {
79
79
  node.status({
80
80
  fill: 'yellow',
81
81
  shape: 'dot',
82
- text: 'Error: ' + JSON.stringify(err.code)
82
+ text: 'Error: ' + JSON.stringify(err.code),
83
83
  });
84
84
  node.error('Mobius error reading object ' + JSON.stringify(err));
85
85
  })
@@ -98,7 +98,7 @@ module.exports = function (RED) {
98
98
  }
99
99
  }
100
100
 
101
- function validateResourceURI (uri) {
101
+ function validateResourceURI(uri) {
102
102
  let parts = uri.split('/');
103
103
  for (let lp = 0; lp < parts.length; lp++) {
104
104
  if (parts[lp] === null || parts[lp] === '') {
@@ -111,7 +111,7 @@ module.exports = function (RED) {
111
111
  return false;
112
112
  }
113
113
 
114
- function readObject (node, uri) {
114
+ function readObject(node, uri) {
115
115
  return new Promise((resolve, reject) => {
116
116
  node.serviceConn.readObject(uri, (err, response) => {
117
117
  if (err) {
@@ -124,4 +124,12 @@ module.exports = function (RED) {
124
124
  }
125
125
 
126
126
  RED.nodes.registerType('mobius get multi-object', MobiusFlowNode);
127
+
128
+ RED.httpAdmin.get('/common/*', function (req, res) {
129
+ var options = {
130
+ root: __dirname + '/common/',
131
+ dotfiles: 'deny',
132
+ };
133
+ res.sendFile(req.params[0], options);
134
+ });
127
135
  };