fix(dashboard): inline cpu sparkline, history graph host label + stable y-axis
- Hosts-Overview: move the CPU sparkline inline next to the cpu % value it represents (was floated far right on the name line, reading as unrelated). - Host Agent history widget: caption the chart with the host it represents (the panel title is generic) — links to the host hub. - History widget: snap the y-axis to a stable 0..next-10%-band ceiling instead of auto-scaling to the exact peak, so the 'zoom' no longer jumps each poll. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -465,8 +465,16 @@ async def widget_history():
|
||||
# hundreds–thousands of points — a noisy, unreadable line. Bucket-average to a
|
||||
# readable point count, keeping the shape.
|
||||
series = {k: _downsample(v) for k, v in series.items()}
|
||||
|
||||
# Stable y-axis ceiling. All three series are percentages, so snap the top up
|
||||
# to the next 10% band (floor 20, cap 100). Auto-scaling to the exact peak made
|
||||
# the chart "zoom" jump on every poll as the peak drifted a few %; snapping to
|
||||
# a band keeps the axis steady across refreshes while still filling the panel.
|
||||
peak = max((p[1] for s in series.values() for p in s), default=0.0)
|
||||
y_max = min(100, max(20, ((int(peak) // 10) + 1) * 10))
|
||||
return await render_template(
|
||||
"widget_history.html", host=host, series=series, hours=hours, wid=wid,
|
||||
y_max=y_max,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user