feat(tui,status): add per-site pause, fix viewport, polish status page
Per-site pause: [p] key toggles pause for selected monitor in TUI. Paused monitors skip checks, persist to DB, show on status page. Status page: replace full-page reload with fetch-based DOM updates to eliminate scroll-jump on refresh. Add summary bar (UP/DOWN/PAUSED counts), stale-data indicator, and fix SSL EXP CSS class bug. TUI: constrain tables to terminal width via lipgloss .Width() to prevent row wrapping that pushed header off-screen. Add MaxHeight safety net. Bump subtle style from #383838 to #565f89 for readability on dark terminals.
This commit is contained in:
@@ -162,6 +162,7 @@ func UpdateSiteConfig(site models.Site) {
|
||||
s.DNSResolveType = site.DNSResolveType
|
||||
s.DNSServer = site.DNSServer
|
||||
s.IgnoreTLS = site.IgnoreTLS
|
||||
s.Paused = site.Paused
|
||||
LiveState[site.ID] = s
|
||||
}
|
||||
}
|
||||
@@ -173,10 +174,26 @@ func RemoveSite(id int) {
|
||||
RemoveHistory(id)
|
||||
}
|
||||
|
||||
func ToggleSitePause(id int) bool {
|
||||
Mutex.Lock()
|
||||
defer Mutex.Unlock()
|
||||
site, ok := LiveState[id]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
site.Paused = !site.Paused
|
||||
LiveState[id] = site
|
||||
if site.Paused {
|
||||
AddLog(fmt.Sprintf("Monitor '%s' paused", site.Name))
|
||||
} else {
|
||||
AddLog(fmt.Sprintf("Monitor '%s' resumed", site.Name))
|
||||
}
|
||||
return site.Paused
|
||||
}
|
||||
|
||||
func monitorRoutine(id int) {
|
||||
checkByID(id)
|
||||
for {
|
||||
// If paused, just sleep loop to keep goroutine alive but idle
|
||||
if !IsEngineActive() {
|
||||
time.Sleep(5 * time.Second)
|
||||
continue
|
||||
@@ -189,6 +206,11 @@ func monitorRoutine(id int) {
|
||||
return
|
||||
}
|
||||
|
||||
if site.Paused {
|
||||
time.Sleep(5 * time.Second)
|
||||
continue
|
||||
}
|
||||
|
||||
interval := site.Interval
|
||||
if interval < 5 {
|
||||
interval = 5
|
||||
@@ -206,7 +228,7 @@ func checkByID(id int) {
|
||||
Mutex.RLock()
|
||||
site, exists := LiveState[id]
|
||||
Mutex.RUnlock()
|
||||
if !exists {
|
||||
if !exists || site.Paused {
|
||||
return
|
||||
}
|
||||
switch site.Type {
|
||||
|
||||
Reference in New Issue
Block a user