Repository navigation
Add -airgap: embed Chart.js in dashboard.html for offline viewing - #59
Conversation
By default the dashboard loads Chart.js from a CDN; opened without internet the script fails and the page renders no charts, tables or alerts. -airgap inlines Chart.js 4.4.3 (vendored from the npm tarball, checksum pinned in a test, MIT licence alongside). Without the flag the output is unchanged. Documented in airgap/README.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Distributed artifacts need the full MIT notice, and release archives need the linked offline usage guide.
2 open issues
What changed in this PR
Adds optional offline viewing for ClickHouse diagnostic dashboards while preserving default CDN loading.
Changes:
- Adds
-airgapand embeds Chart.js 4.4.3. - Tests asset integrity, rendering, and script order.
- Documents offline usage and links troubleshooting guidance.
| File | Description |
|---|---|
| README.md | Links offline dashboard instructions. |
| internal/dashboard/generator.go | Selects offline or CDN rendering. |
| internal/dashboard/assets/LICENSE.chartjs.md | Adds Chart.js licence text. |
| internal/dashboard/assets/chart.umd.js | Vendors Chart.js 4.4.3. |
| internal/dashboard/airgap.go | Embeds Chart.js and updates the footer. |
| internal/dashboard/airgap_test.go | Tests asset integrity and rendering modes. |
| cmd/main.go | Registers and forwards -airgap. |
| airgap/README.md | Documents offline usage and limitations. |
Review effort: Balanced
A dashboard.html travels alone, so the banner's one-line MIT mention is not enough: the full licence text is now embedded in a comment ahead of the library. The release packaging copied cluster-collect/ but not airgap/, leaving release users without the only usage guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The -airgap version of the same report adds about 300kb to the html with the embedded chart.js, which is reasonable. We could consider of a "self-hosted" support diagnostics in the future, e.g. with a flag |


Why
dashboard.htmlloads Chart.js from a public CDN. When the file is opened on a machine with no internet access (air-gapped networks, locked-down workstations, browsers that block CDNs), the script never loads and the page renders nothing: no charts, no tables and no alerts, not only the charts.What
A new
-airgapflag embeds Chart.js 4.4.3, which ships inside the binary, directly indashboard.html, so the page opens with no network access. Without the flag nothing changes: the output is the same CDN page as today, and a test checks this.airgap/README.md: how and when to use it, with examples (single node,cluster ... -- -airgap, and combined with other flags), how to verify it from the footer, and the size cost. The flag is documented only there. The main README's "Dashboard charts blank" entry now links to that folder.internal/dashboard/assets/chart.umd.js:dist/chart.umd.jsfrom the npmchart.js@4.4.3tarball, unmodified. The tarball matches the registry's sha512 integrity hash, and the test pins the file's sha256. The MIT licence (LICENSE.chartjs.md) is embedded too, and its full text is inlined as a comment just ahead of the library, so every standalonedashboard.htmlcarries the permission notice.internal/dashboard/airgap.go:go:embedplusWithAirgap, which replaces the CDN<script>tag and the footer text.Makefile:airgapadded toDATA_DIRS, so release archives ship the README.schema_graph.htmlwas already network-free.Testing
make testpasses andgofmt -lis clean.</scriptor*/that would end the script or the comment early;-airgapoutput has no remote<script>/<link>, and Chart.js comes before the dashboard script.Chartundefined)-airgapdashboard.htmlgrows from about 300 KB to about 510 KB with the flag (about 70 KB once gzipped in the bundle).make release: every archive containsairgap/README.md.cluster -- -airgappasses the flag through to every host's command.🤖 Generated with Claude Code