fix(chart): hide component status_history in chart view
Flapping components (e.g. DIMM CPU0_C2D1 with 13 transitions) stretched table rows across several screens. The same journal events are already in Event Logs, matched by component_ref. The Reanimator export keeps the field. ADL-073. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ce60280c3
commit
ab53914d0a
3 files changed
+104
No files matched your search
@@ -70,3 +70,52 @@ func TestHandleChartCurrent_RendersEmptyViewerWithoutResult(t *testing.T) {
|
||||
t.Fatalf("expected empty chart viewer, got %q", body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleChartCurrent_HidesComponentStatusHistory(t *testing.T) {
|
||||
changedAt := time.Date(2026, 8, 12, 7, 33, 0, 0, time.UTC)
|
||||
s := New(Config{})
|
||||
s.SetResult(&models.AnalysisResult{
|
||||
SourceType: models.SourceTypeArchive,
|
||||
Filename: "example.zip",
|
||||
CollectedAt: time.Date(2026, 8, 12, 12, 0, 0, 0, time.UTC),
|
||||
Hardware: &models.HardwareConfig{
|
||||
BoardInfo: models.BoardInfo{ProductName: "SYS-TEST", SerialNumber: "SN123"},
|
||||
Memory: []models.MemoryDIMM{
|
||||
{
|
||||
Slot: "CPU0_C2D1",
|
||||
Present: true,
|
||||
SizeMB: 65536,
|
||||
SerialNumber: "SN-DIMM",
|
||||
Status: "Warning",
|
||||
StatusHistory: []models.StatusHistoryEntry{
|
||||
{Status: "Warning", ChangedAt: changedAt, Details: "history-only details"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
exported, err := currentReanimatorSnapshotBytes(s.GetResult())
|
||||
if err != nil {
|
||||
t.Fatalf("currentReanimatorSnapshotBytes() error = %v", err)
|
||||
}
|
||||
if !strings.Contains(string(exported), "status_history") {
|
||||
t.Fatalf("expected export snapshot to keep status_history")
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodGet, "/chart/current", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
s.mux.ServeHTTP(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String())
|
||||
}
|
||||
body := rec.Body.String()
|
||||
if !strings.Contains(body, "CPU0_C2D1") {
|
||||
t.Fatalf("expected DIMM row in chart, got %q", body)
|
||||
}
|
||||
if strings.Contains(body, "status_history") || strings.Contains(body, "history-only details") {
|
||||
t.Fatalf("expected status_history hidden from chart view")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user