Add labels to wires in editor

Is there a way to add labels (documentation) to wires in the editor? It would help to understand flows better, I think. Especially when you work in a team or have to change some old flows which you haven't looked at in a while.

No, but you could place comment nodes over the wires.

Also, every node (and flow and comment) can have additional info added in the description tab to be shown in the side bar when selected.

What I do is create a simple subflow which simply connects the input to a single output. You can use that as a kind of inline comment node, which is always connected to the connector you want to label, with the msg object just passing through. Use the node title as the label. As a subflow you can make it look as you want. I make mine mimic the white comment node

Not exactly what you want, but maybe it can help you a bit, you can give the output of a node a label. It should now be clear what the wire does that's connected to this output.
Open your node, then click on the appearance button and give your output a name that your teams understands.
If you hoover now over the output you should the label.
Capture

Just to add some background here, in our flow json format, wires do not exist as objects in their own right. Each node has a list of the node ids its outputs are wired to.

This means there are no objects to attach any wire-specific properties to. This limits what types of customisations are possible when it comes to individual wires - such as adding a label.

1 Like

First of all thanks for all the suggestions.

@Steve-Mcl I thought of using comment nodes. One of the main problem I see is that they don't stick to the wires. Also, I can't hide them and make them visible on mouse-over for example.

@chrisofCCL Not sure if I understand the idea. We try to avoid subflows, because they lack certain features. I could add a function node and just pass the message through (and use the name of the node as description). But this might affect the performance (haven't studied the Node-RED code .. it's probably optimized, so if a function node does basically nothing, no messages will be copied during runtime) and it makes the flow look more messy (similar to the solution with comment nodes).

@edje11 that might work, if the label would accept markdown or basic HTML and would allow longer texts.

And finally last but not least, @knolleary, I see. But, if I select a wire, the editor knows which wire was selected and is aware of the node ids, right? And therefore I think it would be possible to implement labels and match them through a pair of ids (just a thought).

Sorry for being such a difficult "customer"

Very little impact - nothing to worry about. The msg is sent as reference without copying so long as you dont branch off. However, there is a slight overhead in generating a nodejs VM so a change node with 0 changes would probably be better.

Hi, I just mean this (see below). It's a subflow that just doesn't do anything but pass the msg object straight through. Like like using an empty function node but without looking like one.

[{"id":"8470f28c.77f2f","type":"subflow","name":"Inline comment","info":"","category":"","in":[{"x":50,"y":30,"wires":}],"out":[{"x":160,"y":30,"wires":[{"id":"8470f28c.77f2f","port":0}]}],"env":,"meta":{},"color":"#FFFFFF","icon":"node-red/comment.svg"},{"id":"f8e1bf05.96e058","type":"subflow:8470f28c.77f2f","z":"8206c7fe.4bca","name":"","x":589.9999999999999,"y":1408.333333333333,"wires":[]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.