fix: looks like an old indentation issue just showed up

parent 83f9ecec
Pipeline #1533 passed with stage
in 2 minutes and 53 seconds
...@@ -457,66 +457,66 @@ class ClientTreeAll(Resource): ...@@ -457,66 +457,66 @@ class ClientTreeAll(Resource):
@staticmethod @staticmethod
def _get_tree_all(name, backup, server): def _get_tree_all(name, backup, server):
json = bui.client.get_tree(name, backup, '*', agent=server) json = bui.client.get_tree(name, backup, '*', agent=server)
tree = {} tree = {}
rjson = [] rjson = []
roots = [] roots = []
def __expand_json(js): def __expand_json(js):
res = {} res = {}
for entry in js: for entry in js:
# /!\ after marshalling, 'fullname' will be 'key' # /!\ after marshalling, 'fullname' will be 'key'
res[entry['fullname']] = marshal(entry, node_fields) res[entry['fullname']] = marshal(entry, node_fields)
return res return res
tree = __expand_json(json) tree = __expand_json(json)
# TODO: we can probably improve this at some point # TODO: we can probably improve this at some point
redo = True redo = True
while redo: while redo:
redo = False redo = False
for key, entry in tree.items(): for key, entry in tree.items():
parent = entry['parent'] parent = entry['parent']
if not entry['children']: if not entry['children']:
entry['children'] = None entry['children'] = None
if parent: if parent:
if parent not in tree: if parent not in tree:
parent2 = parent parent2 = parent
last = False last = False
while parent not in tree and not last: while parent not in tree and not last:
if not parent2: if not parent2:
last = True last = True
json = bui.client.get_tree( json = bui.client.get_tree(
name, name,
backup, backup,
parent2, parent2,
agent=server agent=server
) )
if parent2 == '/': if parent2 == '/':
parent2 = '' parent2 = ''
else: else:
parent2 = os.path.dirname(parent2) parent2 = os.path.dirname(parent2)
tree2 = __expand_json(json) tree2 = __expand_json(json)
tree.update(tree2) tree.update(tree2)
roots = [] roots = []
redo = True redo = True
break break
node = tree[parent] node = tree[parent]
if not node['children']: if not node['children']:
node['children'] = [] node['children'] = []
elif entry in node['children']: elif entry in node['children']:
continue continue
node['children'].append(entry) node['children'].append(entry)
if node['folder']: if node['folder']:
node['lazy'] = False node['lazy'] = False
node['expanded'] = False node['expanded'] = False
else: else:
roots.append(entry['key']) roots.append(entry['key'])
for fullname in roots: for fullname in roots:
rjson.append(tree[fullname]) rjson.append(tree[fullname])
return rjson return rjson
@ns.route('/report/<name>', @ns.route('/report/<name>',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment