Show check-type usage and stats on the target groups dashboard page

Each target group's relationship to the check types that reference it was
previously invisible without cross-referencing /check-types by hand.
handleTargetsPage/renderTargetsTable now resolve that server-side via
loadTargetsPage (group -> referencing check types, enabled or not) and
render it as a status pill per group, plus a stats row (group count,
total targets, check types using them, unused groups) kept live via an
out-of-band swap on every create/update/delete.

Also auto-sizes the targets textarea as you type (targets.html), and
lets the stat-card grid collapse to however many state cards actually
exist instead of leaving empty background where a fixed repeat(6, ...)
had no card to fill.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5 committed 2026-09-18 10:52:27 +03:00
1 parent 95f8066eed
commit 792b7fbb84
4 files changed
+244 -18

No files matched your search

+18
View File
@@ -114,6 +114,24 @@ var funcMap = template.FuncMap{
"deref": derefStr,
"join": strings.Join,
"joinInts": joinInts,
"pluralAddr": pluralAddr,
}
// pluralAddr returns the correctly declined Russian word for "address"
// (адрес/адреса/адресов) for the given count — standard count%10/count%100
// rule, with the usual 11-14 exception.
func pluralAddr(n int) string {
if n%100 >= 11 && n%100 <= 14 {
return "адресов"
}
switch n % 10 {
case 1:
return "адрес"
case 2, 3, 4:
return "адреса"
default:
return "адресов"
}
}
func parseTemplates() (*template.Template, error) {