@gregoriusrippenstein/node-red-contrib-introspection 0.7.7 → 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/package.json +1 -1
- package/plugins/sidebar.html +29 -10
package/package.json
CHANGED
package/plugins/sidebar.html
CHANGED
|
@@ -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-
|
|
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
|
-
|
|
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-
|
|
334
|
-
class="red-ui-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">
|