@gregoriusrippenstein/node-red-contrib-introspection 0.3.4 → 0.3.5
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.
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
<script type="text/javascript">
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
RED.comms.subscribe('introspect:trigger-import-delete', (event,data) => {
|
|
4
|
+
if ( data.msg == "delete-old-nodes" ) {
|
|
5
|
+
RED.view.select(false)
|
|
6
|
+
|
|
7
|
+
// close any dialog that explains that there are duplicates and therefore
|
|
8
|
+
// only a copy can be imported, hit the cancel button on that one.
|
|
9
|
+
// Five clicks should do the job ...
|
|
10
|
+
for ( var idx = 0 ; idx < 5; idx++ ) {
|
|
11
|
+
$($('.ui-dialog-buttonset').find("button")[0]).trigger('click')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
var allSelectNodes = [];
|
|
15
|
+
|
|
16
|
+
RED.nodes.eachNode( function(e) {
|
|
17
|
+
if ( e._def && e.env && e.env[1] &&
|
|
18
|
+
e._def.category == data.payload.category &&
|
|
19
|
+
(Date.parse(e.env[1].value) <
|
|
20
|
+
(new Date().getTime() - parseInt(data.payload.old_than_ms))) ) {
|
|
21
|
+
allSelectNodes.push(e)
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
RED.view.select({ nodes: allSelectNodes })
|
|
26
|
+
setTimeout( () => {
|
|
27
|
+
RED.actions.invoke("core:delete-selection")
|
|
28
|
+
}, 1500);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
RED.comms.subscribe('introspect:trigger-import-tripped', (event,data) => {
|
|
3
33
|
if ( data.msg == "import-flow" ) {
|
|
4
34
|
var content = data.flowContent;
|
|
5
35
|
|
|
@@ -10,6 +10,18 @@ module.exports = function(RED) {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
node.on("input", function(msg, send, done) {
|
|
13
|
+
if ( msg.payload && msg.payload.cmd == "delete-nodes" ) {
|
|
14
|
+
RED.comms.publish('introspect:trigger-import-delete',
|
|
15
|
+
RED.util.encodeObject({
|
|
16
|
+
msg: "delete-old-nodes",
|
|
17
|
+
payload: msg.payload,
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
send(msg);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
RED.comms.publish("introspect:trigger-import-tripped",
|
|
14
26
|
RED.util.encodeObject({
|
|
15
27
|
flowContent: msg.payload,
|