feat(web): redesign Model Canvas as an ERD (compact/detailed views, draggable nodes, brand styling) - #1476
Conversation
Port the OWOX Model Canvas (owox/models, Apache-2.0) look into the Data Marts model canvas. Node cards now show a definition-type accent stripe + badge (VIEW / SQL / CONNECTOR / TABLE / PATTERN), a draft marker, and an ERD body: primary-key rows (keys first), typed field rows, and a '+N more' affordance that opens the Data Mart. Edges gain an N:1 / 1:1 cardinality badge next to the join-field label. definitionType + fields are enriched client-side from the data-mart detail endpoint (the /model-canvas/data-marts list omits them) in bounded- concurrency batches; a failed detail fetch leaves that node compact. Node height is a pure function of field count so the dagre layout and the rendered node stay in sync. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…expand Address review feedback to match the owox/models canvas UX: - Default to a compact card (header + type badge + field count); field rows now appear only in the new 'Detailed' (ERD) view, toggled from settings. - Make nodes draggable (nodesDraggable + onNodesChange) with drag positions preserved between layouts — cursor-grab affordance, action buttons marked nodrag. - '+N more fields' now expands the card in place (keys-first, collapsed at 4 rows) with a 'Show less' toggle, instead of opening the Data Mart. - Tidy card padding, header accent stripe + published/draft status dot. - Remove the canvas background grid. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Edges now render in OWOX brand blue (#0084ff, --primary), matching the New Data Mart button, instead of steelblue (scoped to the model canvas; the edit RelationshipCanvas is untouched). - Replace dagre elbow routing with pure React Flow bezier curves — no more angled corners in the join lines. - Hide the React Flow attribution badge (proOptions.hideAttribution). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Hi @ikrasovytskyi! 👋 Thank you so much for your interest in the project and for this contribution — we really appreciate the time and care you put into this PR, including the detailed description, testing notes, and trade-off analysis. We'll review your proposal and get back to you soon. |
- Render the canvas immediately from the lightweight list data and run the per-mart detail enrichment as a follow-up query, so first paint no longer waits for N sequential detail batches; results merge by id. - Restore parallel-edge separation: distinct joins between the same mart pair bow their bezier curves apart again instead of overlapping. - Derive the edge cardinality badge (1:1 / N:1 / 1:N) from declared primary keys covered by the join, hiding it when uniqueness cannot be proven, instead of guessing from edge direction. - Color minimap nodes by definition-type accent. - Drop dead elbow-routing code (route/labelPosition edge data, buildRoundedPath) and rename rounded-path.ts to path-point.ts. - Announce the node status dot to assistive technology. - Add unit tests for erd-node geometry helpers, cardinality inference, and in-place field expand/collapse. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Hi @ikrasovytskyi! 👋 Thanks again for this contribution — we've reviewed the PR, and the new ERD design looks great. The declared checks were all honest (type-check, ESLint, and the test suite passed exactly as described), and the detailed PR description with trade-off notes made the review a pleasure. Since you enabled "Allow edits by maintainers", we've pushed a commit (d964dff) on top of your branch that addresses the review findings, so your work lands faster. Here's what it changes and why: 1. Non-blocking detail enrichment. The per-mart detail fetches ran inside the main 2. Restored parallel-edge separation. The switch to pure 3. Primary-key-based cardinality. The 4. Cleanup + small wins. Removed the now-dead elbow-routing data ( Your idea of enriching the list endpoint server-side is a good one — we'd like to keep it as a follow-up rather than grow this PR. Please take a look at the commit when you have a moment — happy to discuss any of it. Once CI is green we'll move forward with the merge. Thanks again for the quality contribution! 🚀 |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Preview
0730.1.mov
Summary
Redesigns the Data Marts Models canvas into a proper ERD, bringing its look-and-feel in line with the standalone OWOX Model Canvas (
owox-model-canvas, Apache-2.0). Both canvases already use React Flow (@xyflow/react), so this is a rendering/interaction upgrade rather than a rewrite — the existing data wiring, dagre layout, highlight, search and filters are all preserved.The previous canvas rendered each mart as a fixed 240×74 box showing only a title and a field count, with orthogonal (elbow) edges and no way to inspect fields, tell mart types apart, or move nodes.
What changed
Node cards
Compact(default: header + type badge + field count) andDetailed(adds an ERD body). Toggle in the canvas settings popover; persisted per browser.VIEW/SQL/TABLE/PATTERN/CONNECTOR), a published/draft status dot, and tidied padding.Interaction
nodesDraggable+onNodesChange); drag positions persist between layout runs.proOptions.hideAttribution).Edges
--primary,#0084ff) to match primary actions. Scoped to the model canvas — the edit-screenRelationshipCanvasis untouched.N:1/1:1cardinality badge alongside the existing join-field label.Implementation notes
GET /model-canvas/data-martslist endpoint, so nodes are enriched client-side fromGET /data-marts/{id}(which already exposesschema.fields+definitionType) in bounded-concurrency batches. A failed detail fetch leaves that node compact instead of failing the whole canvas. Alternative: enrich the list endpoint server-side to avoid the N extra requests — happy to switch to that if preferred.owox/models.model/erd-node.tscentralises the accent palette and sizing/geometry helpers.Attribution
The visual/interaction design is ported from
owox/models(Apache-2.0, © OWOX, Inc.), adapted to this app's UI kit and theme tokens (works in light and dark).Testing
type-check, ESLint, and the model-canvas unit suite (52 tests) all pass.N:1labels, no attribution badge.Known trade-offs / possible follow-ups
smoothstepedges are a node-avoiding middle ground if desired.owox/models; this PR keeps the existing "Show join fields" toggle.How to try it
npm install