[FR] Ghost nodes

In larger projects the need of copy & paste the same functionality (nodes) over and over again is a real pita.

To end this, one possibility would be “ghosts” or “clones”.
A ghost is an instance of the original and has all it’s settings.
It looks like the original, but something has to be different like opacity or the shape line or whatever

Basic needed functions:

  • copy node & paste a clone
  • edit will change the original - the user must be aware of that - indicated by some kind of info (color, text, …)
  • materialize: the ghost gets his own life

Ok, i guess everybody knows the concept - it exists on different levels…it’s just missing in node-red

This is pretty much what subflows are for - easy reuse of one or more nodes at multiple points in your flow. Able to edit the subflow template to edit all instances of the subflow.

We have plans to allow individual instances of a subflow to have some level of customisation. We hadn’t considered being able to ‘split’ a particular subflow instance into a separate subflow that can then be completely independently edited, but that’s a though worth considering.

Do you think that meets your needs? Can you point to some real examples of this sort of functionality in other applications?

I think subflows are not the same - the biggest disadvantage is, that they dont work right with ui nodes. It’s also not possible to “make unique” a subflow with one click (creating a new editable version). Or to un-subflow a subflow (replace the subflow with it’s contents).

And most users will not use a subflow, if its only one node - it looks easier to just c&p.

The clones would (should?) work for every node. And an ui element clone should be able to be on different tabs / groups than it’s original (this is the problem with subflows now). It’s intuitive and their usage will also affect memory and performance positively.

I dont know what kind of examples you like: Links in a filesystem, objects with mostly shared variables, 3ds max, inkscape clones?

PS: A little issue in my version 0.18.3 with chrome: after returning from a subflow, the editor goes to the latest tab, instead to the previous tab and position.

Is this more about the dashboard then ?

The dashboard is a separate project and does have known shortcoming as regards subflows - as the right hand menu to aid layout doesn’t know how to handle them so they can’t be assigned individual properties like tabs… indeed they are not a concept in the dashboard as-is.

No, but the dashboard is part of the inconsistency. We already discussed my request to be able to reference a group multiple times - eg: why one has to have 5 copies of a group which only shows the basic client data?

You often position node-red as a tool for beginners - but c&p causes imho a lot of problems, is bad style and should not be taught. So why not use “graphical references”? Now, the user learns about references, cause his msgs get messed up :slight_smile:

The problem with subflows is also, that they all look the same. This is a conflict to the visual programming of node-red. If one really uses subflows also for single nodes (eg function nodes which extended implementations of standard nodes like join, switch, etc) it soon looks horrible and the intuitive understanding of the flow is gone.

One solution would be, to let the user choose the icon and color of a subflow (and maybe also show the number of the included nodes).

Or implement ghosts, who would solve this in a nicer way, close the gap to subflows (with multiple nodes) and teach the beginners pointers and references.

Let’s be clear, I’m not saying ‘no’ to this idea. But it is also the first time in five years it has been proposed - so nor am I’m jumping to implement it at the first suggestion. Before we consider introducing another concept for beginners to learn, we should explore if there’s a way to address the user requirements with the tools we have as the starting point.

I acknowledge subflows don’t do everything you describe - I did as much in my original reply.

You can already customise the icon of subflows (as of 0.18). In 0.19 you’ll be able to choose what category in the palette they appear in. We haven’t considered customising the colour - but once it can be made to look like any other node, we may need to consider some other visual cue that its a subflow node.

Also the nodegen sub-project is evolving - https://github.com/node-red/node-red-nodegen.
Currently this is looking at creating nodes from swagger definitions, and function nodes - and once created they can be customised for colour and icon etc - and then reused. Currently it is standalone - but at some point it may get integrated. Likewise subflows are another candidate to be added to nodegen - so users can create a deployable node form a subflow. No timescales on this as it's not core sunctionality - but also may need to be considered as part of this mix

1 Like