Repository navigation
Add a Collapse option to the Object Explorer that closes a node and everything beneath it. #7208 - #10844
Conversation
…verything beneath it. pgadmin-org#7208 The context menu of every node and collection gains a 'Collapse' item, and the tree gains Shift + Left Arrow for the same thing. On an expanded node it closes that node and every expanded node beneath it, so that expanding it again shows only the next level. On a node that is not expanded, such as a table in a long Tables list, it closes the parent instead and selects it, so the user does not have to scroll back up. Each node is closed through FileTreeX.closeDir, so the 'closed' tree event, and with it the saved tree state, is updated for all of them. Closes pgadmin-org#7208
|
No actionable comments were generated in the recent review. WalkthroughThe tree now supports collapsing a directory and its expanded descendants. Shift+ArrowLeft and the context-menu Collapse action use this behavior. When the selected node is not expanded, the action targets its parent. ChangesTree Collapse
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant User
participant KeyboardHotkeys
participant collapseTarget
participant FileTreeX
participant collapseBranch
User->>KeyboardHotkeys: Press Shift+ArrowLeft
KeyboardHotkeys->>collapseTarget: Resolve target from active file
collapseTarget-->>KeyboardHotkeys: Return target or null
KeyboardHotkeys->>FileTreeX: Call collapseAll(target)
FileTreeX->>collapseBranch: Close expanded descendants
collapseBranch-->>FileTreeX: Complete recursive closure
FileTreeX-->>KeyboardHotkeys: Complete collapse
KeyboardHotkeys->>KeyboardHotkeys: Activate target when it differs
Merge Risk:
|
Summary
FileTreeX.closeDir, so theclosedtree event, and with it the saved tree state, fires for each one. The logic lives inPgTree/services/collapse.tsand is shared by the menu callback (Tree#collapse) and the keyboard handler.docs/en_US/tree_control.rstdocuments the menu item and the shortcut.Test plan
regression/javascript/tree/tree_collapse_spec.js(realTreeModelX): target selection, deepest-first closing including expanded nodes hidden under a closed one,Tree#collapse, and Shift + Left Arrow, with plain Left Arrow and other Shift keys unchanged.Closes #7208
Summary by CodeRabbit