2

Simplify the dashboard recent IP view

This commit is contained in:
2026-03-12 02:15:45 +01:00
parent 7bd3933215
commit a82421ba3f
8 changed files with 404 additions and 57 deletions

View File

@@ -106,6 +106,16 @@ func TestStoreRecordsEventsAndState(t *testing.T) {
if overview.TotalEvents != 1 || overview.TotalIPs != 1 {
t.Fatalf("unexpected overview counters: %+v", overview)
}
recentIPs, err := db.ListRecentIPRows(ctx, occurredAt.Add(-time.Hour), 10)
if err != nil {
t.Fatalf("list recent ip rows: %v", err)
}
if len(recentIPs) != 1 {
t.Fatalf("unexpected recent ip rows count: %d", len(recentIPs))
}
if recentIPs[0].IP != event.ClientIP || recentIPs[0].SourceName != event.SourceName || recentIPs[0].Events != 1 {
t.Fatalf("unexpected recent ip row: %+v", recentIPs[0])
}
details, err := db.GetIPDetails(ctx, event.ClientIP, 10, 10, 10)
if err != nil {
t.Fatalf("get ip details: %v", err)