From ea483218ea8ae5dd16ef0a6479b0d76275f55eda Mon Sep 17 00:00:00 2001 From: Ralph Wetzel Date: Sat, 18 Nov 2023 21:03:13 +0100 Subject: [PATCH] Click on id in debug panel highlights node or flow --- .../@node-red/editor-client/src/js/ui/utils.js | 13 +++++++++++++ .../nodes/core/common/lib/debug/debug-utils.js | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js index 4d8ccdd9d..60de0ac6a 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js @@ -503,6 +503,16 @@ RED.utils = (function() { $('').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') { e = $('').appendTo(entryObj); @@ -609,6 +619,7 @@ RED.utils = (function() { exposeApi: exposeApi, // tools: tools // Do not pass tools down as we // keep them attached to the top-level header + node_selector: options.node_selector, } ).appendTo(row); } @@ -639,6 +650,7 @@ RED.utils = (function() { exposeApi: exposeApi, // tools: tools // Do not pass tools down as we // keep them attached to the top-level header + node_selector: options.node_selector, } ).appendTo(row); } @@ -695,6 +707,7 @@ RED.utils = (function() { exposeApi: exposeApi, // tools: tools // Do not pass tools down as we // keep them attached to the top-level header + node_selector: options.node_selector, } ).appendTo(row); } diff --git a/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js b/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js index 70dc33605..f673246bd 100644 --- a/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js +++ b/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js @@ -642,7 +642,8 @@ RED.debug = (function() { hideKey: false, path: path, 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 debugMessage.appendTo(el);