fix(frontend): load D3.js from jsdelivr instead of d3js.org - #149
fix(frontend): load D3.js from jsdelivr instead of d3js.org#149jeremiaspf wants to merge 1 commit into
Conversation
query-ontology-viewer.js, query-sigmagraph.js, registry.js, _ontology_map.html and _mapping_design.html all load D3.js from https://d3js.org/d3.v7.min.js. In networks where d3js.org is blocked — common in corporate environments with restricted outbound access, as is typical for Databricks Apps — every D3-based visualization these files power (ontology viewer, query result graph, Registry bridges map, mapping designer map) fails to load at all. Switching to https://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js resolves this in those environments. ontology-swrl.js gets the same change as part of the companion Designer-UI PR, since it also needed unrelated fixes there.
|
|
benoitcayladbx
left a comment
There was a problem hiding this comment.
Thanks for this — relevant and still needed on develop. d3js.org is still the D3 URL in every call site you listed, and jsDelivr is already the CDN we use for Bootstrap / Chart.js / marked, so this is the right direction.
Rules that still need a pass
Incomplete change (same bug remains elsewhere). src/front/static/ontology/js/ontology-swrl.js still loads https://d3js.org/d3.v7.min.js in _ensureD3(). You noted a companion Designer PR; please fold that last call site into this PR so a restricted network cannot still break the SWRL graph. Grep for d3js.org should return zero hits under src/.
Changelog (.cursorrules + .cursor/08-testing-and-deployment.mdc). After any code change, add a section under changelogs/v0.8.0/<github-user>_YYYY-MM-DD.log (English): title, context, numbered file list, modified files, test result.
Docs (.cursor/08 §Documentation Rules). If D3 is listed as a dependency with the old URL (Sphinx documentation/sphinx / development guides), update the link to jsDelivr so the docs match runtime.
CLA. The CLA assistant is still pending on this PR — please sign / recheck so we can merge.
Guidance
- Keep the unpkg/jsDelivr URL pinned to D3 v7 (
d3@7) as you did; do not float to latest major. - Optional follow-up (not blocking): vendor D3 under
src/front/static/so Databricks Apps with all public CDNs blocked still render. Out of scope here if jsDelivr is already allowed for Bootstrap.
Once the SWRL call site + changelog (and CLA) are in, this is mergeable.
What
Switches D3.js from
https://d3js.org/d3.v7.min.jstohttps://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.jsin every file that loads it:src/front/static/query/js/query-ontology-viewer.js(Query → Ontology Viewer)src/front/static/query/js/query-sigmagraph.js(query result graph, Sigma.js)src/front/static/registry/js/registry.js(Registry bridges map)src/front/templates/partials/ontology/_ontology_map.html(ontology map template)src/front/templates/partials/mapping/_mapping_design.html(Mapping designer panel template)(
src/front/static/ontology/js/ontology-swrl.jsgets the same change as part of the companion Designer-UI PR, since that file needed unrelated fixes too.)Why
d3js.orgis blocked in networks with restricted outbound access — which is common for Databricks Apps deployed in corporate environments. When that happens, every D3-based visualization fails to load entirely: the SWRL rule graph, the ontology viewer, the query result graph, the Registry bridges map, and the Mapping designer map. jsDelivr resolves cleanly in those environments and serves the same D3 v7 build.How to test
In an environment where
d3js.orgis blocked (or simulate by blocking it at the OS/proxy level), open any of the five screens above — they should render their D3 visualization instead of failing silently.