@gregoriusrippenstein/node-red-contrib-introspection 0.11.0 → 0.11.2
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 +12 -0
- package/package.json +1 -1
- package/plugins/sidebar.html +28 -2
package/README.md
CHANGED
|
@@ -110,6 +110,18 @@ Tracing and debug-message tracing are now separate operations and neither works
|
|
|
110
110
|
|
|
111
111
|
Tracing or debugging **all** nodes is **no longer** the default action.
|
|
112
112
|
|
|
113
|
+
*UPDATE FOUR*:
|
|
114
|
+
|
|
115
|
+
**Clamp Mode**
|
|
116
|
+
|
|
117
|
+
This idea is 100% from [@AllanOricil](https://discourse.nodered.org/t/should-debug-nodes-be-capable-of-passing-the-message-forwards/95044/97?u=gregorius) and I stole that idea from him - all kudos to him, all bugs to me!
|
|
118
|
+
|
|
119
|
+

|
|
120
|
+
|
|
121
|
+
Clamp mode allows highlighting individual wires and tracing the messages that go over that wire. Only **single** wires are allowed and unhighlighting the wire will **deactivate** the message trace.
|
|
122
|
+
|
|
123
|
+
**BE WARNED**: this can and will flood your Node-RED frontend to non-responsiveness, there is **no** inbuilt back-off, message limits or anything else that might or might not prevent bad things from happening.
|
|
124
|
+
|
|
113
125
|
## Palette Nodes
|
|
114
126
|
|
|
115
127
|
### Sink & Seeker
|
package/package.json
CHANGED
package/plugins/sidebar.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
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
|
-
function setupTreeMsgTracerlist(){try{$("#node-input-msgtracer-trace-treelist").treeList("empty"),$("#node-input-msgtracer-trace-treelist").treeList("data",[])}catch(e){$("#node-input-msgtracer-trace-treelist").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(),$("#node-input-msgtracer-toggle").is(":checked")||($(".red-ui-debug-msg").css("background-color",""),$(".red-ui-debug-msg-node-"+t.node.id).css("background-color","red")))}).on("treelistconfirm",function(e,t){var
|
|
17
|
+
function setupTreeMsgTracerlist(){try{$("#node-input-msgtracer-trace-treelist").treeList("empty"),$("#node-input-msgtracer-trace-treelist").treeList("data",[])}catch(e){$("#node-input-msgtracer-trace-treelist").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(),$("#node-input-msgtracer-toggle").is(":checked")||($(".red-ui-debug-msg").css("background-color",""),$(".red-ui-debug-msg-node-"+t.node.id).css("background-color","red")))}).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)),n==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-msgtracer-trace-treelist-filter").show();var n=$("#node-input-msgtracer-trace-treelist-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-msgtracer-trace-treelist").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-msgtracer-trace-treelist").treeList("filter",function(e){return-1<e._label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)||-1<e.node.id.toLowerCase().indexOf(t)||-1<e.sublabel.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-msgtracer-trace-treelist").treeList("data").length))}})}}function msgTracerDebugOff(){$.ajax({url:"MsgTracer/debug/off",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({}),success:function(e){},error:function(e,t,n){}})}function msgTracerTracingOff(){$.ajax({url:"MsgTracer/msgtracing/off",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({}),success:function(e){},error:function(e,t,n){}})}function toggleClampWithDebug(e){$("#node-input-msgtracer-clamp-mode-with-debug").is(":checked")||msgTracerDebugOff()}function toggleClampWireTappingInBackend(e){if($("#node-input-msgtracer-clamp-mode").is(":checked")){let o=e=>{var t,n,r=t=>{$.ajax({url:"MsgTracer/msgtracing/off",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({}),error:function(e,t,n){},success:function(e){$.ajax({url:"MsgTracer/msgtracing/on",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodesSelected:t,allIsOn:!1}),error:function(e,t,n){},success:function(e){$("#node-input-msgtracer-clamp-mode-with-debug").is(":checked")?$.ajax({url:"MsgTracer/debug/on",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodesSelected:t,allIsOn:!1}),success:function(e){},error:function(e,t,n){}}):msgTracerDebugOff()}})}})};$("#node-input-msgtracer-clamp-mode").is(":checked")?(t=RED.view.selection()).links&&1==t.links.length?(n=[(n=RED.view.selection().links[0]).source.id,n.target.id],setupTreeMsgTracerlist(),r(n),$("#node-input-msgtracer-clamp-mode-status").show()):t.nodes&&0<t.nodes.length?(setupTreeMsgTracerlist(),r(t.nodes.map(e=>e.id)),$("#node-input-msgtracer-clamp-mode-status").show()):($("#node-input-msgtracer-clamp-mode-status").hide(),msgTracerTracingOff(),msgTracerDebugOff()):(RED.events.off("view:selection-changed",o),$("#node-input-msgtracer-clamp-mode-status").hide())};RED.events.on("view:selection-changed",o)}else $("#node-input-msgtracer-clamp-mode-status").hide(),msgTracerTracingOff(),msgTracerDebugOff()}function toggleDebugTracingInBackend(e){let t=$("#node-input-msgtracer-msgtodebug").is(":checked");var n=$("#node-input-msgtracer-msgtodebug-all").is(":checked"),r=RED.view.selection().nodes;r||n||!t?r&&0<r.length&&n&&t?($("#node-input-msgtracer-msgtodebug").prop("checked",!1),$("#node-input-msgtracer-msgtodebug-all").prop("checked",!1),RED.notify("Debug Messages not toggled, both nodes selected and all nodes is on.",{type:"error",timeout:3e3})):(t||$("#node-input-msgtracer-msgtodebug-all").prop("checked",!1),$.ajax({url:"MsgTracer/debug/"+(t?"on":"off"),type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodesSelected:(RED.view.selection().nodes||[]).map(e=>e.id),allIsOn:n}),success:function(e){RED.notify("Message debugging is <b>"+(t?"on":"off")+"</b>",{type:"success",timeout:3e3})},error:function(e,t,n){RED.notify("Message tracing failed: "+t,{type:"error",timeout:3e3})}})):($("#node-input-msgtracer-msgtodebug").prop("checked",!1),RED.notify("Debug Messages not toggled, first select nodes to be debugged <b>or</b> toggle 'all nodes' to on.",{type:"error",timeout:3e3}))}function toggleMsgTracingInBackend(e){let t=$("#node-input-msgtracer-toggle").is(":checked");var n=$("#node-input-msgtracer-toggle-all").is(":checked"),r=RED.view.selection().nodes;r||n||!t?r&&0<r.length&&n&&t?($("#node-input-msgtracer-toggle-all").prop("checked",!1),$("#node-input-msgtracer-toggle").prop("checked",!1),RED.notify("Message tracing not toggled, nodes are selected <b>and</b> all nodes is checked.",{type:"error",timeout:3e3})):(t||$("#node-input-msgtracer-toggle-all").prop("checked",!1),t&&setupTreeMsgTracerlist(),$.ajax({url:"MsgTracer/msgtracing/"+(t?"on":"off"),type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({nodesSelected:(RED.view.selection().nodes||[]).map(e=>e.id),allIsOn:n}),success:function(e){RED.notify("Message tracing is <b>"+(t?"on":"off")+"</b>",{type:"success",timeout:3e3})},error:function(e,t,n){RED.notify("Message tracing failed: "+t,{type:"error",timeout:3e3})}})):($("#node-input-msgtracer-toggle").prop("checked",!1),RED.notify("Message tracing not toggled, first select nodes to be traced <b>or</b> toggle 'all nodes' to on.",{type:"error",timeout:3e3}))}
|
|
18
18
|
|
|
19
19
|
function transformInjectToChangeNode(t){t&&t.preventDefault();t=[...(RED.view.selection().nodes||[]).filter(e=>"inject"==e.type),...(RED.view.selection().nodes||[]).filter(e=>"group"==e.type).map(e=>e.nodes.filter(e=>"inject"==e.type))].flat();if(0==(t=RED.nodes.createExportableNodeSet(t)).length)RED.notify("No inject nodes found in node selection",{type:"warning"});else{let e=t.map(o=>{var e={id:RED.nodes.id(),type:"change",name:o.name,action:"",property:"",from:"",to:"",reg:!1,x:0,y:0,wires:[[]]};return e.rules=o.props.map(e=>{var t={t:"set",p:e.p,pt:"msg",to:e.v,tot:e.vt};return"payload"==e.p?(t.to=o.payload,t.tot=o.payloadType):"topic"==e.p&&(t.to=o.topic),t}),e});setTimeout(()=>{RED.clipboard.import(),setTimeout(()=>{$("#red-ui-clipboard-dialog-import-text").val(JSON.stringify(e)).trigger("paste")},300)},400)}}
|
|
20
20
|
|
|
@@ -268,8 +268,15 @@
|
|
|
268
268
|
$("#node-input-msgtracer-trace-treelist").treeList('data', [])
|
|
269
269
|
})
|
|
270
270
|
|
|
271
|
+
$('#node-input-msgtracer-clamp-mode-with-debug').on("change", toggleClampWithDebug)
|
|
272
|
+
$('#node-input-msgtracer-clamp-mode').on("change", toggleClampWireTappingInBackend)
|
|
271
273
|
$('#node-input-msgtracer-msgtodebug').on("change", toggleDebugTracingInBackend)
|
|
272
274
|
$('#node-input-msgtracer-toggle').on("change", toggleMsgTracingInBackend)
|
|
275
|
+
$('#node-input-msgtracer-clamp-mode-status').on('click', () => {
|
|
276
|
+
$('#node-input-msgtracer-clamp-mode-status').hide()
|
|
277
|
+
msgTracerTracingOff()
|
|
278
|
+
msgTracerDebugOff()
|
|
279
|
+
})
|
|
273
280
|
|
|
274
281
|
RED.actions.add( "introspection:show-link-call-links", highlightAllLinkCalls)
|
|
275
282
|
|
|
@@ -454,7 +461,26 @@
|
|
|
454
461
|
|
|
455
462
|
<div>
|
|
456
463
|
<!-- message tracing stuff -->
|
|
457
|
-
|
|
464
|
+
<div class="form-row" style="margin-left: 10px; margin-top: 40px">
|
|
465
|
+
<label for="node-input-msgtracer-clamp-mode" class="w-25">
|
|
466
|
+
<i class="fa fa-bolt"></i>
|
|
467
|
+
<span>Clamp Mode?</span>
|
|
468
|
+
</label>
|
|
469
|
+
<input type="checkbox" id="node-input-msgtracer-clamp-mode"
|
|
470
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
471
|
+
|
|
472
|
+
<label for="node-input-msgtracer-clamp-mode-with-debug" class="w-25">
|
|
473
|
+
<i class="fa fa-bug"></i>
|
|
474
|
+
<span>With Debug?</span>
|
|
475
|
+
</label>
|
|
476
|
+
<input type="checkbox" id="node-input-msgtracer-clamp-mode-with-debug"
|
|
477
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
478
|
+
|
|
479
|
+
<label id="node-input-msgtracer-clamp-mode-status" style="display: none;" class="w-25">
|
|
480
|
+
<i class="fa fa-check"></i> <span>On</span>
|
|
481
|
+
</label>
|
|
482
|
+
</div>
|
|
483
|
+
|
|
458
484
|
<div class="form-row" style="margin-left: 10px; margin-top: 40px">
|
|
459
485
|
<label for="node-input-msgtracer-toggle" class="w-25">
|
|
460
486
|
<i class="fa fa-stethoscope"></i>
|