node-red-dashboard
node-red-dashboard copied to clipboard
Spacers are not Exported / Imported
I am using the Export Flow and Import Flow to attempt to copy the entire flow definition, including tabs, groups and their associated spacers.
But each time I do this, none of the spacers defined in the source get imported to the target.
What am I doing wrong ?
you have to export/import the whole flow. As they are "hidden" nodes that don't get wired to anything and don't exist in the flow per se they are not associated with any particular workspace tab you have to take the whole flow in order to get them.
PS - we prefer general how to type questions via the discourse forum where a wider community are usually online to help, leaving the issue list and the template for actual code bugs. thanks
Thanks, but I am exporting the 'whole flow" "Select Flow Tab" (Dont select any nodes) > "Current Flow" > "Export" > "Copy to Clipboard" > "Import" > "Paste From Clipboard" and in every case that I do this, none of the spacers which are used in the Groups get imported.
I just did this again, in my target I deleted all flows,tabs and groups. Then I selected the flow in my source, and exported it, then in my target I pasted from clipboard. All of the nodes were added, but none of the spacers were.
I just created a news Flow "TEST" then I created a new Tab "TEST" and added a new group "TEST".
I then added a single Gauge to, the flow and associated it with TEST > TEST Group.
Then I added a 15x1 spacer above and below the gauge and exported the flow:
[
{
"id": "9bf2b591.4f7008",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "17cb92a6.a399cd",
"type": "ui_gauge",
"z": "9bf2b591.4f7008",
"name": "",
"group": "f9e838f5.7f63f8",
"order": 2,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "gauge",
"label": "units",
"format": "{{value}}",
"min": 0,
"max": 10,
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 240,
"y": 100,
"wires": []
},
{
"id": "f9e838f5.7f63f8",
"type": "ui_group",
"z": "",
"name": "TEST",
"tab": "1e5332d8.d60afd",
"order": 1,
"disp": false,
"width": "15",
"collapse": false
},
{
"id": "1e5332d8.d60afd",
"type": "ui_tab",
"z": "",
"name": "TEST",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
As you can see there are no spacers in the export.
sorry - I meant All flows (not Current flow)
current flow only selects the nodes on that tab - and not any hidden nodes as described above)

I cannot export all flows as there are other un-related flows on the source that can't be copied to the target as the other flows on the source are completely un-related and not needed on the target, plus the target is a different platform and does not have the necessary node_modules installed.
I only want to export a single flow, including all of it's tabs, groups and spacers so that I can deploy a single flow to multiple sites
The problem we need to solve is to figure out how the editor knows to include the spacer nodes when they don't 'belong' to the flow (tab) being exported, or are in the direct node dependency chain.
When you export a flow containing dashboard nodes, those nodes belong to the flow, so the editor includes them. In turn, they depend on their ui_group
config nodes so they get pulled into the export even they don't belong directly to the flow. Likewise the ui_tab
node is pulled in by the ui_group
node.
The dependencies all point "up" the chain
tab --> ui_widget --> ui_group --> ui_tab
But when the spacer nodes are involved, the tree looks like:
tab --> ui_widget --> ui_group --> ui_tab
/
ui_spacer -/
The export logic never goes down the tree - only up.
The same problem would exist if the ui_widget
nodes for a particular group were spread over multiple flows/tabs:
tab1 --> ui_widget1 -\
--> ui_group --> ui_tab
tab2 --> ui_widget2 -/ /
/
ui_spacer -/
In this case, if a user exported tab1
, they would get ui_widget1
, ui_group
and ui_tab
, but ui_widget2
and ui_spacer
would be left behind.
(Although in that case, we'd also be leaving behind any flow logic attached to ui_widget2
, so the export would be of limited use...)
We need some mechanism for a node to be able to say "when I'm exported, make sure you include these other nodes" - and to do so in a way that isn't hardcoding Node-RED Dashboard awareness into the editor as this is a problem that other nodes could encounter.