Compare commits

..

2 commits

Author SHA1 Message Date
j
486baac69c sort children 2018-08-10 12:18:59 +01:00
j
2480ea6b05 symlink subfolder 2018-08-10 12:18:59 +01:00
2 changed files with 12 additions and 1 deletions

View file

@ -12,6 +12,15 @@ os.chdir(base)
for root, folders, files in os.walk(join(base, 'static')): for root, folders, files in os.walk(join(base, 'static')):
for f in files: for f in files:
src = join(root, f) src = join(root, f)
if 'ontology/' in src:
continue
target = src.replace(base, '/srv/pandora')
rel_src = os.path.relpath(src, dirname(target))
if os.path.exists(target):
os.unlink(target)
os.symlink(rel_src, target)
src = join(base, 'static', 'ontology')
target = src.replace(base, '/srv/pandora') target = src.replace(base, '/srv/pandora')
rel_src = os.path.relpath(src, dirname(target)) rel_src = os.path.relpath(src, dirname(target))
if os.path.exists(target): if os.path.exists(target):

View file

@ -22,10 +22,12 @@ def find_path(parent, root=None, path=None):
return r return r
def get_node(name, children, parent=None): def get_node(name, children, parent=None):
children_ = [get_node(child, children[child], name) for child in children]
children_.sort(key=lambda c: c['name'])
node = { node = {
"size": len(children) + 100, "size": len(children) + 100,
"name": name, "name": name,
"children": [get_node(child, children[child], name) for child in children] "children": children_
} }
if not node['children']: if not node['children']:
del node['children'] del node['children']