Commit 7deb5b1
authored
refactor: rewrite query results system with clean architecture (#512)
* refactor: Phase 0+1 — ResultSet model + DataGridView split
Phase 0: Add ResultSet @observable class and extend QueryTab with
resultSets array, activeResultSetId, isResultsCollapsed.
Phase 1: Extract TableViewCoordinator from DataGridView.swift into
DataGridCoordinator.swift. DataGridView.swift now contains only the
NSViewRepresentable shell + helper types. Zero behavior change.
* feat: add keyboard shortcuts for results panel toggle and tab navigation
- Cmd+Opt+R: Toggle Results panel collapse/expand
- Cmd+[: Previous Result tab
- Cmd+]: Next Result tab
- View menu items + command actions wired
- Keyboard shortcuts docs updated
* feat: add ResultsPanelView, ResultTabBar, InlineErrorBanner, ResultSuccessView
- ResultsPanelView: orchestrates result tab bar, error banner, content area
- ResultTabBar: horizontal scrollable tabs with pin/close/close-others
- InlineErrorBanner: red dismissable error banner with optional AI fix button
- ResultSuccessView: compact DDL/DML success (replaces full-screen QuerySuccessView)
* feat: collapsible results panel with auto-expand on query execution
- Wrap resultsSection in conditional on isResultsCollapsed in queryTabContent
- Smooth animation (200ms easeInOut) when toggling collapse
- Auto-expand results when new query results arrive (single + multi-statement)
- Table tabs and structure tabs unaffected
* feat: multi-statement execution produces ResultSet per statement
- executeMultipleStatements builds a ResultSet for each statement with
deep-copied rows, column types, execution time, and table name
- applyPhase1Result creates a ResultSet sharing the same RowBuffer
- Pinned results preserved on re-execution, unpinned replaced
- Auto-expand collapsed results panel on new data
* fix: remove ResultTabBar preview with wrong init params
* feat: wire ResultTabBar + InlineErrorBanner + ResultSuccessView into resultsSection
Replace old QuerySuccessView with ResultSuccessView, add result tab bar
for multi-result display, add inline error banner. Uses real DataGridView
(not placeholder). Structure and Explain paths unchanged.
* feat: add Cmd+Shift+W to close result tab, fix stale data on close, guard pinned tabs
* feat: add toolbar button for toggling results panel
* fix: group Results + Inspector into ToolbarItemGroup to fix ViewBuilder 10-item limit
* fix: remove VSplitView animation on results collapse to prevent DataGridView layout gap
* feat: hide Results toolbar button on table tabs instead of disabling
* fix: add idealHeight to results section so VSplitView restores proper height after collapse
* refactor: replace VSplitView with NSSplitViewController for query tab split
* fix: set sizingOptions = [] on NSHostingControllers so panes fill split view
* fix: add frame fill modifiers so SwiftUI content expands in NSSplitView panes
* fix: enable translatesAutoresizingMaskIntoConstraints for NSSplitView frame-based layout
* fix: wrap NSHostingController in container VC with Auto Layout edge constraints
* fix: use NSHostingView as pane view so NSSplitView frame drives SwiftUI layout
* fix: embed NSHostingView in container with low compression resistance for split resize
* fix: use NSHostingView.sizingOptions = [.minSize] to drop intrinsicContentSize constraint
* refactor: use NSSplitView directly via NSViewRepresentable instead of NSSplitViewController
* fix: restore ResultTabBar + InlineErrorBanner in resultsSection, hide divider when collapsed
* fix: move divider to bottom edge before hiding pane and force display to clear divider line
* fix: read DataGridView data from active ResultSet and invalidate cache on tab switch
* fix: don't show ResultSuccessView after all result tabs are closed
* fix: clear rowBuffer and bump resultVersion when all result tabs closed
* fix: show empty state instead of stale DataGridView when all result tabs closed
* feat: auto-collapse results panel when all result tabs are closed
* fix: address all review issues for query results rewrite
1. Delete dead code ResultsPanelView.swift (never integrated)
2. Fix sortIndicesForTab to use active ResultSet data instead of tab-level
3. Change Cmd+[/] to Cmd+Opt+[/] to avoid system navigation conflict
4. Fix ResultSuccessView localization (use String(format:localized:))
5. Extract closeResultSet(id:) to coordinator, remove 3x duplication
6. Toolbar toggle button icon reflects collapsed/expanded state
* fix: architecture + UIUX review fixes
1. Pin toggle routes through coordinator + bumps resultVersion for
SwiftUI reactivity (was mutating class directly, bypassing Equatable)
2. Remove dead onAIFix API from InlineErrorBanner
3. Use NSColor.selectedControlColor for active tab (was wrong
.selectedContentBackgroundColor.opacity(0.3), broken in dark mode)
4. ResultTabBar height 28→32pt (HIG minimum), replace deprecated
.cornerRadius with RoundedRectangle, localize context menu strings
5. Consolidate dual ResultSuccessView paths into single branch
* docs: update keyboard shortcuts, sql-editor, and CHANGELOG for query results rewrite
- Fix Previous/Next Result shortcuts: Cmd+[ → Cmd+Opt+[ (matches code)
- Add sql-editor.mdx sections: collapsible panel, multi-result tabs,
pinning, inline errors, non-SELECT success view
- Expand CHANGELOG [Unreleased] with all PR #512 features
* docs: simplify CHANGELOG entries1 parent 7952527 commit 7deb5b1
23 files changed
Lines changed: 1240 additions & 427 deletions
File tree
- TablePro
- Models
- Connection
- Query
- UI
- Resources
- Views
- Editor
- Main
- Child
- Extensions
- Results
- Toolbar
- docs/features
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
372 | 382 | | |
373 | 383 | | |
374 | 384 | | |
| |||
542 | 552 | | |
543 | 553 | | |
544 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
545 | 558 | | |
546 | 559 | | |
547 | 560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| |||
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
97 | | - | |
| 101 | + | |
| 102 | + | |
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
| |||
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| |||
440 | 449 | | |
441 | 450 | | |
442 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
443 | 456 | | |
444 | 457 | | |
445 | 458 | | |
| |||
0 commit comments