feat(databases): tree nav, database overview, and shared table actions#1471
Open
dawsontoth wants to merge 2 commits into
Open
feat(databases): tree nav, database overview, and shared table actions#1471dawsontoth wants to merge 2 commits into
dawsontoth wants to merge 2 commits into
Conversation
Rebuild the Databases left nav on the applications tab's react-complex-tree: databases as top-level items with their tables nested, a "+ Create a Table" row, and built-in type-to-filter. Single-click selects (database -> new overview page, table -> data grid); double-click / chevron expands. - Add a database overview page: DB size, audit size, table count, and a per-table breakdown (size, columns, primary key, last updated) with record counts backfilled lazily. Landing on the tab now shows the first DB's overview. - Right-click menus for databases (Create a Table, Drop Database) and tables (Add Record(s), Import Data, Export CSV, Drop Table). The table actions live in one TableContextMenuItems component shared by the tree and the overview's table list, so the two menus can't drift. - Lift the action modals into a single always-mounted DatabaseActionModals hub driven by target-carrying watched values, so an action can target any db/table -- not just the open one. Extract the CSV download into useExportTableCsv. - Fix a Radix quirk where an already-open context menu didn't re-anchor on a second right-click: remount the content keyed by cursor position. Also applied to the applications file tree, which had the same bug. - Fix a latent crash in useInstanceSchemaTablePermission (missing optional chain) that the new right-click menus would trigger for restricted users. - Remove the redundant sidebar "Import Data" button (already in the header). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the database management UI by replacing the select-based sidebar with a tree-based navigation sidebar, introducing a database overview component, and consolidating action modals into a single, always-mounted component. It also extracts CSV export logic into a reusable hook and adds context menus for right-click actions. The review feedback suggests adding unique key props to the consolidated modals to ensure proper state resets when switching targets, and wrapping the CSV blob URL revocation in a setTimeout to prevent download failures in certain browsers.
…evoke Address PR review: - Give the consolidated action modals a per-target `key` so their internal state resets on switch, and drop CreateNewTableModal's manual reset effect (the remount now seeds the prefilled database). - Defer URL.revokeObjectURL in useExportTableCsv so it can't cancel the download before Firefox / iOS Safari start fetching the blob. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Rebuilds the Databases left nav on the same
react-complex-treetech the Applications tab uses, and adds a database overview page. The old dropdown + flat table list only showed one database at a time, had no filter, and kept per-item actions in the right-pane toolbar only.Now:
Highlights
describe_allmap already loaded; counts come from a separate counteddescribe_all. Opening the tab now lands on the first database's overview.TableContextMenuItemscomponent shared by the tree and the overview's table list, so right-clicking a row in either place opens the same menu and they can't drift.DatabaseActionModalsdriven by target-carrying watched values, so an action can target any db/table (even one that isn't open, or an empty database), not just the currently-open one. CSV download extracted intouseExportTableCsv(toolbar keeps its filter-aware export; the tree/overview export the whole table).Fixes folded in
useInstanceSchemaTablePermission(a missing optional chain) that the new right-click menus would trigger for restricted (non-structure_user) users.No new backend operations
Everything reuses existing operations/modals (
create_table,drop_table,drop_database,insert, imports, CSV export). Rename was explicitly out of scope.Verification
+, orange containers, neutral high-contrast leaves).tsc -b, oxlint, and dprint pass.vitestgreen (28 tests, incl. new coverage for the tree-item builder).🤖 Generated with Claude Code