node-red-contrib-mobius-flow-base 2.5.91 → 3.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +16 -0
  3. package/.github/ISSUE_TEMPLATE/general.md +7 -0
  4. package/.github/workflows/build_publish.yml +80 -0
  5. package/README.md +4 -10
  6. package/dist/engine-api-calls.d.ts +19 -0
  7. package/dist/engine-api-calls.js +235 -0
  8. package/dist/engine-api-client.d.ts +8 -0
  9. package/dist/engine-api-client.js +106 -0
  10. package/dist/engine-websocket.d.ts +60 -0
  11. package/dist/engine-websocket.js +264 -0
  12. package/dist/node-red-ui-funcs.js +180 -0
  13. package/dist/nodes/common/mobsearch.js +602 -0
  14. package/dist/nodes/mobius-change-admin-password.d.ts +26 -0
  15. package/dist/nodes/mobius-change-admin-password.html +98 -0
  16. package/dist/nodes/mobius-change-admin-password.js +87 -0
  17. package/dist/nodes/mobius-clear-resource.html +37 -12
  18. package/dist/nodes/mobius-clear-resource.js +17 -13
  19. package/dist/nodes/mobius-connection-interface.d.ts +45 -0
  20. package/dist/nodes/mobius-connection-interface.js +2 -0
  21. package/dist/nodes/mobius-connection.html +30 -8
  22. package/dist/nodes/mobius-connection.js +216 -85
  23. package/dist/nodes/mobius-discover-object-list.html +185 -126
  24. package/dist/nodes/mobius-discover-object-list.js +24 -5
  25. package/dist/nodes/mobius-discover.js +7 -7
  26. package/dist/nodes/mobius-filter-by-rid-value.html +62 -42
  27. package/dist/nodes/mobius-filter-by-rid-value.js +38 -31
  28. package/dist/nodes/mobius-flow-inject.html +32 -2
  29. package/dist/nodes/mobius-get-multi-object.html +39 -5
  30. package/dist/nodes/mobius-get-multi-resource.html +37 -4
  31. package/dist/nodes/mobius-get-multi-resource.js +13 -12
  32. package/dist/nodes/mobius-get-object.html +39 -11
  33. package/dist/nodes/mobius-get-object.js +12 -9
  34. package/dist/nodes/mobius-get-resource.html +41 -12
  35. package/dist/nodes/mobius-get-resource.js +17 -12
  36. package/dist/nodes/mobius-object-cov.html +40 -11
  37. package/dist/nodes/mobius-object-cov.js +9 -6
  38. package/dist/nodes/mobius-resource-cov.html +37 -11
  39. package/dist/nodes/mobius-resource-cov.js +5 -5
  40. package/dist/nodes/mobius-set-multi-resource.html +39 -12
  41. package/dist/nodes/mobius-set-multi-resource.js +9 -11
  42. package/dist/nodes/mobius-set-resource.html +38 -11
  43. package/package.json +15 -8
  44. package/dist/nodes/node-red-ui-discover-devices.js +0 -103
@@ -63,72 +63,85 @@ POSSIBILITY OF SUCH DAMAGE.
63
63
  </script>
64
64
 
65
65
  <script type="text/javascript">
