Skip to content

Commit 1c35fe1

Browse files
authored
Merge pull request #8 from bazaruzero/ui-enhancements
UI enhancements
2 parents 092c161 + b29b6d4 commit 1c35fe1

76 files changed

Lines changed: 2554 additions & 332 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 92 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,15 @@ Then open `http://localhost:8081`.
161161
162162
### Behavior
163163
164-
- Each panel shows the **last hour** of its metric(s) as a smooth line chart
165-
(per-series or min/max/current legend under the chart, tooltips on every
166-
point) and refreshes automatically every `refresh.interval` — no page
167-
reload, no user action.
168-
- A metric with no data in the window renders an explicit "No data in the
169-
last hour" panel; the rest of the page is unaffected.
164+
- Each panel starts with the **last hour** of its metrics. Hover over the plot
165+
to inspect the nearest sample's local date, time and value. Axis labels
166+
and hover times use your browser's timezone, including daylight saving
167+
transitions. Each viewer sees their own local times after every refresh.
168+
With JavaScript disabled, the axis shows UTC. The crosshair
169+
and tooltip follow the pointer and stay visible during automatic refresh.
170+
A single-series legend shows the minimum, maximum and current value.
171+
Multi-series legends show each metric's current value in its configured color.
172+
- An empty panel identifies the window that has no readings.
170173
- If the agent becomes unreachable, a visible banner appears and panels
171174
switch to an error state; when the agent comes back, everything recovers
172175
automatically — no frontend restart needed. The frontend also starts
@@ -175,6 +178,89 @@ Then open `http://localhost:8081`.
175178
htmx) are embedded in the binary and served by the frontend itself — no
176179
CDN, no external requests, no Node/npm toolchain.
177180
181+
### Chart time ranges
182+
183+
Choose **1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h or 24h** for the dashboard. Each panel
184+
inherits that range until you choose a panel override. Clearing the override
185+
restores the dashboard selection. A relative range advances with each poll.
186+
The URL records your choices so you can share a view or revisit it with Back.
187+
188+
| Example query | Result |
189+
| --- | --- |
190+
| `?range=3h` | All panels show the last three hours. |
191+
| `?range=3h&p.Active%20Sessions.range=15m` | Active Sessions shows fifteen minutes and other panels inherit three hours. |
192+
| `?from=2026-10-20T18:00:00Z&to=2026-10-20T21:00:00Z` | Polls repeatedly fetch the same fixed period. |
193+
194+
Use either `range` or a complete, increasing RFC3339 `from` and `to` pair.
195+
Prefix any of these keys with `p.<graph name>.` for one panel. URL-encode
196+
graph names and timestamp offsets. Invalid or conflicting panel selections
197+
inherit the dashboard range; an invalid dashboard range defaults to one hour.
198+
At twelve hours and above, ticks include the local date. For dense series,
199+
each chart draws up to 1,000 representative samples per series. The visible
200+
curve retains bucket extrema and the first and last readings; the legend
201+
and vertical scale use all in-range samples.
202+
203+
### Series visibility
204+
205+
Chart summaries display full decimal values. Each visible series also shows
206+
its arithmetic **mean** over all readings in the panel's selected period,
207+
using its override or the inherited dashboard range. The mean uses the full
208+
data before rendering reduction and rounds to the nearest whole number.
209+
210+
On a multi-series panel, click a legend chip to isolate that metric.
211+
Ctrl+click (Cmd+click on macOS) adds or removes a series. Clicking
212+
the sole visible series, or removing the last selected series restores
213+
the complete graph. Dimmed chips remain available for selection.
214+
215+
The server fetches only selected metrics and fits the scale and summaries
216+
to them. Each metric retains its configured color. Selection is shared by
217+
repeated URL fields such as `p.Database.series=db_stats.commits` and
218+
`p.Database.series=db_stats.reads`. Invalid names or duplicate selections
219+
show all series. Selection survives polling, zoom, reset and browser history.
220+
221+
### Drag to zoom
222+
223+
Drag horizontally inside a chart with the mouse to inspect a smaller period.
224+
The selected panel fetches that fixed period again and fits its scale to the
225+
readings. A short enough period shows every sample within the 1,000-point
226+
budget. Other panels keep their selections.
227+
228+
Use **Reset** to restore the panel's range before zooming, or choose a preset
229+
to return to a rolling range. Zoom and Reset update browser history and can
230+
be shared by URL. Nested zooms keep the original reset destination in
231+
`p.<graph name>.zoomBack`. Automatic and manual refresh retain zoomed bounds.
232+
Drags shorter than eight pixels or ending outside the plot are cancelled.
233+
Press Escape to cancel a selection. This interaction uses a desktop mouse.
234+
235+
### Refresh cadence
236+
237+
Choose Off, 5s, 10s, 30s, 1m or 5m, or enter a custom whole minute/hour
238+
interval such as `15m` or `2h` (one minute through 24 hours).
239+
`?refresh=30s` shares the cadence; without a valid parameter the
240+
`webui.yaml` refresh interval is used. Cadence changes replace the current
241+
history entry. Off pauses both chart and connectivity polling.
242+
243+
**Refresh now** fetches all selected windows once, including while paused.
244+
Relative ranges advance to the current time; fixed ranges retain their
245+
bounds. The last-updated time uses your browser timezone and remains visible while paused. Failed updates retain the last successful time.
246+
247+
### Dashboard design tokens
248+
249+
The embedded stylesheet in `internal/web/server/assets/app.css` defines
250+
the tokens shared by panels, legends, tooltips and dashboard controls.
251+
252+
| Purpose | CSS custom properties |
253+
| --- | --- |
254+
| Page, panel and inset backgrounds | `--bg`, `--panel`, `--surface-soft` |
255+
| Borders and chart guides | `--border`, `--grid` |
256+
| Text, secondary text, accent and errors | `--text`, `--muted`, `--accent`, `--error` |
257+
| Interface and detail typography | `--font-ui`, `--font-detail` |
258+
| Spacing scale | `--space-1`, `--space-2`, `--space-3`, `--space-4`, `--space-6` |
259+
| Corner radii and floating tooltip shadow | `--radius-sm`, `--radius-panel`, `--shadow-float` |
260+
261+
The chart renderer assigns palette colors by position in the graph's
262+
configured metric list. The matching legend chip receives `--series-color`.
263+
178264
## How collection is scheduled
179265
180266
Collection runs in cycles driven by `collector.interval`: the agent wakes,

‎internal/web/agent/agent.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ type rawPoint struct {
5757
func (c *Client) Points(ctx context.Context, name string, from, to time.Time) ([]Point, error) {
5858
u := fmt.Sprintf("%s/api/v1/metrics/%s/data", c.baseURL, url.PathEscape(name))
5959
q := url.Values{}
60-
q.Set("from", from.Format(time.RFC3339))
61-
q.Set("to", to.Format(time.RFC3339))
60+
q.Set("from", from.Format(time.RFC3339Nano))
61+
q.Set("to", to.Format(time.RFC3339Nano))
6262
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u+"?"+q.Encode(), nil)
6363
if err != nil {
6464
return nil, &Error{Metric: name, Err: err}

0 commit comments

Comments
 (0)