From fb11e9ba8590dfcb9ebca9d3d5070b6290cf6e91 Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Sat, 23 May 2026 11:01:34 -0400 Subject: [PATCH] fix(tui): stable monitor count and universal group icons Site count in tab label and footer now reflects total monitors (excluding groups) regardless of collapse state. Down count also computed from all sites so collapsed groups with down children still surface in the badge. Replaced Nerd Font folder glyphs with standard Unicode triangles for cross-font compatibility. --- internal/tui/tab_sites.go | 4 ++-- internal/tui/tui.go | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/internal/tui/tab_sites.go b/internal/tui/tab_sites.go index 2ece926..ac89ce1 100644 --- a/internal/tui/tab_sites.go +++ b/internal/tui/tab_sites.go @@ -29,9 +29,9 @@ func typeIcon(siteType string, collapsed bool) string { return "◆" case "group": if collapsed { - return "" + return "▶" } - return "" + return "▼" default: return "·" } diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 5ad3a06..a992ca6 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -764,8 +764,14 @@ func (m Model) View() string { } func (m Model) viewDashboard() string { + allSites := m.engine.GetAllSites() + totalMonitors := 0 downCount := 0 - for _, s := range m.sites { + for _, s := range allSites { + if s.Type == "group" { + continue + } + totalMonitors++ if !s.Paused && !m.isMonitorInMaintenance(s.ID) && (s.Status == "DOWN" || s.Status == "SSL EXP") { downCount++ } @@ -780,8 +786,8 @@ func (m Model) viewDashboard() string { var sitesLabel string if downCount > 0 { sitesLabel = fmt.Sprintf("Sites (%d↓)", downCount) - } else if len(m.sites) > 0 { - sitesLabel = fmt.Sprintf("Sites (%d)", len(m.sites)) + } else if totalMonitors > 0 { + sitesLabel = fmt.Sprintf("Sites (%d)", totalMonitors) } else { sitesLabel = "Sites" } @@ -845,12 +851,12 @@ func (m Model) viewDashboard() string { } } - upCount := len(m.sites) - downCount + upCount := totalMonitors - downCount var upStr string if downCount > 0 { - upStr = dangerStyle.Render(fmt.Sprintf("%d/%d UP", upCount, len(m.sites))) + upStr = dangerStyle.Render(fmt.Sprintf("%d/%d UP", upCount, totalMonitors)) } else { - upStr = specialStyle.Render(fmt.Sprintf("%d/%d UP", upCount, len(m.sites))) + upStr = specialStyle.Render(fmt.Sprintf("%d/%d UP", upCount, totalMonitors)) } statusParts := []string{upStr} if len(m.nodes) > 0 {