42 lines
2.0 KiB
Markdown
42 lines
2.0 KiB
Markdown
# 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 === null` default) and a handful of relative
|
|
presets (e.g. last 5m / 15m / 1h / 24h), placed near `LogTimeline` alongside the
|
|
existing drag-select interaction.
|
|
- Selecting a preset computes `{startMs, endMs}` relative to now and feeds the
|
|
same `range` state `App.tsx` already threads through to `LogTimeline`,
|
|
`LogPreview`, `Metrics`, and `Dashboards` — 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 `LogTimeline` after 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`, and
|
|
`Dashboards` to that window.
|
|
- A rolling preset's window visibly advances over time without user interaction,
|
|
if that's the chosen behavior (see Scope).
|
|
- Dragging on `LogTimeline` while 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.
|