package webui import ( "encoding/json" "fmt" "html" "path/filepath" "regexp" "sort" "strconv" "strings" "bee/audit/internal/app" "bee/audit/internal/schema" ) func renderHealthCard(opts HandlerOptions) string { data, err := loadSnapshot(filepath.Join(opts.ExportDir, "runtime-health.json")) if err != nil { return `
| Check | Status | Source | Issue |
|---|---|---|---|
| ` + html.EscapeString(row.Title) + ` | ` + runtimeStatusBadge(row.Status) + ` | ` + html.EscapeString(row.Source) + ` | ` + rowIssueHTML(row.Issue) + ` |
No status data recorded yet for this component type.
`) b.WriteString(`No SAT-test history yet — showing latest inventory snapshot.
`) } sort.Slice(records, func(i, j int) bool { return records[i].ComponentKey < records[j].ComponentKey }) for _, rec := range records { letter, cls := chipLetterClass(rec.Status) // Count non-OK events across the full history for the badge + sparkline. warnCount := 0 for _, e := range rec.History { if e.Status != "OK" { warnCount++ } } fmt.Fprintf(&b, `| Time | Status | Source | Detail |
|---|---|---|---|
| %s | %s | %s | %s |