CAMEL-23636: camel-diagram - fix diagram text overflow, dark-theme contrast, add smoke pages#24275
CAMEL-23636: camel-diagram - fix diagram text overflow, dark-theme contrast, add smoke pages#24275ammachado wants to merge 3 commits into
Conversation
…ntrast, add smoke pages - Replace fixed char-count truncation with canvas measureText width-aware fitText in both camel-route-diagram and camel-topology-diagram, so long labels trim to a clean ellipsis instead of overflowing the node box. - Topology: reserve space for the metric badge and add a native SVG <title> tooltip showing the full label/URI when the text is trimmed. - Fix dark-theme node-box contrast in camel-topology-diagram by introducing a --ctd-node-bg token that the dark media query flips together with the text color (mirrors the existing --crd-node-bg pattern in route-diagram). - Add a camel-topology-diagram smoke-test page and rename smoke-test.html to smoke-test-route.html for consistency. - Add a Light/Dark/OS header theme switch (default OS) to both smoke pages. - Update integration-test.html links to the renamed and new smoke pages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
All tested modules (8 modules)
|
Measure labels with the active --crd-font and --ctd-font values, let topology badges reserve enough space for large counters, and move the font smoke cases into the theming sections. Co-authored-by: OpenAI Codex <codex@openai.com>
…moke tests Document the topology web component, dev-console topology mode, and CSS theming. Move the custom-font demo to its own row and use Courier New so text measurement matches the rendered SVG font. Co-authored-by: Cursor <cursoragent@cursor.com>
davsclaus
left a comment
There was a problem hiding this comment.
Nice work on the text-overflow fix and dark-theme contrast — the fitText approach with canvas measureText is a solid improvement over the fixed character-count truncation, and the graceful fallback for environments without a canvas context is a good touch.
One minor documentation gap: the new --ctd-node-bg CSS custom property is correctly introduced in the JS and mentioned in the JSDoc, but it's missing from the Topology Diagram Theming section in diagram.adoc. The analogous --crd-node-bg is documented in the Route Diagram Theming section — adding --ctd-node-bg to the topology section would keep them consistent.
Everything else looks clean — CI passes, the esc() escaping is correct for the new <title> tooltips, the smoke-test rename is fully propagated, and the tests follow the existing pattern.
This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
| --ctd-color-external-out: #6b7280; /* external output endpoints */ | ||
| --ctd-color-external-shared: #8b5cf6; /* shared external endpoints */ | ||
| } | ||
| ---- |
There was a problem hiding this comment.
The new --ctd-node-bg CSS custom property (introduced in the JS to fix the dark-theme contrast bug) is missing from this theming reference. The Route Diagram Theming section above documents the analogous --crd-node-bg. Consider adding it here for consistency:
| ---- | |
| camel-topology-diagram { | |
| --ctd-bg: #ffffff; /* canvas background */ | |
| --ctd-node-bg: #ffffff; /* node box fill, auto-inverts in dark mode */ | |
| --ctd-fg: #1e293b; /* text colour */ | |
| --ctd-edge: #94a3b8; /* edge/arrow colour */ | |
| --ctd-stat: #64748b; /* metric overlay text */ | |
| --ctd-font: system-ui; /* font family */ | |
| --ctd-font-size: 12px; /* base font size */ | |
| --ctd-color-route: #6366f1; /* route nodes */ | |
| --ctd-color-trigger: #f59e0b; /* trigger/timer routes */ | |
| --ctd-color-external-in: #6b7280; /* external input endpoints */ | |
| --ctd-color-external-out: #6b7280; /* external output endpoints */ | |
| --ctd-color-external-shared: #8b5cf6; /* shared external endpoints */ | |
| } |
Description
Improves the text rendering and theming of the
camel-diagramdev-console web components (camel-route-diagramandcamel-topology-diagram) and refreshes their local smoke-test pages.Rendering fixes (production component JS):
measureTextwidth-awarefitText, so long node labels trim to a clean ellipsis instead of overflowing the box. Applies to bothcamel-route-diagram.jsandcamel-topology-diagram.js.camel-topology-diagram: reserve horizontal space for the metric badge so the green/red exchange counters no longer overlap the label, and add a native SVG<title>tooltip that reveals the full label and underlying URI when the text is trimmed.camel-topology-diagramby introducing a--ctd-node-bgcustom property that the@media (prefers-color-scheme: dark)query flips together with the text color. Previously the node<rect>read--ctd-bgdirectly, which never flipped, producing light text on a white box. This mirrors the existing--crd-node-bgpattern already used bycamel-route-diagram.Test resources (manual smoke pages, not part of CI):
smoke-test-topology.html, a verification page forcamel-topology-diagramwith five examples (route pipeline, external endpoints, interlinked shared endpoint, live metrics, and theme variants) drawn from the topology unit tests and the route-topology blog scenario.smoke-test.htmltosmoke-test-route.htmlfor naming consistency with the new topology page.Light / Dark / OSheader theme switch (defaulting to OS) to both smoke pages so each section can be checked in either theme without changing OS settings.integration-test.htmlnavigation links to point at the renamed and new pages.The change is limited to static JS resources and HTML test pages; no Java sources or auto-generated artifacts are affected.
Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.AI-assisted contributions
Co-authored-bytrailers) and the PR description identifies the AI tool used.Claude Code on behalf of Adriano Machado