Skip to content

feat: container diagram edge routing, auto layout & service switcher#2

Merged
abdullahbodur merged 2 commits intomainfrom
feat/container-diagram-ux-fixes
Mar 23, 2026
Merged

feat: container diagram edge routing, auto layout & service switcher#2
abdullahbodur merged 2 commits intomainfrom
feat/container-diagram-ux-fixes

Conversation

@abdullahbodur
Copy link
Copy Markdown
Owner

@abdullahbodur abdullahbodur commented Mar 21, 2026

Summary

  • Edge routing re-enabled for container diagram — routeEdges was being skipped entirely, causing React Flow's default (suboptimal) handle assignment. Now runs on every view, with a 150ms deferred second pass after React Flow measures actual node dimensions.
  • onNodeDragStop fixed — edges re-route to the closest dock point after any node drag. Previous implementation called setEdges inside a setNodes updater (anti-pattern); replaced with getNodes() which reads React Flow's Zustand store synchronously, guaranteeing fresh drag-end positions.
  • Auto Layout button now visible for container diagram (re-routes handles without dagre); same getNodes() fix applied.
  • Service switcher panel extended to container diagram so users can switch services mid-view without losing context.
  • buildServiceContainer.ts — new library that builds a per-service container view (service node + infra children + external dependency nodes + labeled edges).
  • Type extensionsarchmap.yml infra declarations supported across scanner, graph-builder, and web packages.

Test plan

  • pnpm --filter @archmap/web exec tsc --noEmit passes with no errors
  • Open Container tab → select a service → infra nodes and edges render with correct handles (bottom for DB below, right for Kafka to the right)
  • Drag a node to the opposite side → edges re-route to closest handles on drop
  • Click Auto Layout → edges snap to correct handles + fitView animates
  • Use service switcher (top-left) to switch between services without returning to the picker screen

🤖 Generated with Claude Code

abdullahbodur and others added 2 commits March 22, 2026 00:09
- Re-enable routeEdges for containerDiagram (was skipped, causing
  suboptimal default handle assignment)
- Add deferred 150ms second-pass re-route after React Flow measures
  actual node dimensions, using getNodes() from Zustand store to avoid
  stale React state positions
- Fix onNodeDragStop: replace setEdges-inside-setNodes-updater
  anti-pattern with getNodes() so drag-end positions are always fresh
- Show Auto Layout button for containerDiagram (re-routes to closest
  handles without dagre); same getNodes() fix applied
- Extend service switcher panel to containerDiagram so users can switch
  services without losing context
- Add buildServiceContainer.ts: builds per-service container view
  (service node + infra children + external dependency nodes + edges)
- Extend archmap.yml types in scanner, graph-builder, and web to support
  infra declarations (databases, queues, caches, external services)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ighlighting

Data flow view
- Frontend-built data flow view (buildDataFlowView.ts) — deduplicates DTOs
  across services, draws DTO→DTO type-reference edges, strips generics correctly
- DataTypeNode shows all fields without truncation; enums styled in amber,
  DTOs in purple
- Click any DTO node to open a JSON example popup (DtoJsonModal) with recursive
  nested expansion and enum-aware values

Function flow
- Frontend-built function flow view (buildFunctionFlowView.ts) replaces the
  static graph-builder output; filters out @Configuration/@Application noise
- Functions grouped in labeled ClassGroupNode containers by class name with
  kind-colored accent bars; click header to collapse/expand a group
- Kind filter bar (SERVICE / HTTP / CONSUMER / REPO / SCHEDULED) to hide layers
- Isolated private helpers (no outgoing calls) are pruned automatically

Edge improvements
- All edges switched to bezier with arrowclosed markers (16×16) for clean heads
- Clicking any node highlights its connected edges in amber; dims the rest
- Click canvas background to clear selection
- Parallel edges get varied curvatures so they arc apart visually

Order service examples
- Added OrderMaintenanceScheduler (3 @scheduled jobs: expire, report, archive)
- Added NotificationService (email confirmation, cancellation, fraud alert)
- Added ReportingService (daily summary, monthly revenue via PricingService)
- Re-ran local scanner — order-service now has 43 functions across 14 classes

Tests
- New buildDataFlowView.test.ts (18 tests) and buildDtoExample.test.ts (20 tests)
- data-flow.test.ts rewritten for DTO→DTO edge contract
- data-types.test.ts extended with enum detection cases
- Added vitest config for web app with @/ path alias resolution

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@abdullahbodur abdullahbodur merged commit 3394c1b into main Mar 23, 2026
2 checks passed
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