My flows are messy and even if I do my best, they still look messy, ending up with a lot of flow tabs just to bring some separation, which in turn are harder to navigate (root cause is that canvas navigation within the editor is cumbersome, nobody is using the full canvas - especially in the horizontal direction, want to be able to click and drag to navigate the canvas, but this is a different discussion).
This enchancement request is to explore if it would be possible to add collapsible groups instead. This could greatly cleanup flows and make them more contained and provide clarity in the editor.
I can imagine that a collapsible group could behave exactly like a subflow, with in/outputs minus the instantiation (but perhaps keep environment variable support).
In addtion, an option that the group be set as a link-in node for the input so that can be used for link-call functionality.
It could make flows look very clean with 'pure functions' like:
Perhaps it can also be (too) obscure, but just thinking out loud.
I am not sure how it would need to handle/deal with groups within groups, but I leave that to the discussion.
One of the reasons I didn’t pursue this originally with groups was that a group can have any number of wires coming into, and out of, the group. Our node ui only allows for a single input - so we don’t have a clean way to represent a collapsed group with multiple incoming wires.
@knolleary what if the collapsed group node is rendered with only 1 input when there are n inputs, n > 0? Users would still see many wires connected to the input. The user must expand the group if he wants to see where each input wire is connected. Another option is to add n input ports and use the node's name as the label.
Output wires will become output ports with labels equal to the label of the port or the node name, when there is at least one output wire comming out of the group.
The collpased view would allow users to customize the label of each port. To do that, users open the group config editor, then go to a collapsed view tab to edit the labels of inputs and outputs.
I dont think having many flow/subflow tabs makes navigation harder. Maybe it does because node-red doesn't have navigation history? Or maybe it has, but user don't know how to use keyboard/mouse shortcuts to navigate back/forward between tabs?