This commit is contained in:
2026-02-14 17:13:09 +01:00
parent ee8650a41c
commit 85aa518208
2 changed files with 99 additions and 2 deletions
+13
View File
@@ -158,6 +158,13 @@ func (s *Server) loadTemplates() {
}
return fmt.Sprintf("%.2f GB", gb)
},
"subtract": func(a, b int) int {
r := a - b
if r < 0 {
return 0
}
return r
},
}
s.tmpl = template.Must(template.New("").Funcs(funcMap).Parse(allTemplates))
@@ -422,6 +429,11 @@ func (s *Server) deployHandler(w http.ResponseWriter, _ *http.Request, name stri
percent = afterReqMB * 100 / usableMB
}
committedPercent := 0
if usableMB > 0 {
committedPercent = committedReqMB * 100 / usableMB
}
memInfo["Available"] = true
memInfo["TotalMB"] = totalMB
memInfo["ReservedMB"] = reservedMB
@@ -430,6 +442,7 @@ func (s *Server) deployHandler(w http.ResponseWriter, _ *http.Request, name stri
memInfo["NewRequestMB"] = newReqMB
memInfo["AfterMB"] = afterReqMB
memInfo["Percent"] = percent
memInfo["CommittedPercent"] = committedPercent
memInfo["Blocked"] = newReqMB > 0 && afterReqMB > usableMB
memInfo["OvercommitWarn"] = newLimitMB > 0 && afterLimitMB > totalMB
}