Tidy the dashboard and the forms around it
- Numeric column headers are right-aligned like their values; the stylesheet only aligned the cells, so "REQUESTS" sat nowhere near its numbers in every table that has them. - Ranked bars are an HTML grid instead of a fixed-width SVG: the value had 96 units and "34.2k tok 114 req" did not fit, so the figure a reader came for was the one cut off. Labels ellipsise in CSS and give their full text on hover. - Mean latency reads as 5 ms, 8.8 s or 1m 51s rather than 110695 ms. - The "What the cluster is doing" charts sat between the Models heading and the models table; they now come before it. - A fleet without GPUs shows its CPU capacity — nodes ready, memory, disk free for weights — instead of "No GPUs have been reported", and a node with no GPUs shows "—" rather than 0/0. - The profile's forms are a form's width rather than the page's, and the quotas page's price warning is a boxed banner rather than a line of red text. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5e1494f76d
commit
c1926be869
8 files changed
+118
-66
No files matched your search
+17
-35
@@ -33,15 +33,6 @@ func HBarChart(rows []Row, colour, unit string) template.HTML {
|
||||
return template.HTML(`<p class="empty">Nothing recorded yet.</p>`) //nolint:gosec // constant
|
||||
}
|
||||
|
||||
const (
|
||||
rowH = 26.0 // the band
|
||||
barH = 14.0 // the mark, capped well under the band so the rest is air
|
||||
labelW = 190.0
|
||||
valueW = 96.0
|
||||
width = 720.0
|
||||
)
|
||||
height := float64(len(rows))*rowH + 8
|
||||
|
||||
maxV := 0.0
|
||||
for _, r := range rows {
|
||||
if r.Value > maxV {
|
||||
@@ -51,41 +42,32 @@ func HBarChart(rows []Row, colour, unit string) template.HTML {
|
||||
if maxV <= 0 {
|
||||
maxV = 1
|
||||
}
|
||||
plotW := width - labelW - valueW
|
||||
|
||||
// HTML rather than an SVG of fixed width. The SVG gave the value 96 units
|
||||
// and "34.2k tok 114 req" did not fit, so the one figure a reader came for
|
||||
// was the one cut off. A grid lets the label and the value take the room
|
||||
// they need and gives the bar whatever is left.
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, `<div class="ranked"><svg viewBox="0 0 %.0f %.0f" role="img" `+
|
||||
`preserveAspectRatio="xMinYMin meet" aria-label="ranked bars">`, width, height)
|
||||
|
||||
for i, r := range rows {
|
||||
y := float64(i)*rowH + 4
|
||||
w := r.Value / maxV * plotW
|
||||
if w < 2 && r.Value > 0 {
|
||||
b.WriteString(`<div class="ranked" role="list">`)
|
||||
for _, r := range rows {
|
||||
pct := r.Value / maxV * 100
|
||||
if pct < 0.5 && r.Value > 0 {
|
||||
// A value that rounds to nothing still happened, and a bar of zero
|
||||
// width reads as no data rather than as a small number.
|
||||
w = 2
|
||||
pct = 0.5
|
||||
}
|
||||
|
||||
fmt.Fprintf(&b, `<text x="0" y="%.1f" font-size="12" fill="var(%s)">%s</text>`,
|
||||
y+barH-2, cssVar("--fg"), escapeText(trimLabel(r.Label, 30)))
|
||||
|
||||
// Square at the baseline, rounded at the data end: the shape says which
|
||||
// end is the measurement and which is the origin.
|
||||
fmt.Fprintf(&b,
|
||||
`<path d="M%.1f %.1f h%.1f a4 4 0 0 1 4 4 v%.1f a4 4 0 0 1 -4 4 h-%.1f z" fill="var(%s)">`+
|
||||
`<title>%s: %s%s</title></path>`,
|
||||
labelW, y, maxFloat(w-4, 0), barH-8, maxFloat(w-4, 0),
|
||||
cssVar(colour),
|
||||
escapeText(r.Label), escapeText(compact(r.Value)), escapeText(unitSuffix(unit)))
|
||||
|
||||
value := compact(r.Value) + unitSuffix(unit)
|
||||
title := r.Label + ": " + value
|
||||
if r.Note != "" {
|
||||
value += " " + r.Note
|
||||
value += " · " + r.Note
|
||||
}
|
||||
fmt.Fprintf(&b, `<text x="%.1f" y="%.1f" font-size="12" fill="var(%s)">%s</text>`,
|
||||
labelW+plotW+8, y+barH-2, cssVar("--muted"), escapeText(value))
|
||||
fmt.Fprintf(&b, `<div class="rk" role="listitem" title="%s">`+
|
||||
`<span class="rk-label">%s</span>`+
|
||||
`<span class="rk-track"><i class="rk-bar" style="width:%.1f%%;background:var(%s)"></i></span>`+
|
||||
`<span class="rk-value">%s</span></div>`,
|
||||
escapeText(title), escapeText(r.Label), pct, cssVar(colour), escapeText(value))
|
||||
}
|
||||
b.WriteString(`</svg></div>`)
|
||||
b.WriteString(`</div>`)
|
||||
return template.HTML(b.String()) //nolint:gosec // every interpolation is escaped above
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user