Click on id in debug panel highlights node or flow

This commit is contained in:
Ralph Wetzel 2023-11-18 21:03:13 +01:00
parent 5b5b06cc06
commit ea483218ea
2 changed files with 15 additions and 1 deletions

View File

@ -503,6 +503,16 @@ RED.utils = (function() {
$('<span class="red-ui-debug-msg-type-string-swatch"></span>').css('backgroundColor',obj).appendTo(e); $('<span class="red-ui-debug-msg-type-string-swatch"></span>').css('backgroundColor',obj).appendTo(e);
} }
let n = RED.nodes.node(obj) ?? RED.nodes.workspace(obj);
if (n) {
if (options.node_selector && "function" == typeof options.node_selector) {
e.css('cursor', 'pointer').on("click", function(evt) {
evt.preventDefault();
options.node_selector(n.id);
})
}
}
} else if (typeof obj === 'number') { } else if (typeof obj === 'number') {
e = $('<span class="red-ui-debug-msg-type-number"></span>').appendTo(entryObj); e = $('<span class="red-ui-debug-msg-type-number"></span>').appendTo(entryObj);
@ -609,6 +619,7 @@ RED.utils = (function() {
exposeApi: exposeApi, exposeApi: exposeApi,
// tools: tools // Do not pass tools down as we // tools: tools // Do not pass tools down as we
// keep them attached to the top-level header // keep them attached to the top-level header
node_selector: options.node_selector,
} }
).appendTo(row); ).appendTo(row);
} }
@ -639,6 +650,7 @@ RED.utils = (function() {
exposeApi: exposeApi, exposeApi: exposeApi,
// tools: tools // Do not pass tools down as we // tools: tools // Do not pass tools down as we
// keep them attached to the top-level header // keep them attached to the top-level header
node_selector: options.node_selector,
} }
).appendTo(row); ).appendTo(row);
} }
@ -695,6 +707,7 @@ RED.utils = (function() {
exposeApi: exposeApi, exposeApi: exposeApi,
// tools: tools // Do not pass tools down as we // tools: tools // Do not pass tools down as we
// keep them attached to the top-level header // keep them attached to the top-level header
node_selector: options.node_selector,
} }
).appendTo(row); ).appendTo(row);
} }

View File

@ -642,7 +642,8 @@ RED.debug = (function() {
hideKey: false, hideKey: false,
path: path, path: path,
sourceId: sourceNode&&sourceNode.id, sourceId: sourceNode&&sourceNode.id,
rootPath: path rootPath: path,
node_selector: config.messageSourceClick,
}); });
// Do this in a separate step so the element functions aren't stripped // Do this in a separate step so the element functions aren't stripped
debugMessage.appendTo(el); debugMessage.appendTo(el);