@gregoriusrippenstein/node-red-contrib-introspection 0.1.9 → 0.2.0
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/README.md +13 -5
- package/examples/get-flows.json +76 -0
- package/nodes/05-seeker.html +3 -2
- package/nodes/20-orphans.html +1 -0
- package/nodes/45-get-flows.html +33 -0
- package/nodes/45-get-flows.js +40 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ I found myself working on various flows and found some particular artistic but I
|
|
|
10
10
|
|
|
11
11
|
Orphans node many or many not have their reasons, sometimes nodes aren't meant to be there and can actually be deleted. Either way, nodes that have no connections, either in nor out, *might* no longer be needed. For me, orphan nodes represent commented-out code or code that can't be reached, so they potentially represent nostalgia, a nostalgia for coding ideas that are no longer valid.
|
|
12
12
|
|
|
13
|
-
Sometimes I found myself having extremely complex flows, flows that went over multiple tabs via the link-in/out nodes. I was lost as to how specific nodes were ever reached. The birth of the Sink & Seeker nodes was inevitable.
|
|
13
|
+
Sometimes I found myself having extremely complex flows, flows that went over multiple tabs via the link-in/out nodes. I was lost as to how specific nodes were ever reached. The birth of the Sink & Seeker nodes was inevitable.
|
|
14
14
|
|
|
15
15
|
## Nodes
|
|
16
16
|
|
|
@@ -26,7 +26,7 @@ The nodes shown are across all flows and tabs, there is no need to have a Orphan
|
|
|
26
26
|
|
|
27
27
|
### Sink & Seeker
|
|
28
28
|
|
|
29
|
-
Place the sink node at the end of a any flow, the point that needs to be reached. Place the seeker at the starting point. Double click on the seeker to open the tray and all possible paths (if there are any) between it and the sink are shown.
|
|
29
|
+
Place the sink node at the end of a any flow, the point that needs to be reached. Place the seeker at the starting point. Double click on the seeker to open the tray and all possible paths (if there are any) between it and the sink are shown.
|
|
30
30
|
|
|
31
31
|
Double click on the top-level node and all nodes in the pathway are highlighted. Opening the top-level node shows all nodes along the path. Clicking on a node will highlight that node in flow.
|
|
32
32
|
|
|
@@ -51,7 +51,7 @@ Disappointments:
|
|
|
51
51
|
|
|
52
52
|
Since version 0.0.5 the Screenshot node takes one input. That input will trigger the node to take a screenshot *without double clicking to open the tray*. The intention is to have an inject trigger regularly so that screenshots are made automagically and flows can have highlights. Screenshots are then posted to the endpoint `/screenshot` (this can be captured with a http-in node) and data is post as a json object `{ d: <svgdata> }`.
|
|
53
53
|
|
|
54
|
-
There is an example [flow](/examples/trigger-and-save-screenshot.json) that demonstrates this feature. The author is aware that this is dangerously close to enabling spyware for flow modification, please see the [LICENSE](/LICENSE) and behaviour.
|
|
54
|
+
There is an example [flow](/examples/trigger-and-save-screenshot.json) that demonstrates this feature. The author is aware that this is dangerously close to enabling spyware for flow modification, please see the [LICENSE](/LICENSE) and behaviour.
|
|
55
55
|
|
|
56
56
|
### IsMobile
|
|
57
57
|
|
|
@@ -69,16 +69,24 @@ This is a hack that uses the `onpaletteadd` callback to do its magic. If this fu
|
|
|
69
69
|
|
|
70
70
|
A node for inserting an SVG image into the workspace. The image is layered above the grid but below nodes and their connections. The input message must contain SVG data (in string form) in the `payload` attribute.
|
|
71
71
|
|
|
72
|
+
### GetFlows -- Experimental
|
|
73
|
+
|
|
74
|
+
Node retrieves the current `flows.json` from the server but using the [Node-RED API](https://nodered.org/docs/api/admin/methods/get/flows/) so that it is storage independent. It returns the flows as a `payload` on the message.
|
|
75
|
+
|
|
76
|
+
The intention that this is triggered on a regular basis to backup the flows to a third party storage system. Inspired by the [dsm](https://flows.nodered.org/node/node-red-contrib-dsm) package that has a [backup](https://github.com/cflurin/node-red-contrib-dsm/wiki/Backup) state machine.
|
|
77
|
+
|
|
78
|
+
Does not set the authentication token, hence experimental.
|
|
79
|
+
|
|
72
80
|
## Examples
|
|
73
81
|
|
|
74
|
-
There are [example flows](/examples) contained in the package, examples can also be found online:
|
|
82
|
+
There are [example flows](/examples) contained in the package, examples can also be found online:
|
|
75
83
|
|
|
76
84
|
- [Orphans](https://demo.openmindmap.org/omm/#flow/3ebb65fdbecb182e/n/2be3f8794979d47b) - node is top left of flow or search for `type:Orphans`
|
|
77
85
|
- [Seeker](https://demo.openmindmap.org/omm/#flow/40ea5f2aea6592ae/n/b5f189a78d829197) - top left and the [Sink](https://demo.openmindmap.org/omm/#flow/459c271a96458c7c/n/e3262d9d2791ab78) - top right
|
|
78
86
|
- [Screenshot](https://demo.openmindmap.org/omm/#flow/4e2d8c13066b705e/n/499b1383580831aa) - top left
|
|
79
87
|
- [DrawSVG](https://demo.openmindmap.org/omm/#flow/6c8ce462533a1da4/n/248f2edd3d8acd96)
|
|
80
88
|
|
|
81
|
-
Example screenshot:
|
|
89
|
+
Example screenshot:
|
|
82
90
|
|
|
83
91
|

|
|
84
92
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "7185cd493586e55a",
|
|
4
|
+
"type": "inject",
|
|
5
|
+
"z": "6bab6804614c2612",
|
|
6
|
+
"name": "",
|
|
7
|
+
"props": [
|
|
8
|
+
{
|
|
9
|
+
"p": "payload"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"p": "topic",
|
|
13
|
+
"vt": "str"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"repeat": "",
|
|
17
|
+
"crontab": "",
|
|
18
|
+
"once": false,
|
|
19
|
+
"onceDelay": 0.1,
|
|
20
|
+
"topic": "",
|
|
21
|
+
"payload": "",
|
|
22
|
+
"payloadType": "date",
|
|
23
|
+
"x": 542,
|
|
24
|
+
"y": 156,
|
|
25
|
+
"wires": [
|
|
26
|
+
[
|
|
27
|
+
"6af8626dd463e3bb"
|
|
28
|
+
]
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "7c18a75ca7a625eb",
|
|
33
|
+
"type": "debug",
|
|
34
|
+
"z": "6bab6804614c2612",
|
|
35
|
+
"name": "debug 3",
|
|
36
|
+
"active": true,
|
|
37
|
+
"tosidebar": true,
|
|
38
|
+
"console": false,
|
|
39
|
+
"tostatus": false,
|
|
40
|
+
"complete": "false",
|
|
41
|
+
"statusVal": "",
|
|
42
|
+
"statusType": "auto",
|
|
43
|
+
"x": 955,
|
|
44
|
+
"y": 367,
|
|
45
|
+
"wires": []
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "6af8626dd463e3bb",
|
|
49
|
+
"type": "GetFlows",
|
|
50
|
+
"z": "6bab6804614c2612",
|
|
51
|
+
"name": "",
|
|
52
|
+
"x": 672,
|
|
53
|
+
"y": 222,
|
|
54
|
+
"wires": [
|
|
55
|
+
[
|
|
56
|
+
"a84edc1bacf03204"
|
|
57
|
+
]
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "a84edc1bacf03204",
|
|
62
|
+
"type": "json",
|
|
63
|
+
"z": "6bab6804614c2612",
|
|
64
|
+
"name": "",
|
|
65
|
+
"property": "payload",
|
|
66
|
+
"action": "",
|
|
67
|
+
"pretty": false,
|
|
68
|
+
"x": 797,
|
|
69
|
+
"y": 292,
|
|
70
|
+
"wires": [
|
|
71
|
+
[
|
|
72
|
+
"7c18a75ca7a625eb"
|
|
73
|
+
]
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
]
|
package/nodes/05-seeker.html
CHANGED
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
var dirList = $("#node-input-seeker-target-container-div").css({
|
|
54
54
|
width: "100%",
|
|
55
55
|
height: "100%"
|
|
56
|
-
}).treeList({
|
|
57
|
-
|
|
56
|
+
}).treeList({
|
|
57
|
+
multi:true
|
|
58
|
+
}).on("treelistitemmouseover", function(e, item) {
|
|
58
59
|
if ( item.node) {
|
|
59
60
|
if ( item.children) {
|
|
60
61
|
item.node.highlighted = true;
|
package/nodes/20-orphans.html
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('GetFlows',{
|
|
3
|
+
color: '#e5e4ef',
|
|
4
|
+
icon: "subflow.svg",
|
|
5
|
+
category: 'introspection',
|
|
6
|
+
defaults: {
|
|
7
|
+
name: {
|
|
8
|
+
value:"",
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
inputs:1,
|
|
12
|
+
outputs:1,
|
|
13
|
+
|
|
14
|
+
label: function() {
|
|
15
|
+
return (this.name || this._def.paletteLabel);
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
labelStyle: function() {
|
|
19
|
+
return this.name?"node_label_italic":"";
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script type="text/html" data-template-name="GetFlows">
|
|
25
|
+
<div class="form-row">
|
|
26
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
27
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
28
|
+
</div>
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script type="text/html" data-help-name="GetFlows">
|
|
32
|
+
<p>Retrieves the current flow file from the server. This uses the Node-RED API and is therefore storage-method independent. Return value is a JSON.</p>
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = function(RED) {
|
|
2
|
+
function GetFlowsFunctionality(config) {
|
|
3
|
+
RED.nodes.createNode(this,config);
|
|
4
|
+
|
|
5
|
+
var node = this;
|
|
6
|
+
var cfg = config;
|
|
7
|
+
|
|
8
|
+
node.on('close', function() {
|
|
9
|
+
node.status({});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
node.on("input", function(msg, send, done) {
|
|
13
|
+
var os = require('os');
|
|
14
|
+
var got = require('got');
|
|
15
|
+
|
|
16
|
+
var url = "http://" + os.hostname() + ":" + RED.settings.get("uiPort");
|
|
17
|
+
if ( RED.settings.get("httpAdminRoot") != "/" ) {
|
|
18
|
+
url += RED.settings.get("httpAdminRoot");
|
|
19
|
+
}
|
|
20
|
+
url += "/flows";
|
|
21
|
+
|
|
22
|
+
node.status({fill:"blue",shape:"dot",text:"Requesting..."});
|
|
23
|
+
|
|
24
|
+
got.get( url ).then( res => {
|
|
25
|
+
if ( res.statusCode == 200 ) {
|
|
26
|
+
send( {
|
|
27
|
+
...msg,
|
|
28
|
+
payload: res.body
|
|
29
|
+
});
|
|
30
|
+
node.status({fill:"green",shape:"dot",text:"Good"});
|
|
31
|
+
setTimeout( function() { node.status({}) }, 450);
|
|
32
|
+
} else {
|
|
33
|
+
node.error( res );
|
|
34
|
+
node.status({fill:"red",shape:"dot",text:"Failed"});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
RED.nodes.registerType("GetFlows", GetFlowsFunctionality);
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gregoriusrippenstein/node-red-contrib-introspection",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"node-red"
|
|
6
6
|
],
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"orphans": "nodes/20-orphans.js",
|
|
20
20
|
"ismobile": "nodes/25-ismobile.js",
|
|
21
21
|
"navigator": "nodes/30-navigator.js",
|
|
22
|
-
"drawsvg": "nodes/40-drawsvg.js"
|
|
22
|
+
"drawsvg": "nodes/40-drawsvg.js",
|
|
23
|
+
"getflows": "nodes/45-get-flows.js"
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
"description": "Node-RED Editor-only nodes for introspecting flows.",
|