2

Refine the dashboard and requests log UX

This commit is contained in:
2026-03-12 17:40:13 +01:00
parent 0a14dd1df9
commit 0dfa30973e
8 changed files with 423 additions and 180 deletions

View File

@@ -725,28 +725,35 @@ func (s *Service) decorateOverviewTopIPs(ctx context.Context, overview *model.Ov
if overview == nil {
return nil
}
ips := append(topIPRowIPs(overview.TopIPsByEvents), topIPRowIPs(overview.TopIPsByTraffic)...)
ips := append([]string{}, topIPRowIPs(overview.TopIPsByEvents)...)
ips = append(ips, topIPRowIPs(overview.TopBotIPsByEvents)...)
ips = append(ips, topIPRowIPs(overview.TopNonBotIPsByEvents)...)
ips = append(ips, topIPRowIPs(overview.TopIPsByTraffic)...)
ips = append(ips, topIPRowIPs(overview.TopBotIPsByTraffic)...)
ips = append(ips, topIPRowIPs(overview.TopNonBotIPsByTraffic)...)
investigations, err := s.store.GetInvestigationsForIPs(ctx, ips)
if err != nil {
return err
}
for index := range overview.TopIPsByEvents {
if investigation, ok := investigations[overview.TopIPsByEvents[index].IP]; ok {
overview.TopIPsByEvents[index].Bot = investigation.Bot
} else {
s.enqueueInvestigation(overview.TopIPsByEvents[index].IP)
}
}
for index := range overview.TopIPsByTraffic {
if investigation, ok := investigations[overview.TopIPsByTraffic[index].IP]; ok {
overview.TopIPsByTraffic[index].Bot = investigation.Bot
} else {
s.enqueueInvestigation(overview.TopIPsByTraffic[index].IP)
}
}
decorateTopIPRows(overview.TopIPsByEvents, investigations, s.enqueueInvestigation)
decorateTopIPRows(overview.TopBotIPsByEvents, investigations, s.enqueueInvestigation)
decorateTopIPRows(overview.TopNonBotIPsByEvents, investigations, s.enqueueInvestigation)
decorateTopIPRows(overview.TopIPsByTraffic, investigations, s.enqueueInvestigation)
decorateTopIPRows(overview.TopBotIPsByTraffic, investigations, s.enqueueInvestigation)
decorateTopIPRows(overview.TopNonBotIPsByTraffic, investigations, s.enqueueInvestigation)
return nil
}
func decorateTopIPRows(items []model.TopIPRow, investigations map[string]model.IPInvestigation, enqueue func(string)) {
for index := range items {
if investigation, ok := investigations[items[index].IP]; ok {
items[index].Bot = investigation.Bot
} else {
enqueue(items[index].IP)
}
}
}
func topIPRowIPs(items []model.TopIPRow) []string {
result := make([]string, 0, len(items))
for _, item := range items {