Include child nodes in menu tree (Noded/frontend#17)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-10-13 09:58:36 -05:00
parent 604753b3ff
commit 2a5e3419e8
2 changed files with 54 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ class Menu extends Controller {
children: nodes,
noDelete: true,
virtual: true,
type: 'branch',
})
// Get view only shared trees
@@ -36,6 +37,7 @@ class Menu extends Controller {
name: tree.Name,
children: await this._build_secure_menu_object(tree, req.user),
level: await tree.access_level_for(req.user),
type: 'page',
})
}
@@ -49,6 +51,7 @@ class Menu extends Controller {
name: tree.Name,
children: await this._build_secure_menu_object(tree, req.user),
level: await tree.access_level_for(req.user),
type: 'page',
})
}
@@ -62,6 +65,7 @@ class Menu extends Controller {
name: tree.Name,
children: await this._build_secure_menu_object(tree, req.user),
level: await tree.access_level_for(req.user),
type: 'page',
})
}
@@ -71,6 +75,7 @@ class Menu extends Controller {
children: [...view_only_nodes, ...update_nodes, ...manage_nodes],
noDelete: true,
virtual: true,
type: 'branch',
})
return res.api(menu)
@@ -84,7 +89,8 @@ class Menu extends Controller {
id: child.UUID,
name: child.is_shared() ? child.Name + ' ⁽ˢʰᵃʳᵉᵈ⁾' : child.Name,
shared: child.is_shared(),
children: await this._build_menu_object(child),
children: [...(await child.get_menu_items()), ...(await this._build_menu_object(child))],
type: 'page',
})
}
}
@@ -102,6 +108,7 @@ class Menu extends Controller {
name: child.Name,
children: await this._build_secure_menu_object(child, user),
level: await child.access_level_for(user),
type: 'page',
})
}
}