From 6c2bea53657395a41b5493c381d798ac233ac139 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Mon, 10 Dec 2018 09:34:45 +0100 Subject: monfront - make fake groups in frontend It would have been nice to use rowgrouping for the node name, but somehow it wasn't easy to get the rowcount. So this should do for now. --- cmd/monfront/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cmd/monfront') diff --git a/cmd/monfront/main.go b/cmd/monfront/main.go index ec3eeb1..eaf1d94 100644 --- a/cmd/monfront/main.go +++ b/cmd/monfront/main.go @@ -172,7 +172,9 @@ func showChecks(w http.ResponseWriter, r *http.Request) { } checks = append(checks, c) } - tmpl, err := template.New("checklist").Parse(TmplCheckList) + tmpl := template.New("checklist") + tmpl.Funcs(Funcs) + tmpl, err = tmpl.Parse(TmplCheckList) if err != nil { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte("problems with a template")) @@ -318,10 +320,11 @@ var ( + {{ $current := "" }} {{ range . }} - + @@ -334,4 +337,7 @@ var ( ` TmplUnhandledGroups = `TODO` + Funcs = template.FuncMap{ + "sub": func(base, amount int) int { return base - amount }, + } ) -- cgit v1.2.3-70-g09d2
hoststatusnext checkmessage
{{ .NodeName }}{{ if ne $current .NodeName }}{{ $current = .NodeName }}{{ .NodeName }}{{ end }} {{ .CommandName }} - {{ .State }} {{ .NextTime.Format "2006.01.02 15:04:05" }}
{{ .Msg }}