Skip to content

fix: connection auto-reconnect, executable top-N SQL, and context-menu UX fixes - #130

Merged
Blankll merged 9 commits into
masterfrom
fix/auto-reconnect-and-ui-fixes
Aug 6, 2026
Merged

fix: connection auto-reconnect, executable top-N SQL, and context-menu UX fixes#130
Blankll merged 9 commits into
masterfrom
fix/auto-reconnect-and-ui-fixes

Conversation

@Blankll

@Blankll Blankll commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Fixes 6 issues reported against the treeview / connection management / data view UX.

Backend — connection auto-reconnect (the big one)

When a connection session was lost (server restart, dropped connection) or idle-evicted, any user action failed with a hard No active connection found for server 'xxx' error because nothing ever recreated the connection handle. The agent/capabilities path already auto-reconnected; the main commands did not.

  • AppState now stores the ServerConfig per active connection and exposes ensure_connection(), which transparently recreates the adapter (with SSH-tunnel resolution + connect timeout) when the handle is missing and notifies the guardian so the frontend flips back to CONNECTED.
  • connect_server stores the config; disconnect_server removes it; the capabilities auto-connect path stores it too.
  • Migrated 35 call sites to ensure_connection: browse.rs (20), query.rs (5), transfer.rs (9), mcp_bridge.rs, capabilities/commands.rs, cache.rs::get_or_create, and the guardian's try_reconnect (which now recreates the adapter from config instead of pinging the stale one).
  • If the server is genuinely down, the user now gets a clear Reconnect timed out after N seconds instead of the opaque error.

Frontend

  • Executable top-N SQL: "Query Top 100" emitted SELECT * FROM "table" LIMIT 100 — double quotes are string literals in MySQL's default mode, so it was never executable. Now quotes identifiers per dialect (backticks for MySQL-family, [brackets] + TOP n for SQL Server, FETCH FIRST for Oracle) with delimiter escaping.
  • Database context menu: right-clicking a database in the all-databases tree view now shows New Query / Show ER Diagram / Refresh (was only available for tables).
  • Menu dismissal: tree context menus now close on any outside click or right-click via a click-away overlay.
  • Disconnect action: connected connection cards in the home panel now show a Disconnect item in the action list.
  • Edit dialog scrolling: min-h-0 added to the form area of both edit dialogs so wide tables scroll inside max-h-[80vh] instead of overflowing the modal.

Verification

  • cargo check + cargo clippy clean (remaining warnings pre-existing)
  • cargo test: 330 passed
  • vue-tsc --noEmit clean
  • npm test: 455 passed
  • npm run build succeeds

Blankll added 9 commits August 6, 2026 00:41
Store the ServerConfig for each active connection and add AppState::ensure_connection(),
which recreates the adapter from the stored config when a session is lost or
idle-evicted. Migrate all command lookups (browse, query, transfer, MCP bridge,
capabilities) to it so user actions no longer fail with 'No active connection
found'. The guardian's reconnect loop now recreates the adapter instead of
pinging the stale one.
The 'query top 100' action emitted SELECT * FROM "table" LIMIT 100, where
double quotes are string literals under MySQL's default mode, so the SQL was
never executable. Quote identifiers per dialect (backticks for MySQL-family,
brackets + TOP n for SQL Server, FETCH FIRST for Oracle) and escape embedded
delimiters.
Right-clicking a database node in the all-databases view now shows an action
list (New Query, Show ER Diagram, Refresh). The tree context menus also close
when clicking or right-clicking anywhere outside the menu via a click-away
overlay.
The home panel action list now shows a Disconnect item for connected
connections, closing the active session instead of requiring the connect
button toggle.
Add min-h-0 to the form area so overflow-y-auto actually constrains inside
the max-h-[80vh] flex dialog; previously many columns pushed the modal past
the viewport with no scrollbar.
When a connection is already active, the primary button now shows a
log-out icon and 'Close Connection' tooltip instead of 'Connect', which
implied reconnecting.
The card's primary button is now 'Open in Editor' (with an external-link
icon) when the connection is already active, navigating to the queries page,
and only shows 'Connect' when disconnected. Closing the connection moves
exclusively to the action-list menu, so the editor entry point is never lost.
The log-out arrow was visually too close to the 'Open in Editor' icon in the
card's primary button. Replaced with a power-off icon, the standard
disconnect affordance.
@Blankll
Blankll merged commit 0b88342 into master Aug 6, 2026
3 checks passed
@Blankll
Blankll deleted the fix/auto-reconnect-and-ui-fixes branch August 6, 2026 05:33
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