While you export-import node-red-dashboard elements to new flow, its automatically merging with original (elements in groups, groups in tabs). Because of same uids, i think.
Here is python script for assign new uids for groups, tabs and rewrite 'group' parameter of ui-elements that you want to import:
import json, random
replace_dict = {}
def generate_uid():
prefix = random.randint(0, 0xFFFFFFFF)
postfix = random.randint(0, 0xFFFFFF)
return '{0:x}.{1:x}'.format(prefix, postfix)
filename_in = "exported.json"
filename_out = "for_import.json"
with open(filename_in, "r") as read_file:
data = json.load(read_file)
for item in data:
if item['type'].startswith('ui_tab'):
print(item['id'], item['name'], sep=' : ')
new_uid = generate_uid()
replace_dict[ item['id'] ] = new_uid
item['id'] = new_uid
for item in data:
if item['type'].startswith('ui_group'):
print(item['id'], item['name'], item['tab'], sep=' : ')
new_uid = generate_uid()
replace_dict[ item['id'] ] = new_uid
item['tab'] = replace_dict[ item['tab'] ]
item['id'] = new_uid
for item in data:
if item['type'].startswith('ui_group') or item['type'].startswith('ui_tab'):
continue
if item['type'].startswith('ui_'):
item['group'] = replace_dict[ item['group'] ]
with open(filename_out, "w") as write_file:
write_file.write(json.dumps(data,ensure_ascii=False))