feat: ER diagram with pure HTML canvas, orthogonal routing, schema selector, and drag/pan#119
Merged
Merged
Conversation
Add a visible ER diagram button next to the refresh button in the database selector toolbar. Previously users could only access the ER diagram via right-click context menu on a table in the schema tree. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Handle showErDiagram action in handleDatabaseAction to call tabStore.openErDiagramTab with the active connection, selected database, and schema. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Remove standalone toolbar button, add 'ER Diagram' item to the database actions dropdown menu instead. This keeps the toolbar clean and groups all database-level actions together. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
When opening ER diagram from database toolbar, omit the schema parameter so all tables across all schemas are displayed instead of only the currently selected schema. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
… replace emoji icons - Zoom: use proportional scaling based on deltaY for better trackpad precision - Toolbar: add zoom in (+) and zoom out (-) buttons with step factor 1.3x - Schema: add schema selector dropdown before filter input, default 'All Schemas' - Icons: replace 🔑🔗• emoji with clean inline SVG icons (key, link, circle) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Schema selector was not showing because available schemas may not be populated in the store yet. Add fallback to call databaseStore.fetchSchemas when cache is empty. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Replace empty string '' with '__all__' for the 'all schemas' option to avoid Radix Vue Select issues - Reorder zoom controls to: zoom out → zoom in → percentage (matching user expectation) - Add z-[100] to SelectContent to ensure dropdown renders above other elements - Add schemaParam computed to map '__all__' → null for API calls Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Use invoke('list_schemas', ...) directly to avoid any Pinia store reactivity issues when the store hasn't cached schemas for the current database yet.
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…eral Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ssues - Click: remove opacity dimming on non-selected tables, just highlight selected + connected table cards - Drag: add mouse-drag to reposition table nodes on the canvas - Expand button: add whitespace-nowrap and increase button height to prevent truncation - Nullable indicator: remove confusing circle icon (NOT NULL is the default assumption) - Edge dimming: remove opacity reduction on non-highlighted edges Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
… badges - Orthogonal path routing: relationship lines now route around table cards with collision avoidance, replacing straight dagre edges - Ctrl/Meta+Wheel zoom: zoom now requires ctrl/meta modifier, centered on mouse position. Plain wheel scrolls vertically - Focus mode: clicking a table filters the view to only show the selected table and its directly related tables (via FK) - Info badges: toolbar shows table count and relationship count badges - Column marker alignment: non-PK/FK columns now get an empty spacer to keep all column text aligned - Gesture support: added gesturestart/gesturechange handlers for trackpad pinch-to-zoom Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…verflow - Drag: use dragDelta offset ref instead of updating nodePositions on every mousemove. Node positions and edge routes only update on drop. Eliminates shaking and position drift. - SVG: add overflow=visible to prevent table clipping outside viewport during drag/pan - Tooltips: add titles to tables badge, relationships badge, and layout direction button Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…uto-size, header drag - Pure HTML rendering: replaced SVG+foreignObject with HTML div cards in an overflow:auto viewport with CSS scale zoom. SVG overlay used only for relationship lines (pointer-events:none) - Header-only drag: drag now originates only from table header (cursor:grab). Uses delta-offset pattern, commits position on drop only - Engineering mode: new entity-relationship view with rounded entities and column pills. Toggle via segmented control in toolbar - Canvas auto-sizing: canvas dimensions computed from bounding box of all positioned tables. fitToScreen centers content - Reset Layout: toolbar button restores dagre auto-layout positions - View mode toggle: table view / engineering view switch preserving all interactions - Native scroll pan: viewport uses overflow:auto, pan is native browser scroll. Ctrl+wheel zoom centered on mouse - Extracted pure modules: types.ts, graph-routing.ts, graph-layout.ts with Jest TDD (32 new tests) - TableCard.vue and EngineeringEntity.vue: presentational components with matching prop/emit interfaces - All existing features preserved: schema selector, search, info badges, focus mode, layout direction, expand/collapse, orthogonal routing, large schema warning Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add right-click drag panning: hold right button on blank canvas area and drag to scroll the viewport. Prevents browser context menu during drag. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Move right-drag event handling from document listeners to template handlers on the viewport and content divs, so mousedown/mousemove/mouseup are captured reliably. Also add @mousedown on inner content wrapper for events that don't bubble. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Left-click drag on blank canvas now pans the viewport (single finger on trackpad). Target detection via .er-table-wrapper class prevents interfering with table card clicks - Right-click drag also pans (context menu suppressed) - Remove Engineering view and view mode toggle — table view only - Cursor changes to grab/grabbing during pan and table drag Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Left-click-only pan. Right-click now shows browser context menu again. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- LR layout: use clean center-to-center bezier curves instead of orthogonal routing (which looked wrong horizontally with dangling lines) - Selection style: simplified to just — subtle color change, no thick rings or shadows - Drag smoothness: add on dragged table wrapper for GPU acceleration Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
… direct drag - Remove layout direction toggle — always top-to-bottom dagre layout - Change positions from Map to Record<string,Position> — simpler reactivity, aligns with reference approach - Simplify drag: update manualOverrides directly on mousemove (no dragDelta intermediate), add minimum boundary (16px) - Simplify canvas sizing: direct max-extent calculation instead of bounding-box pipeline - Remove computeBoundingBox, simplify computeCanvasSize signature - Remove computeRelationshipPath direction param - Update all tests for new signatures (443 tests pass) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Remove manualOverrides reset from computeLayout — dagre layout no longer clears user-dragged positions - Move manualOverrides reset to resetLayout only (explicit button) - Change watcher to only watch expandedTables, not displayedTables (search/focus changes no longer trigger layout recompute) Fixes: drag position reverting on blank click, canvas shifting during drag Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Orthogonal routing produced dangling line segments when candidate routeX fell outside table boundaries. Bezier curves between table centers are simpler, always clean, and eliminate 'headless line' artifacts. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ode hiding - Orthogonal routing: remove left-edge candidate (minLeft - ROUTE_PADDING), always route rightward between or past tables. No more dangling leftward segments or lines through tables - Focus mode removed: clicking a table only highlights (color/opacity), never hides unrelated tables. No more tables disappearing on click Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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 rewrite of the ER diagram view. SVG+foreignObject replaced with pure HTML canvas, bringing native scroll pan, smooth drag, and reliable rendering across all browsers. 25 commits, 7 new files, ~1200 lines of changes.
Major Features
Entry Point
...menu)Rendering Architecture
overflow:autoviewport with CSStransform: scale()zoom, no more<foreignObject>rendering issuespointer-events:none): relationship lines rendered independently from table cardscursor:grab)Routing & Layout
TB(top-to-bottom) only — no LR toggleInteractions
cursor:grabbing)Toolbar
Table / Engineering→ Table only (engineering removed)Column Display
Module Architecture
All pure TS modules have Jest characterization tests:
graph-routing.test.ts—rangesOverlap,routeSideX,candidateRouteXs,computeRelationshipPath,buildTableRectMapgraph-layout.test.ts—computeDagreLayout,computeCanvasSize,fitToScreenTechnical Decisions
Record<string, Position>for simpler reactivity (spread merge)dagrePositions(auto-layout) +manualOverrides(user drag) merged via computedmanualOverridesupdated on every mousemove, no delta-offset indirectionexpandedTablestriggers layout recompute — search/focus changes do not reset positionsRemoved