feat(tree): Expand all / Collapse all for the space page tree
Adds a server-authoritative whole-tree endpoint and sidebar menu commands so a deep space tree can be expanded in one request instead of a per-level BFS storm. Server: - POST /pages/tree (SidebarPageTreeDto: spaceId | pageId), same CASL space scoping as /sidebar-pages. Returns the whole space tree / subtree as a flat list in the sidebar item shape (id, slugId, title, icon, position, parentPageId, spaceId, hasChildren, canEdit), ordered by position (collate C byte order), content never fetched. - page.service.getSidebarPagesTree reproduces getSidebarPages' two-branch permission model: open space -> spaceCanEdit; restricted space -> seed the full descendant set then prune via filterAccessibleTreePages + filterAccessiblePageIdsWithPermissions (keeps restricted-but-granted pages, prunes inaccessible subtrees). hasChildren is derived from the final filtered set so it can never reveal inaccessible children. - page.repo.getSpaceDescendants: recursive CTE seeded by space roots. Client: - SpaceTree is forwardRef exposing expandAll/collapseAll/isExpanding; expandAll fetches the whole tree once, replaces current-space nodes, opens every branch (current space only), aborts on space switch, surfaces real errors; collapseAll collapses only current-space ids (shared open-map). - SpaceMenu gains Expand all / Collapse all items (no admin gate). Implements docs/backlog/tree-expand-collapse-all.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -977,6 +977,9 @@
|
||||
"Page menu": "Page menu",
|
||||
"Expand": "Expand",
|
||||
"Collapse": "Collapse",
|
||||
"Expand all": "Expand all",
|
||||
"Collapse all": "Collapse all",
|
||||
"Couldn't expand the tree: {{reason}}": "Couldn't expand the tree: {{reason}}",
|
||||
"Comment menu": "Comment menu",
|
||||
"Group menu": "Group menu",
|
||||
"Show hidden breadcrumbs": "Show hidden breadcrumbs",
|
||||
|
||||
Reference in New Issue
Block a user