I was wondering there there is a search term for input:0 output:0 i.e. nodes that have zero connections in and zero connections out, i.e. orphan nodes. I don't mean the nodes definition but the nodes usage in a flow.
There is a very specific reason why this is relevant for me and my use of Node-RED - this isn't an everyday use-case.
Is there a search reference guide which could give me more details?
No, the search functionality doesn't extend to filtering based on the connections a node has.
If you open the JavaScript console in the browser, you could run the following code to get such a list of nodes - it's a little raw, but does the job,
const connectedNodes = new Set()
const disconnectedNodes = new Set()
// Iterate over all links, add the nodes to the 'connected' set
RED.nodes.eachLink(link => { connectedNodes.add(link.source); connectedNodes.add(link.target) })
// Iterate over all nodes, add any not in the connected set to the disconnected set
RED.nodes.eachNode(node => { if (!connectedNodes.has(node)) disconnectedNodes.add(node) })
// Loop over and print out node info
disconnectedNodes.forEach(n => console.log(n.id, n.type, n.name))
I'll make myself a node that generates a list similar to a link-in/out node so that I can highlight these nodes or a modified debug node that generates debug messages upon which I can click. Or better still, just extend the search window
I ended up creating an extra node for displaying orphans nodes. It's similar to link-in/out in that it shows the nodes in the tray view --> node code
The node then shows a list of all nodes that match the search criteria using the treeList. When a entry gets clicked on, the workspace (i.e. tab) is changed to the nodes workspace and the node is brought into focus, much as search does. What I'd like to know is whether the code for that refocus is ok?
I ended up digging around in the Node-RED source code and found the view.reveal and workspace.show - I assume I can use those directly