Skip to content

feat(sidebar): group objects into 6 kind-based sections (#1038) - #1203

Merged
datlechin merged 5 commits into
mainfrom
feat/1038-ui-layer
May 11, 2026
Merged

datlechin merged 5 commits into
mainfrom
feat/1038-ui-layer

Conversation

@datlechin

Copy link
Copy Markdown
Member

PR B for #1038. UI layer only.

Replaces the single Tables section in the sidebar with 6 collapsible sections (Tables, Views, Materialized Views, Foreign Tables, Procedures, Functions). Sections are gated by plugin capability flags and hide when empty (Tables always renders).

Summary

  • Add SidebarObjectKind and RoutineInfo domain types.
  • Replace isTablesExpanded boolean with a per-kind ExpansionState. Old per-connection and global legacy keys seed the new .table flag on first init.
  • SidebarViewModel exposes per-kind table/routine filtering with memoization fingerprints (count/hash/query).
  • SidebarView renders the six sections from a single ForEach over SidebarObjectKind.allCases. Tables always shows, others gate on PluginCapabilities (.materializedViews, .foreignTables, .storedProcedures, .userFunctions) and on item count.
  • Search auto-expands sections with matches via effectiveExpanded(kind:hasMatches:) and hides empty sections (except Tables).
  • New RoutineRowView thinner row variant (SF Symbol + name, no row-count badge, no truncate/delete toggles). Context menu: Copy Name, Copy with Signature (if available), Show DDL.
  • Per-section header context menu: "Show All " for tables/views/matviews/foreign (only Tables wired today via existing showAllTablesMetadata); "Refresh" for all sections via coordinator.refreshTables().
  • Tests: 18 new cases covering per-kind splitter, search filtering, auto-expand, capability gating, default expansion, and legacy expansion key migration.

Dependencies

  • Depends on PR A (feat/1038-data-layer) for TableInfo.TableType.materializedView and .foreignTable cases. The bucket splitter uses raw-value matching ("MATERIALIZED VIEW" / "FOREIGN TABLE") so this branch compiles independently against the current enum, but matview / foreign-table buckets stay empty until PR A merges and the schema layer returns those rows.
  • Routines are wired empty (let routines: [RoutineInfo] = []) in SidebarView. PR A will land PluginProcedureFunctionSupport on PluginDriverAdapter; once merged this branch rebases and the coordinator wires the actual array.
  • Capabilities are read via PluginDriverAdapter.schemaPluginDriver.capabilities (already public on the adapter), so no changes to plugin protocol or PluginDriverAdapter are required from this PR.

Test plan

  • Postgres connection: 6 sections render once PR A lands; Tables expanded, others collapsed.
  • SQLite connection: Tables + Views only, others hidden (no capability).
  • Redis connection: Keys section renders, SQL-object sections hidden when empty (Tables always shows; will be empty for Redis).
  • Type "user" in search: matching sections auto-expand, sections with no matches hide.
  • Toggle a section's chevron, restart the app: state persists per connection.
  • Existing Tables legacy per-connection key (sidebar.<uuid>.tables.expanded) seeds new per-kind key without losing user preference.
  • Right-click section header shows "Show All " and "Refresh"; clicking Refresh reloads schema.
  • Routine row context menu (after PR A wiring): Copy Name, Copy with Signature, Show DDL.

Closes part of #1038 (UI half).

@datlechin
datlechin merged commit 24291a0 into main May 11, 2026
2 checks passed
@datlechin
datlechin deleted the feat/1038-ui-layer branch May 11, 2026 03:11
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