Skip to content

Format the SQL in the query details sidebar - #6

Merged
tmphost-dev merged 1 commit into
mainfrom
feat/format-query-detail
Oct 23, 2026
Merged

tmphost-dev merged 1 commit into
mainfrom
feat/format-query-detail

Conversation

@tmphost-dev

Copy link
Copy Markdown
Contributor

Opening a query in the Activity tab now shows its SQL formatted for reading.

  • formatSql (frontend/src/composables/useSqlFormat.js) uses sql-formatter with the PostgreSQL dialect. Only whitespace changes; keyword case is left as written. SQL it can't parse (often a rejected query) is shown as logged.
  • A Raw / Formatted toggle in the sidebar switches back to the exact logged text. Copy copies what's on screen.
  • The formatter is in its own module, so it's bundled with the lazy-loaded database page: the main index chunk is unchanged (54.85 kB), and DatabaseDetailView goes from 32 kB to 102 kB (10 kB to 30 kB gzipped).

Tests: unit tests for formatSql (formatted, unparseable and empty input), and the ActivityPanel test now covers formatted display, the toggle, and copy in both modes. vitest and ESLint pass.

🤖 Generated with Claude Code

The sidebar now lays the query out one clause per line with sql-formatter
(PostgreSQL dialect). Only whitespace changes; SQL the formatter can't
parse is shown as logged. A Raw toggle shows the exact logged text, and
Copy copies what is on screen. The formatter lives in its own module so it
ships with the lazy database page, not the main bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmphost-dev
tmphost-dev merged commit f869bd1 into main Oct 23, 2026
5 checks passed
@tmphost-dev
tmphost-dev deleted the feat/format-query-detail branch October 23, 2026 04:52
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.

2 participants