@gregoriusrippenstein/node-red-contrib-introspection 0.7.6 → 0.7.8

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
@@ -12,14 +12,17 @@ Orphans node many or many not have their reasons, sometimes nodes aren't meant t
12
12
 
13
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
+ ## Screencast
16
+
17
+ For an introduction to these nodes, check out the [introduction screencasts](https://blog.openmindmap.org/blog/introspection).
18
+
19
+
15
20
  ## Sidebar Nodes
16
21
 
17
22
  There is no need nor requirement to deploy these nodes. Which implies that they also work in read-only mode of Node-RED. Since these nodes only provide information and make no changes, this should not be an issue.
18
23
 
19
24
  ### Screenshot
20
25
 
21
- **Update**: Screenshot node has become a sidebar node. This means it can no longer be triggered by external forces.
22
-
23
26
  ![img](https://cdn.openmindmap.org/content/1699269615464_Screen_Shot_2023-11-06_at_12.20.09.png)
24
27
 
25
28
  Drag the node into a flow, double-click on the node and the tray opens -depending on the size of the flow, this might take a moment. Once the tray is opened, the SVG is shown in the editor window (I took the code from the template node hence the syntax dropdown). Below the editor window is the download button. Pressing that will download the SVG as it is in the editor window, so making changes in that window will be reflected in the downloaded content.
@@ -41,8 +44,6 @@ Disappointments:
41
44
 
42
45
  ### Orphans
43
46
 
44
- **Update**: This is now a sidebar plugin which shows all unconnected nodes across alls flow tabs.
45
-
46
47
  ~~Drag the Orphan node into a flow, double click and all nodes that have no connections are shown in the tray. Click on a node to highlight its location in the flow.~~
47
48
 
48
49
  ![img](https://cdn.openmindmap.org/content/1699272147285_Screen_Shot_2023-11-06_at_13.02.22.png)
@@ -159,7 +160,7 @@ A node for inserting an SVG image into the workspace. The image is layered above
159
160
 
160
161
  ## Node-RED Versions
161
162
 
162
- These nodes have been tested and found to work on Node-RED 3.0.2 and 3.1.0.beta.4.
163
+ These nodes have been tested and found to work with: Node-RED 3.0.2, 3.1.0 to 3.1.6 and 4.0.0.beta.2.
163
164
 
164
165
  ## Examples
165
166
 
@@ -178,13 +179,10 @@ There are [example flows](/examples) contained in the package, examples can also
178
179
 
179
180
  [*Do whatever but don't do evil* license](/LICENSE)
180
181
 
181
- ## Contribution & Ideas
182
-
183
- Please here at GitHub via issues.
184
-
185
182
  ## Artifacts
186
183
 
187
184
  - [NPMjs Package](https://www.npmjs.com/package/@gregoriusrippenstein/node-red-contrib-introspection)
188
185
  - [GitHub Repository](https://github.com/gorenje/node-red-contrib-introspection)
189
186
  - [Flow that maintains this package](https://flowhub.org/f/d73d76db3df96ba2)
190
187
  - [Node-RED node package](https://flows.nodered.org/node/@gregoriusrippenstein/node-red-contrib-introspection)
188
+ - [Contact Author](https://blog.openmindmap.org/author.vcf)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/node-red-contrib-introspection",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "dependencies": {
5
5
  "got": "^13",
6
6
  "uglify-js": "^3.17.4",
@@ -12,7 +12,7 @@
12
12
 
13
13
  function highlightAllLinkCalls(){let e=[];RED.nodes.eachNode(t=>{t.z==RED.workspaces.active()&&"link call"==t.type&&e.push(t)}),e.forEach(t=>{$("#grplnkcallclk-"+t.id).remove();var e=document.createElementNS("http://www.w3.org/2000/svg","g"),l=(e.setAttribute("class","red-ui-linkcall-link-indicator"),e.setAttribute("transform","translate(12,0)"),e.setAttribute("id","grplnkcallclk-"+t.id),document.createElementNS("http://www.w3.org/2000/svg","circle")),i=(l.setAttribute("cx","5"),l.setAttribute("cy","5"),l.setAttribute("r","5"),l.setAttribute("id","lnkcallclk-"+t.id),l.setAttribute("style","cursor: pointer;"),t.links[0]);i?RED.nodes.node(i)?l.setAttribute("fill","green"):l.setAttribute("fill","red"):l.setAttribute("fill","orange"),e.append(l),$(e).insertBefore($("#"+t.id).find(".red-ui-flow-node-changed"));let r=t.id;$("#lnkcallclk-"+t.id).on("click",t=>{t&&t.preventDefault();t=RED.nodes.node(r);if(t){let l=t.links[0];1<t.links.length&&RED.notify("Multiple links, showing first","warning"),RED.nodes.node(l)?(RED.view.reveal(l),RED.view.select(l),setTimeout(()=>{$("#lnkcallclk-"+l).remove();var t=document.createElementNS("http://www.w3.org/2000/svg","g"),e=(t.setAttribute("class","red-ui-linkcall-link-indicator"),t.setAttribute("transform","translate(12,0)"),t.setAttribute("id","lnkcallclk-"+l),document.createElementNS("http://www.w3.org/2000/svg","circle"));e.setAttribute("cx","5"),e.setAttribute("cy","5"),e.setAttribute("r","5"),e.setAttribute("id","lnkcallclk-"+l),e.setAttribute("style","cursor: pointer;"),e.setAttribute("fill","green"),t.append(e),$(t).insertBefore($("#"+l).find(".red-ui-flow-node-changed")),$("#lnkcallclk-"+l).on("click",t=>{t&&t.preventDefault(),RED.view.reveal(r),RED.view.select(r),setTimeout(highlightAllLinkCalls,500)})},500)):RED.notify("Link in node not found","error")}else RED.notify("Node not found","error")})})}
14
14
 
15
- function setupTreelistAllLinksForLinkIn(e){e=collectAllLinksNodes(e);if(0==e.length){RED.notify("No links found",{type:"error",timeout:2e3});try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.node&&(RED.workspaces.show(t.node.z,!1,!1,!0),RED.view.reveal(t.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,t){var n;t.node&&(n=t.node.id,setTimeout(()=>{var e=RED.nodes.node(n);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e,"editor-tab-description")),n==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-orphan-target-filter").show();var n=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e.sort((e,t)=>e.node.z>t.node.z))}}function collectAllLinksNodes(t){let n=[];RED.nodes.eachNode(e=>{"link call"!=e.type&&"link out"!=e.type||-1<e.links.indexOf(t)&&n.push(e)});var i=[],r={};return n.forEach(function(e){var t=RED.nodes.getType(e.type);if(t){var n,o=t.label,o=("function"==typeof o?o.call(e):o)||"";if(0===(n=e.type).indexOf("subflow:"))return}t&&o||(o=e.type),r[e.id]={node:e,label:o,sublabel:n,selected:!1,checkbox:!1},i.push(r[e.id])}),i}
15
+ function setupTreelistAllLinksForLinkIn(e){e=collectAllLinksNodes(e);if(0==e.length){RED.notify("No links found",{type:"error",timeout:2e3});try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.node&&(RED.workspaces.show(t.node.z,!1,!1,!0),RED.view.reveal(t.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,t){var n;t.node&&(n=t.node.id,setTimeout(()=>{var e=RED.nodes.node(n);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e,"editor-tab-description")),n==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-orphan-target-filter").show();var n=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e.sort((e,t)=>e.node.z>t.node.z))}}function collectAllLinksNodes(t){let n=[];RED.nodes.eachNode(e=>{"link call"!=e.type&&"link out"!=e.type||-1<e.links.indexOf(t)&&n.push(e)});var i=[],r={};return n.forEach(function(e){var t=RED.nodes.getType(e.type);if(t){var n,o=t.label,o=("function"==typeof o?o.call(e):o)||"";if(0===(n=e.type).indexOf("subflow:"))return}t&&o||(o=e.type),r[e.id]={node:e,label:o,sublabel:n,selected:!1,checkbox:!1},i.push(r[e.id])}),i}function collectNodeStats(){let t={},n=[],o={workspaces:0,junctions:0,subflows:0,configs:0,groups:0,wires:0,nodes:0},i=(RED.nodes.eachConfig(e=>{o.configs+=1}),RED.nodes.eachLink(e=>{o.wires+=1}),RED.nodes.eachJunction(e=>{o.junctions+=1}),RED.nodes.eachGroup(e=>{o.groups+=1}),RED.nodes.eachWorkspace(e=>{o.workspaces+=1}),RED.nodes.eachSubflow(e=>{o.subflows+=1}),RED.nodes.eachNode(e=>{o.nodes+=1,t[e.type]=(t[e.type]||0)+1}),Object.keys(t).forEach(e=>{n.push({label:e,sublabel:t[e],selected:!1,checkbox:!1})}),[]),r=0;return Object.keys(o).forEach(e=>{r+=o[e],i.push({label:e,sublabel:o[e],selected:!1,checkbox:!1})}),[{label:"__ TOTALS",sublabel:r,selected:!1,checkbox:!1,children:i}].concat(n.sort((e,t)=>e.label>t.label))}function setupTreeListForNodeStats(){var e=collectNodeStats();try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){}).on("treelistconfirm",function(e,t){}),$("#node-input-orphan-target-filter").show();var n=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e)}
16
16
 
17
17
  // Add your plugin as a new tabsheet in the right sidebar AFTER the flow editor is completely started
18
18
  var initialiseConfigNodeOnce = () => {
@@ -49,7 +49,7 @@
49
49
 
50
50
  // Add tab, orphans
51
51
  tabs.addTab({
52
- id: 'func-introspection-tab-orphans',
52
+ id: 'func-introspection-tab-lint',
53
53
  iconClass: 'fa fa-eyedropper',
54
54
  label: 'Lint'
55
55
  });
@@ -243,10 +243,17 @@
243
243
  $('#node-input-linkcalls-find-btn').on('click', (e) => {
244
244
  if ( e ) { e.preventDefault() }
245
245
  highlightAllLinkCalls()
246
-
246
+
247
+ /*
247
248
  try {
248
249
  $("#node-input-orphan-target-container-div").treeList('empty')
249
- } catch (ex) { }
250
+ } catch (ex) { }
251
+ */
252
+ })
253
+
254
+ $('#node-input-statistics-btn').on('click', (e) => {
255
+ if ( e ) { e.preventDefault() }
256
+ setupTreeListForNodeStats()
250
257
  })
251
258
  };
252
259
  RED.events.on('runtime-state', initialiseConfigNodeOnce);
@@ -278,6 +285,9 @@
278
285
  </div>
279
286
 
280
287
  <div id="func-introspection-tabs-content" style="min-height: calc(100% - 95px);">
288
+
289
+ <!-- Screenshot Tab in Sidebar -->
290
+
281
291
  <div id="func-introspection-tab-screenshot" style="display:none; min-height: calc(100%);">
282
292
  <div class="form-row">
283
293
  <div class="col-100">
@@ -320,29 +330,38 @@
320
330
  </div>
321
331
  </div>
322
332
 
323
- <div id="func-introspection-tab-orphans" style="display:none; min-height: calc(100%);">
333
+ <!-- Lint Tab in Sidebar -->
334
+
335
+ <div id="func-introspection-tab-lint" style="display:none; min-height: calc(100%);">
324
336
  <div class="form-row" style="margin-left: 10px; margin-top: 30px">
325
337
  <button id="node-input-orphan-find-btn"
326
338
  class="red-ui-button"><i class="fa fa-life-ring"></i> Unconnected</button>
327
339
  <button id="node-input-documentation-find-btn"
328
340
  class="red-ui-button"><i class="fa fa-cc"></i> Undocumented</button>
329
- <button id="node-input-linkcalls-find-btn"
330
- class="red-ui-button"><i class="fa fa-link"></i> Link Calls</button>
331
341
  <button id="node-input-linkin-nodes-find-btn"
332
342
  class="red-ui-button"><i class="fa fa-link"></i> Link Ins</button>
333
- <button id="node-input-orphan-clear-workspace-btn"
334
- class="red-ui-button">Clear dots</button>
343
+ <button id="node-input-statistics-btn"
344
+ class="red-ui-button"><i class="fa fa-pie-chart"></i> Stats</button>
335
345
  </div>
336
346
 
337
347
  <div class="form-row"
338
- style="margin-left: 10px; position: relative; min-height: 200px; height: 450px; margin-right: 15px; ">
348
+ style="margin-left: 10px; position: relative; min-height: 200px; height: 450px; margin-right: 15px;">
339
349
  <div style="margin-bottom: 5px; width: 35%; padding-left: 60%;">
340
350
  <input type="text" id="node-input-orphan-target-filter" style="display: none;">
341
351
  </div>
342
352
  <div id="node-input-orphan-target-container-div"></div>
343
353
  </div>
354
+
355
+ <div class="form-row" style="margin-left: 10px; margin-top: 40px">
356
+ <button id="node-input-linkcalls-find-btn"
357
+ class="red-ui-button"><i class="fa fa-link"></i> Link Calls</button>
358
+ <button id="node-input-orphan-clear-workspace-btn"
359
+ class="red-ui-button">Clear dots</button>
360
+ </div>
344
361
  </div>
345
362
 
363
+ <!-- Obfuscation Tab in Sidebar -->
364
+
346
365
  <div id="func-introspection-tab-obfuscation" style="display:none; min-height: calc(100%);">
347
366
 
348
367
  <div class="form-row">