How can I make mass changes to the UI Dashboard node groups?
If I have 20 Text UI nodes, and I want to change them all to a different dashboard tab and group, is there a way to do that with a msg.property?
Here's my scenario:
I want to copy one completed flow tab to another tab on the same NodeRed machine, but want the newly pasted tab UI nodes to all change to a new group.
I want to repeat this a dozen times or so, so I effectively end up with a dashboard that looks the same on every tab, though every tab is showing a different set of inbound data, derived from the flows. .
I'm using flow and global variables extensively to change each's newly created flows data sources. I can't find a documented way to do something similar with UI nodes.
How would that be possible ? Let´s say you replicated the same flow 3 times and changed the ui nodes to a new group/tab. The remaining nodes were not touched, so the ui nodes will always receive the very same data and will always display the same information. What am I missing ?
One way you could explore is using the HTTP API to copy and deploy the nodes. In between you need to find a way to modify the group and tab name (as well as the flow id).
Not that I'm aware of, but you could try putting the export in a text document and doing a global find/replace in a text editor
Export the flow tab to a text document, then write a flow to read the file and pass it to a change node. In the change node do a replace to change the original group to the new group you want. Then write the file ack out so you can import it.
I just tried that, and it looks like the tab name is encoded as a unique ID and not clear. The group names are all obvious, but those can all stay the same.
I think I'm going to make a new NodeRed VM or old RPi, and will import the flows to it, then edit the tab name there, and see if it imports back to the main system OK. I'll try it a few times on the test box before potentially messing up the active machine, though.
I checked out the bash script, and it looks great. It doesn't quite apply to what I'm doing, but it got me going.
Here's what I did instead:
exported the flow I want to copy (call it Source) to Notepad++.
created a new empty flow, and added two UI text nodes.
manually created the new ui_tab and ui_group that I wanted.
exported the new flow with just the two UI nodes
pulled the new flow's flow/tab/group ID numbers
ran a text find/replace with the new ID's
reimported the flow, select "copy" when prompted to copy existing nodes
I went this route because I just want to do this a few times, and have so many UI nodes, that the high number of variables needed might be a bit much. In hindsight, I realize I didn't need the text UI nodes and could have created the tab and group in the sidebar, but had forgotten about that when I did this.
If I were going the same way, automating a new dashboard creation, I'd probably figure out a way to integrate a For-loop to generate a new ID, then apply it to the node in question. That would take (me) a good chunk of time to figure out, so I just took the faster route for my skill level.
But the script helped me figure out what needed to change, and it also offered a pretty slick way to generate ID's.