feat(tui): add monitor groups with collapse/expand and tree view

Groups act as visual organizers in the sites table. Monitors can be
assigned to a parent group via the form. Group rows show aggregated
worst-child status, children render with tree chars (├/└), and Space
toggles collapse/expand. Group form hides irrelevant connection and
advanced sections.
This commit is contained in:
2026-05-14 21:15:34 -04:00
parent cfcd71dabe
commit c480f519c4
3 changed files with 164 additions and 16 deletions
+39 -1
View File
@@ -243,7 +243,7 @@ func checkByID(id int) {
case "dns":
checkDNS(site)
case "group":
// groups don't perform checks
checkGroup(site)
}
}
@@ -437,6 +437,44 @@ func checkPort(site models.Site) {
handleStatusChange(updatedSite, "UP", 0, latency)
}
func checkGroup(site models.Site) {
Mutex.RLock()
status := "UP"
hasChildren := false
allPaused := true
for _, child := range LiveState {
if child.ParentID != site.ID || child.Type == "group" {
continue
}
hasChildren = true
if !child.Paused {
allPaused = false
}
if child.Paused {
continue
}
if child.Status == "DOWN" || child.Status == "SSL EXP" {
status = "DOWN"
} else if child.Status == "PENDING" && status != "DOWN" {
status = "PENDING"
}
}
Mutex.RUnlock()
if !hasChildren {
status = "PENDING"
}
Mutex.Lock()
s := LiveState[site.ID]
s.Status = status
if hasChildren && allPaused {
s.Paused = true
}
LiveState[site.ID] = s
Mutex.Unlock()
}
func checkDNS(site models.Site) {
host := site.Hostname
if host == "" {