fix(nodes): per-category client email lists behind the node count chips

NodeView carried only the category counts, so the nodes page chips
could hover to nothing but the category title. GetAll/recountByGuid
now emit online/active/disabled/depleted email lists from the same
bucketing pass as the counts (statuses gain the client email;
the online list is the counted set), and the chips pop the list
over with the inbounds page's popover pattern.
This commit is contained in:
Muse
2026-10-22 15:33:46 +00:00
parent e310abcba0
commit c91fb454a8
9 changed files with 376 additions and 45 deletions
+19 -1
View File
@@ -209,10 +209,15 @@ func (s *NodeService) recountByGuid(nodes []*model.Node, selfGuid string) {
// Classify by EMAIL (not the stale client_traffics.inbound_id) and bucket
// each client under its inbound's effective attribution GUID, deduping a
// client attached to several inbounds under the same GUID.
// client attached to several inbounds under the same GUID. The email
// lists are appended in the same pass so they stay consistent with the
// recounted tallies they annotate.
depletedByGuid := make(map[string]int)
disabledByGuid := make(map[string]int)
activeByGuid := make(map[string]int)
depletedEmailsByGuid := make(map[string][]string)
disabledEmailsByGuid := make(map[string][]string)
activeEmailsByGuid := make(map[string][]string)
if statuses, err := s.nodeClientStatuses(); err == nil {
seen := make(map[string]map[int]struct{})
for _, st := range statuses {
@@ -232,10 +237,19 @@ func (s *NodeService) recountByGuid(nodes []*model.Node, selfGuid string) {
switch {
case st.Depleted:
depletedByGuid[guid]++
if st.Email != "" {
depletedEmailsByGuid[guid] = append(depletedEmailsByGuid[guid], st.Email)
}
case st.Disabled:
disabledByGuid[guid]++
if st.Email != "" {
disabledEmailsByGuid[guid] = append(disabledEmailsByGuid[guid], st.Email)
}
default:
activeByGuid[guid]++
if st.Email != "" {
activeEmailsByGuid[guid] = append(activeEmailsByGuid[guid], st.Email)
}
}
}
}
@@ -245,8 +259,12 @@ func (s *NodeService) recountByGuid(nodes []*model.Node, selfGuid string) {
guid := effectiveNodeGuid(n, ambiguous)
n.InboundCount = inboundCountByGuid[guid]
n.OnlineCount = len(onlineByGuid[guid])
n.OnlineEmails = sortedEmailSet(onlineByGuid[guid])
n.DepletedCount = depletedByGuid[guid]
n.DisabledCount = disabledByGuid[guid]
n.ActiveCount = activeByGuid[guid]
n.DepletedEmails = depletedEmailsByGuid[guid]
n.DisabledEmails = disabledEmailsByGuid[guid]
n.ActiveEmails = activeEmailsByGuid[guid]
}
}