node-red-contrib-mobius-flow-base 2.5.86-beta.104 → 2.5.86-beta.105
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.
|
@@ -244,34 +244,56 @@ module.exports = function (RED) {
|
|
|
244
244
|
);
|
|
245
245
|
case 'lastUri':
|
|
246
246
|
const uri = node.users[mobiusNode.id].latestUri;
|
|
247
|
-
if (uri !== '') {
|
|
247
|
+
if (uri !== '' && uri !== undefined) {
|
|
248
248
|
node.users[mobiusNode.id].status({
|
|
249
249
|
fill: 'green',
|
|
250
250
|
shape: 'dot',
|
|
251
251
|
text: uri,
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
+
case 'lastValue':
|
|
255
|
+
const value = node.users[mobiusNode.id].latestValue;
|
|
256
|
+
if (value !== '' && value !== undefined) {
|
|
257
|
+
node.users[mobiusNode.id].status({
|
|
258
|
+
fill: 'green',
|
|
259
|
+
shape: 'dot',
|
|
260
|
+
text: value,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
254
263
|
}
|
|
255
264
|
};
|
|
256
265
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
266
|
+
// Information update functions to be used by node status
|
|
267
|
+
node.update = {
|
|
268
|
+
/**
|
|
269
|
+
* Update a given node's node last active time
|
|
270
|
+
* @param {Object} mobiusNode - The node whos last active time is to be updated
|
|
271
|
+
*/
|
|
272
|
+
lastActiveTime: (mobiusNode) => {
|
|
273
|
+
node.users[mobiusNode.id] = mobiusNode;
|
|
274
|
+
node.users[mobiusNode.id].lastActiveTime = Date.now();
|
|
275
|
+
node.updateNodeStatus(mobiusNode);
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Update a given node's node latest URI record
|
|
279
|
+
* @param {Object} mobiusNode - The node whos last URI record is to be updated
|
|
280
|
+
* @param {string} uri - The latest uri to be sent by the node
|
|
281
|
+
*/
|
|
282
|
+
latestUri: (mobiusNode, uri) => {
|
|
283
|
+
node.users[mobiusNode.id] = mobiusNode;
|
|
284
|
+
node.users[mobiusNode.id].latestUri = uri;
|
|
285
|
+
node.updateNodeStatus(mobiusNode);
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* Update a given node's node latest URI record
|
|
289
|
+
* @param {Object} mobiusNode - The node whos last URI record is to be updated
|
|
290
|
+
* @param {number} value - The latest value to be sent by the node
|
|
291
|
+
*/
|
|
292
|
+
latestValue: (mobiusNode, value) => {
|
|
293
|
+
node.users[mobiusNode.id] = mobiusNode;
|
|
294
|
+
node.users[mobiusNode.id].latestValue = value;
|
|
295
|
+
node.updateNodeStatus(mobiusNode);
|
|
296
|
+
},
|
|
275
297
|
};
|
|
276
298
|
|
|
277
299
|
/**
|
|
@@ -55,7 +55,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
55
55
|
<hr>
|
|
56
56
|
<div class="form-row">
|
|
57
57
|
<label for="node-input-statusType" style="width: 140px;"><i class="fa fa-bars"></i> Status Display</label>
|
|
58
|
-
<select type="text" id="node-input-statusType" style="display: inline-block; width:
|
|
58
|
+
<select type="text" id="node-input-statusType" style="display: inline-block; width: 282px; vertical-align: center;">
|
|
59
59
|
<option value="timeSinceLastActive">Show time since last active</option>
|
|
60
60
|
<option value="lastUri">Show last URI</option>
|
|
61
61
|
</select>
|
|
@@ -36,7 +36,6 @@ module.exports = function (RED) {
|
|
|
36
36
|
this.format = n.format;
|
|
37
37
|
this.include = n.include;
|
|
38
38
|
this.serviceConn = RED.nodes.getNode(n.connection);
|
|
39
|
-
this.latestUri = '';
|
|
40
39
|
this.statusType = n.statusType;
|
|
41
40
|
var node = this;
|
|
42
41
|
|
|
@@ -47,8 +46,8 @@ module.exports = function (RED) {
|
|
|
47
46
|
text: 'Disconnected',
|
|
48
47
|
});
|
|
49
48
|
node.serviceConn.subscribeToObjectCOV(node.object, this.id, (response) => {
|
|
50
|
-
node.serviceConn.
|
|
51
|
-
node.serviceConn.
|
|
49
|
+
node.serviceConn.update.latestUri(node, response.uri);
|
|
50
|
+
node.serviceConn.update.lastActiveTime(node);
|
|
52
51
|
let allResources = _.keyBy(
|
|
53
52
|
response.value.resources,
|
|
54
53
|
node.format === 'name' ? 'name' : 'rid'
|