fix(tui): visual polish and layout improvements #18
@@ -29,9 +29,9 @@ func typeIcon(siteType string, collapsed bool) string {
|
|||||||
return "◆"
|
return "◆"
|
||||||
case "group":
|
case "group":
|
||||||
if collapsed {
|
if collapsed {
|
||||||
return ""
|
return "▶"
|
||||||
}
|
}
|
||||||
return ""
|
return "▼"
|
||||||
default:
|
default:
|
||||||
return "·"
|
return "·"
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -764,8 +764,14 @@ func (m Model) View() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m Model) viewDashboard() string {
|
func (m Model) viewDashboard() string {
|
||||||
|
allSites := m.engine.GetAllSites()
|
||||||
|
totalMonitors := 0
|
||||||
downCount := 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") {
|
if !s.Paused && !m.isMonitorInMaintenance(s.ID) && (s.Status == "DOWN" || s.Status == "SSL EXP") {
|
||||||
downCount++
|
downCount++
|
||||||
}
|
}
|
||||||
@@ -780,8 +786,8 @@ func (m Model) viewDashboard() string {
|
|||||||
var sitesLabel string
|
var sitesLabel string
|
||||||
if downCount > 0 {
|
if downCount > 0 {
|
||||||
sitesLabel = fmt.Sprintf("Sites (%d↓)", downCount)
|
sitesLabel = fmt.Sprintf("Sites (%d↓)", downCount)
|
||||||
} else if len(m.sites) > 0 {
|
} else if totalMonitors > 0 {
|
||||||
sitesLabel = fmt.Sprintf("Sites (%d)", len(m.sites))
|
sitesLabel = fmt.Sprintf("Sites (%d)", totalMonitors)
|
||||||
} else {
|
} else {
|
||||||
sitesLabel = "Sites"
|
sitesLabel = "Sites"
|
||||||
}
|
}
|
||||||
@@ -845,12 +851,12 @@ func (m Model) viewDashboard() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
upCount := len(m.sites) - downCount
|
upCount := totalMonitors - downCount
|
||||||
var upStr string
|
var upStr string
|
||||||
if downCount > 0 {
|
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 {
|
} 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}
|
statusParts := []string{upStr}
|
||||||
if len(m.nodes) > 0 {
|
if len(m.nodes) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user