feat(ui): Phase 5 - Complete toolbar UI with themes, positioning, and history#4
Merged
JacobCoffee merged 18 commits intomainfrom Nov 27, 2025
Merged
feat(ui): Phase 5 - Complete toolbar UI with themes, positioning, and history#4JacobCoffee merged 18 commits intomainfrom
JacobCoffee merged 18 commits intomainfrom
Conversation
- Add routes/__init__.py module for route registration
- Create handlers.py with full route implementation:
- GET /_debug_toolbar/ - Request history page
- GET /_debug_toolbar/{id} - Request detail page
- GET /_debug_toolbar/api/requests - JSON API for requests
- GET /_debug_toolbar/api/requests/{id} - JSON API for single request
- GET /_debug_toolbar/static/toolbar.css - CSS stylesheet
- GET /_debug_toolbar/static/toolbar.js - JavaScript
- Implement CSS with:
- Dark theme matching VS Code palette
- Positioning support (right/left/top/bottom)
- Panel collapsible sections
- Request history table
- Implement JavaScript with:
- DebugToolbar class for interactivity
- Position controls with localStorage persistence
- Panel data fetching via API
- togglePanel for detail page panels
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update DebugToolbarPlugin to create shared DebugToolbar instance - Add _toolbar property for accessing toolbar from tests - Register routes via create_debug_toolbar_router() - Pass shared storage to routes for request history access 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Accept optional toolbar parameter to share storage with routes - Update _render_toolbar() to use CSS classes - Add links to request history and detail pages - Fix line length lint issues in HTML template 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add test_toolbar_routes.py with tests for: - Index route (history page) - Detail route (request view) - API endpoints (JSON responses) - Static assets (CSS/JS) - Route exclusion (no injection on toolbar pages) - Full workflow integration test - Update test_litestar_middleware.py to use data-request-id assertion - Copy existing test files to worktree 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update litestar_basic/app.py: - Add docstring section for UI features - Update template to mention toolbar positioning - Add link to request history page - Update litestar_advanced_alchemy/app.py: - Add docstring section for UI features - Add toolbar controls section to index template 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add package.json with biome.js dependency and scripts: - bun run lint - Check JS/CSS/JSON files - bun run lint:fix - Auto-fix issues - bun run format - Format files - Add biome.json configuration: - Space indentation (4 spaces) - Single quotes for JS - Recommended lint rules - CSS linting enabled - Update .gitignore to exclude node_modules and bun.lock 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add debug_toolbar.litestar.routes.rst for routes module - Add debug_toolbar.litestar.routes.handlers.rst for handlers - Update litestar.rst to include routes module 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The HTML form submits URL-encoded data, not JSON. Update endpoint to: - Accept URL-encoded form data via Body parameter - Return HTML response for browser redirect - Show success message with link back to users list 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add resize handle CSS for all toolbar positions (left/right/top/bottom) - Implement JavaScript drag-to-resize functionality - Store toolbar size in localStorage for persistence - Reset to default size when switching between horizontal/vertical positions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove manual session.commit() calls (handled by async_autocommit handler) - Add explicit relationship loading with load=[Model.relation] parameter - Prevents greenlet_spawn errors when accessing lazy-loaded relationships 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The SQLAlchemy panel wasn't capturing queries because event listeners were only attached when an engine was explicitly passed. Now, if no engine is provided, global listeners are attached to the Engine class itself, capturing queries from all SQLAlchemy engines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Middleware now collects route information from Litestar app - Improved JavaScript formatValue to show nested objects/arrays properly - Increased limits: maxDepth=3, maxItems=20, maxStringLen=500 - Added CSS styling for nested array/object display - Routes panel now shows actual route data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add light theme CSS variables with proper contrast colors - Add theme toggle button (sun/moon icon) in toolbar - Theme preference persists in localStorage - Add smooth CSS transitions for panel expand/collapse - Panel details now animate open/closed with opacity and max-height - History page panels also animate smoothly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The panel-content div had style="display: none;" which overrode the CSS transition classes. Panels now properly expand/collapse using CSS classes only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add inline script to apply saved theme on page load - Theme now persists across all toolbar pages (not just inline toolbar) - Add theme toggle button to history and detail page headers - Add CSS for header-row layout and page theme button 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Replace tuple syntax with union type syntax (X | Y) to fix UP038 ruff lint violations in CI using ruff 0.9.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request implements Phase 5 UI/UX enhancements for the debug toolbar, introducing a comprehensive toolbar interface with theme support, positioning controls, request history tracking, and improved data visualization. The changes integrate new UI routes, enhance the middleware for better data collection, add SQLAlchemy auto-attach functionality, and include frontend linting setup.
Key Changes:
- New toolbar UI routes (
/_debug_toolbar/) serving history and detail pages with dark/light themes - Four-position toolbar support (left/right/top/bottom) with localStorage persistence
- SQLAlchemy panel auto-attaches global event listeners when no explicit engine is provided
- Enhanced middleware to collect route metadata and render improved toolbar HTML
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/debug_toolbar/litestar/routes/handlers.py |
New file implementing toolbar UI routes with HTML rendering, CSS, and JavaScript for the debug toolbar interface |
src/debug_toolbar/litestar/routes/__init__.py |
Package initialization exposing create_debug_toolbar_router |
src/debug_toolbar/litestar/plugin.py |
Updated to create shared toolbar instance and register UI routes automatically |
src/debug_toolbar/litestar/middleware.py |
Enhanced to accept shared toolbar instance, collect route metadata, and render improved toolbar HTML with panel buttons |
src/debug_toolbar/extras/advanced_alchemy/panel.py |
Added global listener auto-attach functionality for SQLAlchemy query tracking without explicit engine configuration |
tests/integration/test_toolbar_routes.py |
New comprehensive test suite with 20 tests covering toolbar routes, API endpoints, static assets, and integration workflows |
tests/integration/test_litestar_middleware.py |
Updated test assertion to check for data attribute instead of text content |
tests/unit/__init__.py, tests/integration/__init__.py, tests/__init__.py |
Simplified docstrings |
examples/litestar_basic/app.py |
Updated with UI feature documentation and links to request history |
examples/litestar_advanced_alchemy/app.py |
Updated with UI documentation, fixed import order, removed manual commits (uses autocommit handler), changed POST response to HTML |
examples/profiling_panel_example.py |
Fixed string literal formatting (f-string to regular string) |
package.json |
Added Biome.js frontend linting configuration |
biome.json |
Biome linter/formatter configuration for JavaScript/CSS |
.gitignore |
Added Node.js/Bun ignore patterns |
docs/api/_autosummary/debug_toolbar.litestar.rst |
Added routes module to documentation |
docs/api/_autosummary/debug_toolbar.litestar.routes.rst |
New documentation file for routes module |
docs/api/_autosummary/debug_toolbar.litestar.routes.handlers.rst |
New documentation file for handlers module functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Escape dictionary keys in _render_panel_content - Escape method, path in _render_request_row with CSS class sanitization - Escape panel_id, panel_title in panel rendering - Escape query_string, content_type, client_host, client_port in detail view - Sanitize CSS class names to only allow alphanumeric characters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete Phase 5 UI/UX implementation for the debug toolbar:
/_debug_toolbar/) with history and detail viewsNew Files
src/debug_toolbar/litestar/routes/handlers.py- Toolbar UI routes, CSS, JStests/integration/test_toolbar_routes.py- 20 comprehensive route testsbiome.json/package.json- Frontend linting with Biome.jsChanges
Test plan
Screenshots
Theme toggle, positioning, and resize all work across:
/_debug_toolbar/history page/_debug_toolbar/{request_id}detail page🤖 Generated with Claude Code