@gregoriusrippenstein/node-red-contrib-introspection 0.2.3 → 0.2.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.
package/README.md CHANGED
@@ -63,6 +63,12 @@ If this functionality is not desired, then disable this node in the palette mana
63
63
 
64
64
  Is a palette-only node meaning that it should not be included in any flows. What it does is to highlight nodes if they are referenced in the URL. This node will check the hash value of the URL and if it contains a node id, it will jump to the workspace and focus on the node in question. The node id should be given in the form of `/n/<node id>`, for example: [`.../#flow/878170e6f86c502b/n/b3baf3ca092064a9`](https://demo.openmindmap.org/omm/#flow/878170e6f86c502b/n/b3baf3ca092064a9). Any flow id that is given will be ignored and instead the flow of the node will be shown.
65
65
 
66
+ This functionality will be part of Node-RED 3.1.x upon release, so this node only makes sense for Node-RED 3.0.x versions.
67
+
68
+ This now also support `/n/<node id>/edit` which is also part of the 3.1.x release.
69
+
70
+ One final feature of this node is path highlighting, this is done by appeanding a `/p/<node1Id>,<node2Id>,<node3Id>,...` to the URL. Whether this will be natively supported in Node-RED is the author unclear.
71
+
66
72
  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
73
 
68
74
  ### DrawSVG
@@ -24,7 +24,9 @@
24
24
  RED.sidebar.info.show()
25
25
  }, 1000);
26
26
 
27
- if ( (RED.utils.getBrowserInfo().mobile > 0) || window.matchMedia('only screen and (max-width: 890px)').matches ) {
27
+ if ( (RED.utils.getBrowserInfo().mobile > 0) ||
28
+ window.matchMedia('only screen and (max-width: 890px)').matches ) {
29
+
28
30
  setTimeout( function() {
29
31
  // taken from https://discourse.nodered.org/t/togglepalette-v-togglesidebar/78169/3
30
32
  RED.actions.invoke("core:toggle-palette", false)
@@ -32,9 +34,6 @@
32
34
  }, 1400);
33
35
  }
34
36
  },
35
-
36
- onpaletteremove: () => {
37
- },
38
37
  });
39
38
  </script>
40
39
 
@@ -18,7 +18,7 @@
18
18
  },
19
19
 
20
20
  onpaletteadd: () => {
21
- var nodeId = window.location.hash.match(/\/n\/(.{16})/);
21
+ var nodeId = window.location.hash.match(/\/n\/([^\/]{16})(\/edit)?/);
22
22
 
23
23
  // RED.nodes is not initialised at this point, so there is no way to
24
24
  // check whether the nodeId really does exist, so we assume that nodeId
@@ -27,8 +27,14 @@
27
27
  var hndlr = (node) => {
28
28
  if ( node.id == nodeId[1] ) {
29
29
  setTimeout( function() {
30
- RED.workspaces.show(RED.nodes.node(nodeId[1]).z,false,false,true);
31
- RED.view.reveal(nodeId[1],true)
30
+ var nde = RED.nodes.node(nodeId[1]);
31
+ RED.workspaces.show(nde.z,false,false,true);
32
+
33
+ if ( nodeId[2] == "/edit" ) {
34
+ RED.editor.edit(nde);
35
+ }
36
+
37
+ RED.view.reveal(nodeId[1],true);
32
38
  }, 1012);
33
39
  RED.events.off("nodes:add", hndlr);
34
40
  }
@@ -60,12 +60,22 @@ module.exports = function(RED) {
60
60
  "Authorization": "Bearer " + access_token
61
61
  }
62
62
  }).then( res => {
63
- node.status({fill:"green",shape:"dot",text:"Good"});
64
- setTimeout( function() { node.status({}) }, 450);
63
+ var bodySize = res.body.length;
64
+
65
65
  send( {
66
66
  ...msg,
67
67
  payload: res.body
68
68
  });
69
+
70
+ node.status({fill:"green",shape:"dot",text:"Good"});
71
+ setTimeout( function() {
72
+ node.status({
73
+ fill: "blue",
74
+ shape: "dot",
75
+ text: "Flow size: " + bodySize
76
+ })
77
+ }, 450);
78
+
69
79
  }).catch( err => {
70
80
  node.status({fill:"red",shape:"dot",text:"Failed"});
71
81
  node.error(err)
@@ -88,12 +98,21 @@ module.exports = function(RED) {
88
98
  {headers: {"Node-RED-API-Version": cfg.flowVersion}}
89
99
  ).then( res => {
90
100
  if ( res.statusCode == 200 ) {
101
+ var bodySize = res.body.length;
102
+
91
103
  send( {
92
104
  ...msg,
93
105
  payload: res.body
94
106
  });
107
+
95
108
  node.status({fill:"green",shape:"dot",text:"Good"});
96
- setTimeout( function() { node.status({}) }, 450);
109
+ setTimeout( function() {
110
+ node.status({
111
+ fill: "blue",
112
+ shape: "dot",
113
+ text: "Flow size: " + bodySize
114
+ })
115
+ }, 450);
97
116
  } else {
98
117
  node.error( res );
99
118
  node.status({fill:"red",shape:"dot",text:"Failed"});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/node-red-contrib-introspection",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "keywords": [
5
5
  "node-red"
6
6
  ],