Skip to content

Commit 31afb9b

Browse files
feat(impl-generate): enable interactive HTML previews for JavaScript libs (#8251)
## Problem Interactive JS charts (echarts/chartjs/d3) render no **Interactive** toggle on the site, even though the interactive HTML already exists in production GCS: ``` .../plots/scatter-basic/javascript/echarts/plot-light.html → 200 .../plots/scatter-basic/javascript/echarts/plot-dark.html → 200 ``` The pipeline already does the hard parts: the render harness emits standalone `plot-{light,dark}.html`, the GCS upload promotes them (gated only on file existence, not library), and the frontend (`themedPreview.ts` + `SpecDetailView`/`SpecOverview`) renders `preview_html` when present. **The only gap:** the metadata `HAS_HTML` allowlist lists only the 6 Python interactive libs, so `preview_html_light/dark` are written as `null` for all JavaScript libs → the frontend never shows the toggle and the uploaded HTML sits unused. ## Fix Enable HTML for JavaScript libs in both places that carried the allowlist: - the metadata block (`HAS_HTML` → `preview_html_*`) - the issue-preview step (cosmetic "Interactive" links) **Gated on file existence**, not language alone: ```bash if [ "$LANGUAGE" = "javascript" ] && [ -f "$IMPL_DIR/plot-light.html" ] && [ -f "$IMPL_DIR/plot-dark.html" ]; then HAS_HTML="true" fi ``` so a JS lib (or a failed render) that produces no HTML can never wire `preview_html` to a 404 — strictly safer than the current `null`. Verified all three current JS libs emit both theme HTMLs (staging 200 for chartjs/d3, production 200 for echarts). The Python interactive allowlist is left untouched. ## Follow-up after merge Re-dispatch `impl-generate` for echarts/chartjs/d3 on scatter-basic so their metadata picks up the `preview_html` URLs (the HTML is already in GCS). No frontend change needed — the `Interactive` toggle is already wired to `preview_html`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8500d08 commit 31afb9b

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/impl-generate.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,18 @@ jobs:
649649
fi
650650
echo "::notice::Library version: $LIBRARY = $LIBRARY_VERSION ($LANGUAGE runtime $LANGUAGE_VERSION, pipeline python $PYTHON_VERSION)"
651651
652-
# Interactive libraries additionally produce HTML previews (one per theme)
652+
# Interactive libraries additionally produce HTML previews (one per theme).
653+
# Python interactive libs are listed explicitly. JavaScript libs are
654+
# interactive too (the browser render harness emits standalone
655+
# plot-{light,dark}.html) — but gate on the files actually existing, so a
656+
# lib/render that produced no HTML never points preview_html at a 404.
653657
HAS_HTML="false"
654658
case "$LIBRARY" in
655659
plotly|bokeh|altair|highcharts|pygal|letsplot) HAS_HTML="true" ;;
656660
esac
661+
if [ "$LANGUAGE" = "javascript" ] && [ -f "$IMPL_DIR/plot-light.html" ] && [ -f "$IMPL_DIR/plot-dark.html" ]; then
662+
HAS_HTML="true"
663+
fi
657664
658665
# Write metadata file using Python for proper YAML formatting
659666
# Pass all variables inline to avoid export/env issues
@@ -943,6 +950,13 @@ jobs:
943950
HTML_DARK="${BASE}/plot-dark.html"
944951
;;
945952
esac
953+
# JS libs are interactive too — link the HTML only when the render
954+
# produced it (mirrors the existence gate used for preview_html).
955+
IMPL_DIR="plots/${SPEC_ID}/implementations/${LANGUAGE}"
956+
if [ "$LANGUAGE" = "javascript" ] && [ -f "$IMPL_DIR/plot-light.html" ] && [ -f "$IMPL_DIR/plot-dark.html" ]; then
957+
HTML_LIGHT="${BASE}/plot-light.html"
958+
HTML_DARK="${BASE}/plot-dark.html"
959+
fi
946960
947961
BODY="## :art: ${LANGUAGE}/${LIBRARY} Preview
948962

0 commit comments

Comments
 (0)