diff --git a/cmd/receiver/main.go b/cmd/receiver/main.go index f17006a..3bc768a 100644 --- a/cmd/receiver/main.go +++ b/cmd/receiver/main.go @@ -10,6 +10,7 @@ import ( "net/http" "os" "os/signal" + "runtime" "syscall" "time" vcms "vcms/internal" @@ -41,6 +42,7 @@ type HTMLData struct { Subtitle string Footer template.HTML Rows []rowData + RowCount int } type rowData struct { @@ -117,6 +119,7 @@ func main() { http.HandleFunc("/", rootHandler) http.HandleFunc("/dashboard", dashboardHandler) http.HandleFunc("/dashboard/full", dashboardHandler) + http.HandleFunc("/hosts", hostsHandler) http.HandleFunc("/host/", hostHandler) // Note the trailing '/'. http.HandleFunc("/api/announce", apiAnnounceHandler) http.HandleFunc("/api/ping", apiPingHandler) @@ -163,3 +166,8 @@ func shutdownHandler() { os.Exit(0) }() } + +func makeHTMLFooter() string { + return fmt.Sprintf("%s v%s (%s), built with %s, %s/%s. See %s for more info.", + vcms.AppTitle, vcms.AppVersion, vcms.AppDate, runtime.Version(), runtime.GOOS, runtime.GOARCH, vcms.ProjectURL, vcms.ProjectURL) +} diff --git a/cmd/receiver/templates/dashboard_full.gohtml b/cmd/receiver/templates/dashboard_full.gohtml index 9ca760b..0adbca1 100644 --- a/cmd/receiver/templates/dashboard_full.gohtml +++ b/cmd/receiver/templates/dashboard_full.gohtml @@ -1,7 +1,7 @@ {{ define "content" }}
-

Nodes

+

Nodes ({{ .RowCount }})

{{ if .Rows }} diff --git a/cmd/receiver/templates/dashboard_light.gohtml b/cmd/receiver/templates/dashboard_light.gohtml index ea1da2c..2468f08 100644 --- a/cmd/receiver/templates/dashboard_light.gohtml +++ b/cmd/receiver/templates/dashboard_light.gohtml @@ -1,7 +1,7 @@ {{ define "content" }}
-

Nodes

+

Nodes ({{ .RowCount }})

{{ if .Rows }}
diff --git a/cmd/receiver/templates/hosts.gohtml b/cmd/receiver/templates/hosts.gohtml new file mode 100644 index 0000000..7e5173d --- /dev/null +++ b/cmd/receiver/templates/hosts.gohtml @@ -0,0 +1,32 @@ +{{ define "content" }} +
+ +

Hosts ({{ .RowCount }})

+ + {{ if .Rows }} +
+ + + + + + + + +{{ range $index, $element := .Rows }} + + + + + +{{ end }} + +
#HostnameManage
{{ inc $index }} + {{ .Hostname }}{{ if .Errors }}{{ .Errors }}{{ end }}remove
+ + {{ else }} +

Nothing yet, sorry.

+ {{ end }} + +
+{{ end }} diff --git a/cmd/receiver/templates/layout.gohtml b/cmd/receiver/templates/layout.gohtml index 651df1e..06c53c6 100644 --- a/cmd/receiver/templates/layout.gohtml +++ b/cmd/receiver/templates/layout.gohtml @@ -29,6 +29,7 @@