Skip to content

refactor(connection-form): native HIG rebuild + categorized chooser sheet - #995

Merged
datlechin merged 10 commits into
mainfrom
refactor/connection-form-rebuild
May 5, 2026
Merged

refactor(connection-form): native HIG rebuild + categorized chooser sheet#995
datlechin merged 10 commits into
mainfrom
refactor/connection-form-rebuild

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Full rebuild of TablePro's Connection Form using native macOS SwiftUI patterns. Replaces the ~2200-line tab-based custom form with NavigationSplitView + per-pane @Observable ViewModels + Coordinator, and introduces a categorized database type chooser sheet that opens before the form.

  • Database chooser sheet: categorized list (Relational, Document, Key-Value, Analytical, Wide-Column, Cloud Native, Coordination & Config), NSSearchField (wrapped via NSViewRepresentable), brand-colored driver icons, single-click select / double-click commit. Apple "Add Account" pattern.
  • Connection form: NavigationSplitView with sidebar (General / SSH Tunnel / SSL/TLS / Customization / Advanced), .formStyle(.grouped) Form rows. Dynamic title New <DB> Connection. Test Connection moved inline below auth section.
  • Plugin install gate: when user picks an uninstalled driver from the chooser, install prompt fires before the form opens (no more half-disabled form for missing drivers).
  • Validation simplified: dropped overly strict password / AWS-credential blocks — empty creds allowed at save time, DB driver fails with clear error at connect time.
  • Driver branding: 18 brand colors (MySQL, MariaDB, PostgreSQL, Oracle, MongoDB, Redis, ClickHouse, etc.) tinted onto template-rendered icons.
  • Metadata: DatabaseCategory enum, tagline field added to PluginMetadataSnapshot.ConnectionConfig. Alias registration (MariaDBMySQL, RedshiftPostgreSQL, ScyllaDBCassandra, TursolibSQL) preserves per-alias displayName, icon, tagline, category.
  • Bug fixes along the way: DynamoDB SVG had a hardcoded blue gradient background that broke template rendering — stripped to monochrome path. Snapshot lookups for iconName/category/tagline now use rawValue (not aliased pluginTypeId) so MariaDB shows its own icon and tagline.

Files removed (legacy)

  • ConnectionFormView.swift (root)
  • ConnectionFormView+Footer.swift
  • ConnectionFormView+GeneralTab.swift
  • ConnectionFormView+Helpers.swift
  • ConnectionFormView+ClipboardBanner.swift

Action helpers (Keychain flow, MongoDB normalize, plugin install error handling, SSH tunnel test, URL parser fan-out) ported 1:1 into ConnectionFormCoordinator.

Files added

Views/ConnectionForm/
├── ConnectionFormView.swift
├── ConnectionFormCoordinator.swift          @Observable, 6 sub-VMs, action methods
├── ConnectionFormPane.swift                 enum + sidebar metadata
├── Sidebar/ConnectionFormSidebar.swift
├── Toolbar/ConnectionFormToolbar.swift
├── Toolbar/TestConnectionStatusButton.swift
├── ViewModels/                              6 per-pane @Observable VMs
├── Panes/                                   5 pane views
├── Components/                              ClipboardBanner, URLImportSheet, PluginInstallStatusRow
└── Support/PluginFieldRendering.swift

Views/Connection/TypeChooser/
├── DatabaseTypeChooserSheet.swift
└── DatabaseTypeChooserModel.swift

Test plan

  • Welcome → New Connection → categorized chooser sheet appears
  • Search filters across name + tagline + category
  • Pick installed driver (e.g. MySQL) → form opens with type-specific defaults
  • Pick uninstalled driver (e.g. SQL Server) → install prompt → install → form opens
  • Pick uninstalled driver → cancel install → form does NOT open
  • Form sidebar shows 5 panes for full-network drivers (MySQL/Postgres) and 3 panes for SQLite (no SSH/SSL)
  • Empty Name → Save buttons disabled, sidebar General badge shows ⚠
  • Type Name + valid host → badge clears, Save enables
  • Connection name + empty password → can save (no longer blocked)
  • Test Connection button (now inline at bottom of General) works for all states (idle / testing / success)
  • Save & Connect with valid form → connects, dismisses window
  • Edit existing connection → form opens directly with type icon + name (no chooser, no Change button)
  • Cmd+Return triggers Save & Connect; Esc dismisses
  • Window resizes; minimum 720pt; only red close button visible (no minimize/zoom)
  • MariaDB shows its own seal icon and "Open-source fork of MySQL" tagline (not MySQL's)
  • DynamoDB icon renders correctly in chooser (not a solid blue square)
  • swiftlint lint --strict exits 0

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin
datlechin merged commit 9f361ef into main May 5, 2026
2 checks passed
@datlechin
datlechin deleted the refactor/connection-form-rebuild branch May 5, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant