@gregoriusrippenstein/node-red-contrib-introspection 0.1.1 → 0.1.3

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 CHANGED
@@ -65,13 +65,18 @@ Is a palette-only node meaning that it should not be included in any flows. What
65
65
 
66
66
  This is a hack that uses the `onpaletteadd` callback to do its magic. If this functionality is not desired, then disable this node in the palette manager.
67
67
 
68
+ ### DrawSVG
69
+
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
+
68
72
  ## Examples
69
73
 
70
- There are some example flow contained in the package. There are also examples to be found online:
74
+ There are [example flows](/examples) contained in the package, examples can also be found online:
71
75
 
72
76
  - [Orphans](https://demo.openmindmap.org/omm/#flow/3ebb65fdbecb182e/n/2be3f8794979d47b) - node is top left of flow or search for `type:Orphans`
73
77
  - [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
74
78
  - [Screenshot](https://demo.openmindmap.org/omm/#flow/4e2d8c13066b705e/n/499b1383580831aa) - top left
79
+ - [DrawSVG](https://demo.openmindmap.org/omm/#flow/6c8ce462533a1da4/n/248f2edd3d8acd96)
75
80
 
76
81
  Example screenshot:
77
82
 
@@ -0,0 +1,72 @@
1
+ [
2
+ {
3
+ "id": "214f1986d70db2a6",
4
+ "type": "tab",
5
+ "label": "DrawSVG Example",
6
+ "disabled": false,
7
+ "info": "",
8
+ "env": []
9
+ },
10
+ {
11
+ "id": "97790509b555e06a",
12
+ "type": "DrawSVG",
13
+ "z": "214f1986d70db2a6",
14
+ "name": "",
15
+ "x": 488,
16
+ "y": 997,
17
+ "wires": []
18
+ },
19
+ {
20
+ "id": "be970616115487ae",
21
+ "type": "http request",
22
+ "z": "214f1986d70db2a6",
23
+ "name": "",
24
+ "method": "GET",
25
+ "ret": "txt",
26
+ "paytoqs": "ignore",
27
+ "url": "https://demo.openmindmap.org/content/open_mind.svg",
28
+ "tls": "",
29
+ "persist": false,
30
+ "proxy": "",
31
+ "insecureHTTPParser": false,
32
+ "authType": "",
33
+ "senderr": false,
34
+ "headers": [],
35
+ "x": 347,
36
+ "y": 923,
37
+ "wires": [
38
+ [
39
+ "97790509b555e06a"
40
+ ]
41
+ ]
42
+ },
43
+ {
44
+ "id": "e6c50e3da88baae0",
45
+ "type": "inject",
46
+ "z": "214f1986d70db2a6",
47
+ "name": "",
48
+ "props": [
49
+ {
50
+ "p": "payload"
51
+ },
52
+ {
53
+ "p": "topic",
54
+ "vt": "str"
55
+ }
56
+ ],
57
+ "repeat": "",
58
+ "crontab": "",
59
+ "once": false,
60
+ "onceDelay": 0.1,
61
+ "topic": "",
62
+ "payload": "",
63
+ "payloadType": "date",
64
+ "x": 211,
65
+ "y": 867,
66
+ "wires": [
67
+ [
68
+ "be970616115487ae"
69
+ ]
70
+ ]
71
+ }
72
+ ]
@@ -2,7 +2,7 @@
2
2
  {
3
3
  "id": "6bab6804614c2612",
4
4
  "type": "tab",
5
- "label": "Flow 2",
5
+ "label": "Seeker Sink Example",
6
6
  "disabled": false,
7
7
  "info": "",
8
8
  "env": []
@@ -2606,4 +2606,4 @@
2606
2606
  "y": 88,
2607
2607
  "wires": []
2608
2608
  }
2609
- ]
2609
+ ]
@@ -2,7 +2,7 @@
2
2
  {
3
3
  "id": "e815c52d1e6a0d25",
4
4
  "type": "tab",
5
- "label": "Flow 3",
5
+ "label": "Trigger Screenshot Example",
6
6
  "disabled": false,
7
7
  "info": "",
8
8
  "env": []
@@ -152,4 +152,4 @@
152
152
  ]
153
153
  ]
154
154
  }
155
- ]
155
+ ]
@@ -0,0 +1,53 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('DrawSVG',{
3
+ color: '#e5e4ef',
4
+ icon: "font-awesome/fa-image",
5
+ category: 'introspection',
6
+ defaults: {
7
+ name: {
8
+ value:"",
9
+ },
10
+ },
11
+ inputs:1,
12
+ outputs:0,
13
+
14
+ label: function() {
15
+ return (this.name || this._def.paletteLabel);
16
+ },
17
+
18
+ labelStyle: function() {
19
+ /*
20
+ because there is not a better hook to connect up the event
21
+ listener, misuse the label styling for this. Also don't register a
22
+ new listener each time, maintain only one listener by removing and
23
+ readding.
24
+ */
25
+ var that = this;
26
+ var functName = "introspect:" + that.id;
27
+
28
+ if ( !window[functName] ) {
29
+ window[functName] = (e,m) => {
30
+ if ( m.msg == "svgdata" ) {
31
+ $($($('svg')[0]).find('> g > g > g')[2]).append(m.payload);
32
+ }
33
+ }
34
+ }
35
+
36
+ RED.comms.unsubscribe(functName, window[functName]);
37
+ RED.comms.subscribe(functName, window[functName] );
38
+
39
+ return this.name?"node_label_italic":"";
40
+ },
41
+ });
42
+ </script>
43
+
44
+ <script type="text/html" data-template-name="DrawSVG">
45
+ <div class="form-row">
46
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
47
+ <input type="text" id="node-input-name" placeholder="Name">
48
+ </div>
49
+ </script>
50
+
51
+ <script type="text/html" data-help-name="DrawSVG">
52
+ <p>Draw the given SVG onto the workspace placing it between the grid and the nodes and their connections. To remove the image, reload the workspace. Doing a deploy will completely ignore any image added to the workspace.</p>
53
+ </script>
@@ -0,0 +1,25 @@
1
+ module.exports = function(RED) {
2
+ function DrawSVGFunctionality(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
+ RED.comms.publish("introspect:" + node.id, RED.util.encodeObject({
14
+ ...msg,
15
+ msg: "svgdata",
16
+ }));
17
+
18
+ node.status({ fill: "green", shape: "dot", text: "SVG Data sent" });
19
+ setTimeout( () => { node.status({}) }, 1432 );
20
+
21
+ send(msg);
22
+ });
23
+ }
24
+ RED.nodes.registerType("DrawSVG", DrawSVGFunctionality);
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/node-red-contrib-introspection",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "keywords": [
5
5
  "node-red"
6
6
  ],
@@ -18,7 +18,8 @@
18
18
  "screenshot": "nodes/15-screenshot.js",
19
19
  "orphans": "nodes/20-orphans.js",
20
20
  "ismobile": "nodes/25-ismobile.js",
21
- "navigator": "nodes/30-navigator.js"
21
+ "navigator": "nodes/30-navigator.js",
22
+ "drawsvg": "nodes/40-drawsvg.js"
22
23
  }
23
24
  },
24
25
  "description": "Node-RED Editor-only nodes for introspecting flows.",