@5minds/node-red-dashboard-2-processcube-dynamic-table 1.1.18-develop-4045be-m24ef9dz → 1.1.18-develop-7f9614-m2eo13fj
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.
- package/nodes/dynamic-table.js +1 -38
- package/package.json +1 -1
package/nodes/dynamic-table.js
CHANGED
|
@@ -8,50 +8,13 @@ module.exports = function (RED) {
|
|
|
8
8
|
|
|
9
9
|
const base = group.getBase();
|
|
10
10
|
|
|
11
|
-
const timeToLive = 24 * 60 * 60 * 1000; // one day
|
|
12
|
-
|
|
13
|
-
function ageOf(obj) {
|
|
14
|
-
return new Date().getTime() - obj.timestamp;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
//server-side event handlers
|
|
18
12
|
const evts = {
|
|
19
13
|
onAction: true,
|
|
20
14
|
beforeSend: function (msg) {
|
|
21
15
|
if (Array.isArray(msg)) return msg;
|
|
22
16
|
msg.payload = RED.util.evaluateNodeProperty(config.data, config.data_type, node, msg);
|
|
23
|
-
|
|
24
|
-
if (msg._client != undefined) {
|
|
25
|
-
let socketId = msg._client.socketId;
|
|
26
|
-
|
|
27
|
-
let currentSession = {
|
|
28
|
-
...msg,
|
|
29
|
-
timestamp: new Date().getTime(),
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
node.context().set(socketId, currentSession);
|
|
33
|
-
} else {
|
|
34
|
-
const keys = node.context().keys();
|
|
35
|
-
const modifiedObjects = [];
|
|
36
|
-
|
|
37
|
-
keys.forEach((key) => {
|
|
38
|
-
let obj = node.context().get(key);
|
|
39
|
-
|
|
40
|
-
if (obj && obj.payload) {
|
|
41
|
-
obj.payload = msg.payload;
|
|
42
|
-
|
|
43
|
-
node.context().set(key, obj);
|
|
44
|
-
modifiedObjects.push(obj);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (ageOf(obj) > timeToLive) {
|
|
48
|
-
node.context().set(key, undefined);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
msg = modifiedObjects;
|
|
53
|
-
}
|
|
54
|
-
|
|
17
|
+
|
|
55
18
|
return msg;
|
|
56
19
|
},
|
|
57
20
|
onInput: function (msg, send, done) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-dashboard-2-processcube-dynamic-table",
|
|
3
|
-
"version": "1.1.18-develop-
|
|
3
|
+
"version": "1.1.18-develop-7f9614-m2eo13fj",
|
|
4
4
|
"description": "A ui component for showing dynamic Data with actions in a table",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"processcube",
|