Closed general

HTML export: no way to bake a default view (grain, milestone style, today marker) into the snapshot

Drew Owens · 10d ago ·closed by Drew Owens

v0.6.1. The self-contained HTML export (/export/html) is perfect for the wiki /render/ route: we ship it on adom/nsf-pcl as the interactive implementation timeline. But the snapshot always opens at the app defaults (month grain, diamond milestones, today marker on), while the page's static hero image shows the curated view (quarter grain, milestone lines, today hidden). Viewers land on a different look than the image that invited the click.

View preferences live in the viewer's localStorage, so they cannot travel with the exported file.

Request: let the export carry an initial view. Any of these shapes would work, in order of preference:

  1. Optional view block in the data file, e.g. project.view = { grain: 'quarter', milestones: 'lines', today: false }, applied as defaults everywhere (server render, HTML export, fresh browsers with no saved prefs). Saved user prefs could still win in the live app.
  2. Query params on the export endpoint (/export/html?grain=quarter&milestones=lines&today=0) baked into the snapshot.
  3. URL params honored by the snapshot at open time (render/....html?grain=quarter), so one link can pin the view.

Option 1 also fixes reproducibility for anyone serving the JSON with adom-gantt --data, which currently opens in months no matter what the author intended.

1 Reply

Drew Owens · 10d ago

Shipped in 0.7.0, using your option 1.

project.view in the data file pins how the chart opens:

"project": {
  "title": "Adom PCL Test Bed Implementation Timeline",
  "view": { "grain": "quarter", "milestones": "lines", "today": false, "labelWidth": 320 }
}
Field Values
grain day week month quarter year
milestones lines diamonds
today true false
theme dark light
labelWidth 120-760 px

Precedence, which is the part that matters for your case:

  • HTML export: the snapshot bakes the view and ignores the viewer's localStorage entirely. A visitor who has been fiddling with some other gantt still lands on your curated look. Verified by deliberately poisoning localStorage with light/diamonds/day/today-on/150px, reloading the snapshot, and getting quarter/lines/today-off/320px back.
  • Live app: project.view is the default, and a preference the user has set for themselves wins over it. Verified both directions: a browser with no saved preference opens at the authored view; after the user picks Months, Months survives a reload.
  • adom-gantt --data: same defaults, so a chart no longer opens in months regardless of what the author intended. That was the reproducibility half of your report.

I did not add options 2 or 3. Option 1 covers the wiki /render/ case and keeps one source of truth in the data file, whereas query params would let the same file render two ways depending on the link. Say the word if you want a URL override on top for one-off links.

theme and labelWidth are beyond what you asked for. labelWidth in particular is worth setting on the PCL chart, since several of those task names are long enough to clip at the default width.

Log in to reply.