2.0 KiB
2.0 KiB
024 — Time range controls (Grafana-style presets)
Summary
Today the only way to set the active time range is dragging over LogTimeline
(App.tsx's range state, passed to LogPreview/Metrics/Dashboards as
startMs/endMs). The wishlist wants explicit controls like Grafana's: an "All"
option and relative presets ("last 5 minutes", etc.), not just drag-to-select.
Scope
- A time-range control component (dropdown or button row) offering at least:
"All" (no range — today's
range === nulldefault) and a handful of relative presets (e.g. last 5m / 15m / 1h / 24h), placed nearLogTimelinealongside the existing drag-select interaction. - Selecting a preset computes
{startMs, endMs}relative to now and feeds the samerangestateApp.tsxalready threads through toLogTimeline,LogPreview,Metrics, andDashboards— no new plumbing needed downstream, since all four already accept/consume a range. - Relative presets need to "move with time" while active (e.g. "last 5 minutes" should mean rolling last 5 minutes, not a frozen window from selection time) — decide and implement a refresh cadence (e.g. re-resolve the relative range on the same interval the app already polls for new data) versus a one-shot resolved range; document the choice.
- Manually dragging on
LogTimelineafter a preset is active should override it back to a fixed (non-rolling) range, same as today.
Acceptance criteria
- Selecting "All" clears the range the same way today's implicit default does.
- Selecting a relative preset narrows
LogPreview,LogTimeline,Metrics, andDashboardsto that window. - A rolling preset's window visibly advances over time without user interaction, if that's the chosen behavior (see Scope).
- Dragging on
LogTimelinewhile a preset is active switches back to a fixed range bounded by the drag.
Depends on
None — the underlying range plumbing (App.tsx → LogTimeline/LogPreview/
Metrics/Dashboards) already exists; this only adds the control surface.