I'm trying to resolve how to handle subflows with FlexDash... I would appreciate a bit of conceptual input...
So as far as I can tell, in the flow editor:
- nodes in subflows are represented only once, i.e., in the subflow
- they don't have any configuration per instance of the subflow
- configuration nodes only exist outside of subflows
- not sure how one can tell that a node is in a subflow, prob looking at the type of the flow following
In the runtime:
- new nodes get instantiated for nodes in subflows, i.e., each instance of a subflow results in a clone of its nodes with freshly generated random IDs, these IDs change on every deploy
- the new nodes have a
_aliasfield which points back to the "template" node in the subflow definition
With nodes in a dashboard I see two issues: containment and position
- in the current dashboard each UI node is contained in a UI group, which is a config node, this means that all instances of a subflow end up in the same UI group, there isn't any way to have one subflow in one UI group and the next subflow in another
- nodes in a UI group need some form of position, but it's not obvious where to store that
In general, I'm wondering how dashboard nodes in a subflow should behave and I fear that there probably are a number of very different use-cases:
- subflow flattened: UI nodes in subflows should just be like regular UI nodes, just that there are multiple clones that each should be placed anywhere in the dashboard
- subflow array: UI nodes in subflows should be repeated in the same dashboard container, e.g., if a subflow has a chart and the subflow gets instantiated 4 times then the chart gets repeated 4 times one after the other in the same group
- subflow group: UI nodes in subflows should be in their own group and the group gets repeated, once for each instance, in the same tab (alternatively, each instance could pick where to be placed)
I'm reading between the lines that some thought has gone into some of these questions WRT the current dashboard?
NB: some of these issues are also found with non-UI nodes. For example, IIUC an MQTT-out node placed into a subflow is associated with a config node for the broker settings, which means that all instances of that subflow are tied to these same broker settings. There's no way to tie each subflow instance to a different broker.