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
@@ -28,10 +28,13 @@ func TestASmallValueStillDrawsAMark(t *testing.T) {
|
||||
{Label: "huge", Value: 1_000_000},
|
||||
{Label: "tiny", Value: 1},
|
||||
}, "--viz-1", ""))
|
||||
// Two paths, one per row: the tiny one is still drawn.
|
||||
if n := strings.Count(out, "<path"); n != 2 {
|
||||
// Two bars, one per row, and the tiny one has a width.
|
||||
if n := strings.Count(out, `class="rk-bar"`); n != 2 {
|
||||
t.Errorf("drew %d marks for two rows", n)
|
||||
}
|
||||
if strings.Contains(out, "width:0.0%") {
|
||||
t.Error("the tiny value was drawn with no width")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnEmptyChartSaysSoRatherThanRenderingNothing(t *testing.T) {
|
||||
@@ -47,13 +50,8 @@ func TestChartTextUsesTextColoursNotTheSeriesColour(t *testing.T) {
|
||||
// identity. Colouring the text too makes the palette do two jobs and reads
|
||||
// badly for anyone the hue separation was chosen to protect.
|
||||
out := string(HBarChart([]Row{{Label: "a", Value: 5}}, "--viz-2", "req"))
|
||||
for _, frag := range []string{`fill="var(--fg)"`, `fill="var(--muted)"`} {
|
||||
if !strings.Contains(out, frag) {
|
||||
t.Errorf("expected text in a text colour, got:\n%s", out)
|
||||
}
|
||||
}
|
||||
if strings.Contains(out, `<text`) && strings.Contains(out, `fill="var(--viz-2)"><text`) {
|
||||
t.Error("text was painted with the series colour")
|
||||
if strings.Count(out, "var(--viz-2)") != 1 || !strings.Contains(out, `class="rk-bar"`) {
|
||||
t.Errorf("the series colour should be on the bar and nowhere else:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +62,7 @@ func TestEveryBarCarriesItsOwnHoverTitle(t *testing.T) {
|
||||
out := string(HBarChart([]Row{
|
||||
{Label: "a", Value: 1}, {Label: "b", Value: 2},
|
||||
}, "--viz-1", "tokens"))
|
||||
if n := strings.Count(out, "<title>"); n != 2 {
|
||||
if n := strings.Count(out, `title="`); n != 2 {
|
||||
t.Errorf("%d hover titles for two bars", n)
|
||||
}
|
||||
}
|
||||
@@ -72,17 +70,17 @@ func TestEveryBarCarriesItsOwnHoverTitle(t *testing.T) {
|
||||
func TestALongLabelIsTrimmedRatherThanOverflowing(t *testing.T) {
|
||||
long := strings.Repeat("a", 80) + "@example.com"
|
||||
out := string(HBarChart([]Row{{Label: long, Value: 1}}, "--viz-1", ""))
|
||||
// Trimmed where it is drawn, in full where it is hovered: the plot keeps
|
||||
// its geometry and the reader can still find out whose row it is.
|
||||
drawn := out[strings.Index(out, "<text"):strings.Index(out, "</text>")]
|
||||
if strings.Contains(drawn, long) {
|
||||
t.Error("a very long label was drawn in full and would overrun the plot")
|
||||
// Cut where it is drawn — the label cell ellipsises in CSS — and in full
|
||||
// where it is hovered, so the reader can still find out whose row it is.
|
||||
if !strings.Contains(out, `title="`+long+`: `) {
|
||||
t.Error("the full label is not available on hover")
|
||||
}
|
||||
if !strings.Contains(out, long) {
|
||||
t.Error("the full label is not available anywhere, not even on hover")
|
||||
css, err := staticFiles.ReadFile("static/base.css")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(out, "…") {
|
||||
t.Error("the label was cut without saying it had been")
|
||||
if !strings.Contains(string(css), ".ranked .rk-label { font-size: .82rem; overflow: hidden; text-overflow: ellipsis;") {
|
||||
t.Error("the label cell no longer cuts a long label with an ellipsis")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,11 +106,12 @@ func TestTheChartScalesToItsContainer(t *testing.T) {
|
||||
// The dashboard is read on laptops and phones. A fixed pixel width is how a
|
||||
// table ends up scrolling sideways.
|
||||
out := string(HBarChart([]Row{{Label: "a", Value: 1}}, "", ""))
|
||||
if !strings.Contains(out, "viewBox") {
|
||||
t.Error("no viewBox, so the chart cannot scale")
|
||||
// Bars are a share of whatever width the grid gives them, never pixels.
|
||||
if !strings.Contains(out, "width:100.0%") {
|
||||
t.Errorf("the bar is not sized as a share of its track:\n%s", out)
|
||||
}
|
||||
if strings.Contains(out, `width="720"`) {
|
||||
t.Error("a fixed pixel width was set on the chart")
|
||||
if strings.Contains(out, "px") {
|
||||
t.Error("a fixed pixel size was set on the chart")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user