66
- RED.nodes.registerType('mobius filter by rid value',{
66
+ RED.nodes.registerType('mobius filter by rid value', {
67
67
  category: 'mobius',
68
- color:"#8abff5",
68
+ color: '#8abff5',
69
69
  defaults: {
70
+ name: { value: '' },
71
+ pids: { value: '[]' },
72
+ func: { value: '' },
73
+ limit: { value: 100, validate: RED.validators.number() },
74
+ rid: { value: '', validate: RED.validators.regex(/^[A-Fa-f0-9][A-Fa-f0-9]$/) },
75
+ detailedOutput: { value: false },
76
+ service: {
77
+ value: '',
78
+ validate: function (v) {
79
+ if (v === '') {
80
+ return true;
81
+ }
82
+ let parts = v.split('/');
83
+ for (let lp = 0; lp < parts.length; lp++) {
84
+ if (parts[lp] === null || parts[lp] === '') {
85
+ return false;
86
+ }
87
+ }
88
+ if (parts.length === 2) {
89
+ return true;
90
+ }
91
+ return false;
92
+ },
93
+ },
94
+ connection: { type: 'mobius connection', required: true },
70
95
  outputs: {value:1},
71
- name: {value:""},
72
- pids: {value: "[]"},
73
- func: {value:""},
74
- limit: {value:100, validate:RED.validators.number()},
75
- rid: {value:"", validate:RED.validators.regex(/^[A-Fa-f0-9][A-Fa-f0-9]$/)},
76
- detailedOutput: {value:false},
77
- service: {value:"", validate:function(v) {
78
- if(v === '') { return true; }
79
- let parts = v.split('/');
80
- for(let lp = 0; lp < parts.length; lp++) {
81
- if(parts[lp] === null || parts[lp] === '') { return false;}
82
- }
83
- if(parts.length === 2) { return true; }
84
- return false;
85
- }},
86
- connection: {type:"mobius connection", required:true}
87
96
  },
88
- inputs:1,
89
- outputs:1,
97
+ inputs: 1,
98
+ outputs: 1,
90
99
  outputLabels: function (index) {
91
- if(index === 0) return ("Filtered object list");
92
- if(index === 1) return ("Full MOBiUS response");
100
+ if (index === 0) return 'Filtered object list';
101
+ if (index === 1) return 'Full MOBiUS response';
93
102
  },
94
- icon: "mobius.png",
95
- align: "left",
103
+ icon: 'mobius.png',
104
+ align: 'left',
96
105
  paletteLabel: 'filter by rid value',
97
- label: function() {
98
- if(this.name) {
106
+ label: function () {
107
+ if (this.name) {
99
108
  return this.name;
100
109
  } else {
101
- return this.service ? `Filter - ${this.service} by RID ${this.rid}` : "filter by rid value";
110
+ return this.service ? `Filter - ${this.service} by RID ${this.rid}` : 'filter by rid value';
102
111
  }
103
112
  },
104
- labelStyle: function() {
105
- return this.name ? "node_label_italic":"";
113
+ labelStyle: function () {
114
+ return this.name ? 'node_label_italic' : '';
106
115
  },
107
- oneditprepare: function() {
108
- $("#node-input-pids").typedInput({
109
- type:"json",
110
- types:["json"]
116
+ oneditprepare: function () {
117
+ $("#node-input-outputs").val(this.detailedOutput ? 2 : 1);
118
+ $("#node-input-detailedOutput").change(function() {
119
+ $("#node-input-outputs").val(this.checked ? 2 : 1);
120
+ });
121
+ $('#node-input-pids').typedInput({
122
+ type: 'json',
123
+ types: ['json'],
111
124
  });
112
125
  this.editor = RED.editor.createEditor({
113
126
  id: 'node-input-func-editor',
114
127
  mode: 'ace/mode/javascript',
115
- value: this.func
128
+ value: this.func,
116
129
  });
117
130
  },
118
- oneditsave: function() {
119
- if($("#node-input-detailedOutput").prop('checked')) {
120
- $("#node-input-outputs").val(2);
121
- } else {
122
- $("#node-input-outputs").val(1);
123
- }
131
+ oneditsave: function () {
132
+ // if ($('#node-input-detailedOutput').prop('checked')) {
133
+ // $('#node-input-outputs').val(2);
134
+ // } else {
135
+ // $('#node-input-outputs').val(1);
136
+ // }
124
137
  this.func = this.editor.getValue();
125
138
  this.editor.destroy();
126
139
  delete this.editor;
127
140
  },
128
- oneditcancel: function() {
141
+ oneditcancel: function () {
129
142
  this.editor.destroy();
130
143
  delete this.editor;
131
- }
144
+ },
132
145
  });
133
146
  </script>
134
147
 
@@ -197,6 +210,13 @@ POSSIBILITY OF SUCH DAMAGE.
197
210
  </ol>
198
211
 
199
212
  <h3>Details</h3>
213
+ <p>
214
+ The <code>Function</code> configuration property is string containing the JavaScript function used to test the resource value. The function must return <b>true</b> or <b>false</b>.
215
+ A few examples are shown below (The name v is used to represent the resource values in the following example. You can use any identifier of your choice):</br>
216
+ <code>(v) => { return v === 5; }</code><br>
217
+ <code>function test (v) { return v > 10 && v < 100; }</code><br>
218
+ <code>(v) => { return v.includes('test-string'); }</code>
219
+ </p>
200
220
  <p>Outputs 3 and 4 are only sent if <b>Use detailed outputs</b> is checked on the configuration page.</p>
201
221
  <p>Outputs 1, 2 and 3 are only sent if no error occurs. The <b>error</b> property in output 4
202
222
  can be used to determine if an error has occurred.</p>
@@ -24,13 +24,13 @@
24
24
  POSSIBILITY OF SUCH DAMAGE.
25
25
  **/
26
26
 
27
- // <input type="text" id="node-input-func" placeholder="Function used for filtering (return $PV === 0)">
27
+ // <input type="text" id="node-input-func" placeholder="Function used for filtering (return $PV === 0)">
28
28
 
29
29
  /* jshint elision: true */
30
30
  'use strict';
31
31
 
32
32
  module.exports = function (RED) {
33
- function MobiusFilterNode (n) {
33
+ function MobiusFilterNode(n) {
34
34
  RED.nodes.createNode(this, n);
35
35
  this.detailedOutput = n.detailedOutput;
36
36
  this.service = n.service;
@@ -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.on('input', function (msg) {
@@ -75,38 +75,45 @@ module.exports = function (RED) {
75
75
  node.status({
76
76
  fill: 'green',
77
77
  shape: 'ring',
78
- text: 'Busy'
78
+ text: 'Busy',
79
79
  });
80
- node.serviceConn.filterObjectsByRIDValue(uri, pids, rid, limit, func, (err, response) => {
81
- if (err) {
82
- node.status({
83
- fill: 'yellow',
84
- shape: 'dot',
85
- text: 'Error: ' + JSON.stringify(err.code)
86
- });
87
- if (node.detailedOutput === true) {
88
- node.send([null, {topic: uri, payload: { error: true, response: err }}]);
89
- }
90
- } else {
91
- node.status({
92
- fill: 'green',
93
- shape: 'dot',
94
- text: JSON.stringify(response.uri)
95
- });
96
- let uriList = [];
97
- for (let lp = 0; lp < response.value.length; lp++) {
98
- uriList.push(`${response.uri}/${response.value[lp].pid}/${response.value[lp].ins}`)
99
- }
100
- if (node.detailedOutput === true) {
101
- node.send([
102
- { topic: uri, payload: uriList },
103
- { topic: uri, payload: { error: false, response: response } }
104
- ]);
80
+ node.serviceConn.filterObjectsByRIDValue(
81
+ uri,
82
+ pids,
83
+ rid,
84
+ limit,
85
+ eval('(' + func + ')'),
86
+ (err, response) => {
87
+ if (err) {
88
+ node.status({
89
+ fill: 'yellow',
90
+ shape: 'dot',
91
+ text: 'Error: ' + JSON.stringify(err.code),
92
+ });
93
+ if (node.detailedOutput === true) {
94
+ node.send([null, { topic: uri, payload: { error: true, response: err } }]);
95
+ }
105
96
  } else {
106
- node.send({ topic: uri, payload: uriList });
97
+ node.status({
98
+ fill: 'green',
99
+ shape: 'dot',
100
+ text: JSON.stringify(response.uri),
101
+ });
102
+ let uriList = [];
103
+ for (let lp = 0; lp < response.value.length; lp++) {
104
+ uriList.push(`${response.uri}/${response.value[lp].pid}/${response.value[lp].ins}`);
105
+ }
106
+ if (node.detailedOutput === true) {
107
+ node.send([
108
+ { topic: uri, payload: uriList },
109
+ { topic: uri, payload: { error: false, response: response } },
110
+ ]);
111
+ } else {
112
+ node.send({ topic: uri, payload: uriList });
113
+ }
107
114
  }
108
115
  }
109
- });
116
+ );
110
117
  });
111
118
 
112
119
  node.serviceConn.register(node);
@@ -34,10 +34,12 @@ 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
 
43
45
  <script type="text/javascript">
@@ -67,7 +69,7 @@ POSSIBILITY OF SUCH DAMAGE.
67
69
  },
68
70
  oneditprepare: function () {
69
71
  var node = this;
70
-
72
+ let mobiusSrvc = $("#node-input-connection").val();
71
73
  /** Create the subs container and populate it */
72
74
  $('#node-input-subs-container').css('min-height', '300px').css('min-width', '450px').editableList ({
73
75
  addButton: "add",
@@ -86,6 +88,11 @@ POSSIBILITY OF SUCH DAMAGE.
86
88
 
87
89
  var row = $('<div>URI</div>').appendTo(container);
88
90
  var uriField = $('<input/>',{class: "node-input-sub-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
91
+
92
+ // *** MOBSEARCH *** //
93
+ var searchField = $('<a class="searchbutton" style="margin-left: 5px; vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
94
+ // *** END MOBSEARCH *** //
95
+
89
96
  var typeField = $('<select/>',{class: "node-input-sub-type", style: "width:auto; margin-left: 5px; text-align: center;"}).appendTo(row);
90
97
  typeField.append($("<option></option>").val('include').text('Include'));
91
98
  typeField.append($("<option></option>").val('exclude').text('Exclude'));
@@ -93,6 +100,15 @@ POSSIBILITY OF SUCH DAMAGE.
93
100
  // Populate the new stat
94
101
  uriField.val(subscription.uri);
95
102
  typeField.val(subscription.type);
103
+
104
+ // *** MOBSEARCH *** //
105
+
106
+ if (!node.subscriptions[i]) {
107
+ node.subscriptions[i] = {uri: '', type: 'include'}
108
+ }
109
+
110
+ addMobsearchListButton(mobiusSrvc, searchField, i, mobsearchOpts)
111
+ // *** END MOBSEARCH *** //
96
112
  }
97
113
  });
98
114
 
@@ -100,6 +116,20 @@ POSSIBILITY OF SUCH DAMAGE.
100
116
  if (!node.subscriptions) {
101
117
  node.subscriptions = [subscription = {uri: '', type: 'include'}];
102
118
  }
119
+
120
+ // *** MOBSEARCH *** //
121
+
122
+ mobsearchOpts = {
123
+ htmlElementId: 'mobsearch',
124
+ list: node.subscriptions,
125
+ containerRowName: 'node-input-subs-container-row',
126
+ containerName: 'node-input-subs-container',
127
+ containerSecondFieldName: 'node-input-sub-type',
128
+ };
129
+ initMobsearch.toIns_listed(mobiusSrvc, mobsearchOpts);
130
+
131
+ // *** END MOBSEARCH *** //
132
+
103
133
  // Populate list with all saved filters
104
134
  for (let i = 0; i < node.subscriptions.length; i++) {
105
135
  let subscription = node.subscriptions[i];
@@ -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',
@@ -67,11 +71,12 @@ 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
  /** Resize a object when it has changed */
72
77
  function resizeObject (mobject) {
73
78
  let newWidth = mobject.width();
74
- mobject.find(".node-input-mobject-comment").width(newWidth - 270);
79
+ mobject.find(".node-input-mobject-comment").width(newWidth - 300);
75
80
  }
76
81
 
77
82
  /** Create the objects container and populate it */
@@ -92,21 +97,50 @@ POSSIBILITY OF SUCH DAMAGE.
92
97
 
93
98
  var row = $('<div>URI</div>').appendTo(container);
94
99
  var uriField = $('<input/>',{class: "node-input-mobject-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
100
+
101
+ // *** MOBSEARCH *** //
102
+ var searchField = $('<a class="searchbutton" style="margin-left: 5px; vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
103
+ // *** END MOBSEARCH *** //
104
+
95
105
  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);
106
+ var commentField = $('<input/>',{class: "node-input-mobject-comment", type: "text", style: "width: 35%; margin-left: 5px; text-align: left;"}).appendTo(row);
97
107
 
98
108
  // Populate the new stat
99
109
  uriField.val(mobject.uri);
100
110
  commentField.val(mobject.comment);
101
- resizeObject(container);
111
+ // resizeObject(container);
112
+
113
+ // *** MOBSEARCH *** //
114
+
115
+ if (!node.mobjects[i]) {
116
+ node.mobjects[i] = {uri: '', comment: ''}
117
+ }
118
+
119
+ addMobsearchListButton(mobiusSrvc, searchField, i, mobsearchOpts)
120
+ // *** END MOBSEARCH *** //
121
+
102
122
  },
103
- resizeItem: resizeObject
123
+ // resizeItem: resizeObject
104
124
  });
105
125
 
106
126
  // If no mobjects exists, create a default one
107
127
  if (!node.mobjects) {
108
128
  node.mobjects = [mobject = {uri: '', comment: ''}];
109
129
  }
130
+
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
+
110
144
  // Populate list with all saved filters
111
145
  for (let i = 0; i < node.mobjects.length; i++) {
112
146
  let mobject = node.mobjects[i];
@@ -41,12 +41,16 @@ POSSIBILITY OF SUCH DAMAGE.
41
41
  <option value="object">Object - Resource PVs, URIs and Names</option>
42
42
  </select>
43
43
  </div>
44
- <div class="form-row node-input-resources-container-row">
44
+ <div id="node-input-resources-container-row" class="form-row node-input-resources-container-row">
45
45
  <label for="node-input-resources-container"><i class="fa fa-bars"></i> Resources</label>
46
46
  <ol id="node-input-resources-container"></ol>
47
47
  </div>
48
+
49
+ <div id="mobsearch"></div>
48
50
  </script>
49
51
 
52
+ <script src="common/mobsearch.js"></script>
53
+
50
54
  <script type="text/javascript">
51
55
  RED.nodes.registerType('mobius get multi-resource', {
52
56
  category: 'mobius',
@@ -75,6 +79,7 @@ POSSIBILITY OF SUCH DAMAGE.
75
79
  },
76
80
  oneditprepare: function () {
77
81
  var node = this;
82
+ let mobiusSrvc = $("#node-input-connection").val();
78
83
 
79
84
  /** Resize a resource when it has changed */
80
85
  function resizeResource (resource) {
@@ -100,21 +105,49 @@ POSSIBILITY OF SUCH DAMAGE.
100
105
 
101
106
  var row = $('<div>URI</div>').appendTo(container);
102
107
  var uriField = $('<input/>',{class: "node-input-resource-uri", type: "text", style: "width: 200px; margin-left: 5px; text-align: left;"}).appendTo(row);
108
+
109
+ // *** MOBSEARCH *** //
110
+ var searchField = $('<a class="searchbutton" style="margin-left: 5px; vertical-align: middle"><i id="node-lookup-instance-icon" class="fa fa-search"></i></a>').appendTo(row);
111
+
112
+ // *** END MOBSEARCH *** //
113
+
103
114
  row.append('&nbsp;&nbsp;-&nbsp;');
104
- var commentField = $('<input/>',{class: "node-input-resource-comment", type: "text", style: "margin-left: 5px; text-align: left;"}).appendTo(row);
115
+ var commentField = $('<input/>',{class: "node-input-resource-comment", type: "text", style: "width: 35%; margin-left: 5px; text-align: left;"}).appendTo(row);
105
116
 
106
117
  // Populate the new stat
107
118
  uriField.val(resource.uri);
108
119
  commentField.val(resource.comment);
109
- resizeResource(container);
120
+ //resizeResource(container);
121
+
122
+ // *** MOBSEARCH *** //
123
+ if (!node.resources[i]) {
124
+ node.resources[i] = {uri: '', comment: ''}
125
+ }
126
+ addMobsearchListButton(mobiusSrvc, searchField, i, mobsearchOpts)
127
+ // *** END MOBSEARCH *** //
128
+
110
129
  },
111
- resizeItem: resizeResource
130
+ // resizeItem: resizeResource
112
131
  });
113
132
 
114
133
  // If no stat exists, create a default one
115
134
  if (!node.resources) {
116
135
  node.resources = [resource = {uri: '', comment: ''}];
117
136
  }
137
+
138
+ // *** MOBSEARCH *** //
139
+
140
+ mobsearchOpts = {
141
+ htmlElementId: 'mobsearch',
142
+ list: node.resources,
143
+ containerRowName: 'node-input-resources-container-row',
144
+ containerName: 'node-input-resources-container',
145
+ containerSecondFieldName: 'node-input-resources-comment',
146
+ };
147
+ initMobsearch.toRid_listed(mobiusSrvc, mobsearchOpts);
148
+
149
+ // *** END MOBSEARCH *** //
150
+
118
151
  // Populate list with all saved filters
119
152
  for (let i = 0; i < node.resources.length; i++) {
120
153
  let resource = node.resources[i];
@@ -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.resources = n.resources;
34
34
  this.sendFormat = n.send;
@@ -39,7 +39,7 @@ module.exports = function (RED) {
39
39
  node.status({
40
40
  fill: 'red',
41
41
  shape: 'ring',
42
- text: 'Disconnected'
42
+ text: 'Disconnected',
43
43
  });
44
44
 
45
45
  node.serviceConn.register(node);
@@ -48,7 +48,7 @@ module.exports = function (RED) {
48
48
  node.status({
49
49
  fill: 'green',
50
50
  shape: 'ring',
51
- text: 'Busy'
51
+ text: 'Busy',
52
52
  });
53
53
 
54
54
  for (const resource of node.resources) {
@@ -56,7 +56,7 @@ module.exports = function (RED) {
56
56
  node.status({
57
57
  fill: 'yellow',
58
58
  shape: 'dot',
59
- text: 'URIs not Valid'
59
+ text: 'URIs not Valid',
60
60
  });
61
61
  if (done) {
62
62
  return done();
@@ -69,26 +69,27 @@ module.exports = function (RED) {
69
69
  }
70
70
  Promise.all(promiseChain)
71
71
  .then((values) => {
72
+ console.log(values);
72
73
  node.status({
73
74
  fill: 'green',
74
75
  shape: 'dot',
75
- text: 'Done'
76
+ text: 'Done',
76
77
  });
77
78
  if (node.sendFormat === 'array') {
78
- node.send({topic: msg.topic, payload: values});
79
+ node.send({ topic: msg.topic, payload: values });
79
80
  } else {
80
81
  let payload = values.reduce((obj, item) => {
81
82
  obj[item.uri] = { pv: item.pv, name: item.name };
82
83
  return obj;
83
84
  }, {});
84
- node.send({topic: msg.topic, payload: payload});
85
+ node.send({ topic: msg.topic, payload: payload });
85
86
  }
86
87
  })
87
88
  .catch((err) => {
88
89
  node.status({
89
90
  fill: 'yellow',
90
91
  shape: 'dot',
91
- text: 'Error: ' + JSON.stringify(err.code)
92
+ text: 'Error: ' + JSON.stringify(err.code),
92
93
  });
93
94
  node.error('Mobius error reading resource ' + JSON.stringify(err));
94
95
  })
@@ -107,7 +108,7 @@ module.exports = function (RED) {
107
108
  }
108
109
  }
109
110
 
110
- function validateResourceURI (uri) {
111
+ function validateResourceURI(uri) {
111
112
  let parts = uri.split('/');
112
113
  for (let lp = 0; lp < parts.length; lp++) {
113
114
  if (parts[lp] === null || parts[lp] === '') {
@@ -120,16 +121,16 @@ module.exports = function (RED) {
120
121
  return false;
121
122
  }
122
123
 
123
- function readResource (node, uri) {
124
+ function readResource(node, uri) {
124
125
  return new Promise((resolve, reject) => {
125
126
  node.serviceConn.readResource(uri, (err, response) => {
126
127
  if (err) {
127
128
  reject(err);
128
129
  } else {
129
130
  if (node.sendFormat === 'array') {
130
- resolve(response.value.pv);
131
+ resolve(response.data.pv);
131
132
  } else {
132
- resolve({uri: uri, pv: response.value.pv, name: response.value.name});
133
+ resolve({ uri: uri, pv: response.data.pv, name: response.data.name });
133
134
  }
134
135
  }
135
136
  });
@@ -29,10 +29,18 @@ POSSIBILITY OF SUCH DAMAGE.
29
29
  <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
30
  <input type="text" id="node-input-connection">
31
31
  </div>
32
- <div class="form-row">
33
- <label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
34
- <input type="text" id="node-input-mobject" placeholder="Object URI (hid/sid/pid/ins)">
32
+
33
+ <hr>
34
+
35
+ <div id="instance-row">
36
+ <div class="form-row" id="input-row">
37
+ <label for="node-input-mobject"><i class="fa fa-tasks"></i> URI</label>
38
+ <input type="text" id="node-input-mobject" style="width:61%;" placeholder="Object URI (hid/sid/pid/ins)">
39
+ </div>
35
40
  </div>
41
+
42
+ <div id="mobsearch"></div>
43
+
36
44
  <div class="form-row">
37
45
  <label for="node-input-format"><i class="fa fa-bars"></i> Format</label>
38
46
  <select type="text" id="node-input-format" style="display: inline-block; width: auto; vertical-align: center;">
@@ -40,10 +48,12 @@ POSSIBILITY OF SUCH DAMAGE.
40
48
  <option value="rid">By RID</option>
41
49
  </select>
42
50
  </div>
51
+
43
52
  <div class="form-row">
44
53
  <label>&nbsp;</label>
45
54
  <input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
46
55
  <label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
56
+ <input type="hidden" id="node-input-outputs"/>
47
57
  </div>
48
58
  <hr>
49
59
  <div class="form-row">
@@ -52,6 +62,8 @@ POSSIBILITY OF SUCH DAMAGE.
52
62
  </div>
53
63
  </script>
54
64
 
65
+ <script src="common/mobsearch.js"></script>
66
+
55
67
  <script type="text/javascript">
56
68
  RED.nodes.registerType('mobius get object',{
57
69
  category: 'mobius',
@@ -70,7 +82,8 @@ POSSIBILITY OF SUCH DAMAGE.
70
82
  if(parts.length < 4 && parts[parts.length - 1] === '#') { return true; }
71
83
  return false;
72
84
  }},
73
- connection: {type: "mobius connection", required: true}
85
+ connection: {type: "mobius connection", required: true},
86
+ outputs: {value:1},
74
87
  },
75
88
  inputs:1,
76
89
  outputs:1,
@@ -92,13 +105,28 @@ POSSIBILITY OF SUCH DAMAGE.
92
105
  labelStyle: function() {
93
106
  return this.name ? "node_label_italic":"";
94
107
  },
95
- oneditsave: function() {
96
- if($("#node-input-detailedOutput").prop('checked')) {
97
- this.outputs = 3;
98
- } else {
99
- this.outputs = 1;
100
- }
101
- }
108
+ oneditprepare: function () {
109
+ $("#node-input-outputs").val(this.detailedOutput ? 3 : 1);
110
+ $("#node-input-detailedOutput").change(function() {
111
+ $("#node-input-outputs").val(this.checked ? 3 : 1);
112
+ });
113
+ var node = this;
114
+ let mobiusSrvc = $("#node-input-connection").val();
115
+
116
+ opts = {
117
+ htmlElementId: 'mobsearch',
118
+ uriFieldName: 'node-input-mobject',
119
+ inputRowId: 'input-row',
120
+ };
121
+ initMobsearch.toIns(mobiusSrvc, opts);
122
+ },
123
+ // oneditsave: function() {
124
+ // if($("#node-input-detailedOutput").prop('checked')) {
125
+ // this.outputs = 3;
126
+ // } else {
127
+ // this.outputs = 1;
128
+ // }
129
+ // }
102
130
  });
103
131
  </script>
104
132