feat(docker): the service and container pages say each fact once (#5310)
CI / lint (push) Successful in 4s
CI / integration (push) Successful in 1m33s
CI / unit (push) Failing after 1m59s
CI / publish (push) Skipped

Service page:
- The header carries the verdict, mode, stack, image and when it was reported.
  'In trouble since' shows only while the service is in trouble; once recovered,
  'Last failed X ago · its logs'.
- The failure card shows only while the service is down, degraded or crash-looping.
- The tile strip and the kv card are gone.
- One Tasks table: running tasks first with CPU, memory and since when, then
  Swarm's record. The node is named as its Steward host throughout, and
  'N failed in 24h' sits in the caption.

Container page:
- Same shape: header verdict, a 'Last exit' card only while it is stopped
  after a failing exit, set-up and I/O in one kv card, and lifecycle as a table.
- A swarm task's breadcrumb goes through its service.

Both pages:
- Resource history is the one fragment (_usage_history.html): now and peak in
  cores and bytes, drawn with a floor of 1 core / 1 GiB (sparkline_svg floor=),
  so idle noise draws flat.
- The container page's old % sparklines, its private _sparkline and the unused
  bucket()/container_history() helpers are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 21:33:25 -04:00
co-authored by Claude Opus 5.5
parent 6c486d2f9c
commit 29be9e3590
12 changed files with 408 additions and 315 deletions
+11 -3
View File
@@ -77,16 +77,24 @@ async def collect_status(db) -> list[StatusEntry]:
def sparkline_svg(values: list[float], width: int = 80, height: int = 20,
stroke: str = "#6060c0", fill_width: bool = False) -> str:
stroke: str = "#6060c0", fill_width: bool = False,
floor: float | None = None) -> str:
"""Tiny inline SVG polyline for a response-time series. With fill_width
the line stretches across its container (CSS sets the width) and keeps a
1.5px stroke."""
1.5px stroke.
With `floor` the line is drawn from zero up to its own peak, but never
against less than `floor`, so a value idling near zero draws flat rather
than its noise filling the height (UI & Design ruling 8)."""
vals = [v for v in values if v is not None]
size = (f'width="100%" height="{height}" preserveAspectRatio="none"' if fill_width
else f'width="{width}" height="{height}"')
if len(vals) < 2:
return f'<svg {size}></svg>'
mn, mx = min(vals), max(vals)
if floor is not None:
mn, mx = 0.0, max(max(vals), floor)
else:
mn, mx = min(vals), max(vals)
if mx == mn:
mx = mn + 1.0
step = width / (len(vals) - 1)