6e95c86521
A metric that only ever reads 0 or 1 (up == 0, anything with bool) gave the line chart nothing to show: a flat line or a square wave on a y axis padded to -1..2. When every drawn series is 0/1 the incident page now draws one row per series instead, filled where the value was 1, a thin mark where it was 0, and the bare track where Prometheus returned no samples, which for these expressions means the condition did not hold. The decision is per chart, so one chart never mixes styles; any other value keeps the line chart as before. Frontend only: the endpoint already returns the points and step_seconds, which pick() now passes on so the last sample gets a width and a gap in the samples shows as a gap. Claude-Session: https://claude.ai/code/session_016mBLURvJoMuUEr9cB2RpUN
28 lines
492 B
Go
28 lines
492 B
Go
package web
|
|
|
|
import (
|
|
"io/fs"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestCopyIncidentIsEmbedded(t *testing.T) {
|
|
sub, err := fs.Sub(files, "static")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for file, want := range map[string]string{
|
|
"js/incident.js": "copyIncident",
|
|
"js/ui.js": "copy:",
|
|
"js/metricchart.js": "isBool",
|
|
} {
|
|
b, err := fs.ReadFile(sub, file)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.Contains(string(b), want) {
|
|
t.Errorf("%s lacks %s", file, want)
|
|
}
|
|
}
|
|
}
|