/
status.go
42 lines (38 loc) · 1.04 KB
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package httpd
import (
"bufio"
"fmt"
"io"
"net/http"
"github.com/Cloud-Foundations/Dominator/lib/html"
)
func (s state) statusHandler(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.NotFound(w, req)
return
}
writer := bufio.NewWriter(w)
defer writer.Flush()
fmt.Fprintln(writer, "<title>imaginator status page</title>")
fmt.Fprintln(writer, `<style>
table, th, td {
border-collapse: collapse;
}
</style>`)
fmt.Fprintln(writer, "<body>")
fmt.Fprintln(writer, "<center>")
fmt.Fprintln(writer, "<h1>imaginator status page</h1>")
fmt.Fprintln(writer, "</center>")
html.WriteHeaderWithRequest(writer, req)
fmt.Fprintln(writer, "<h3>")
s.writeDashboard(writer)
for _, htmlWriter := range htmlWriters {
htmlWriter.WriteHtml(writer)
}
fmt.Fprintln(writer, "</h3>")
fmt.Fprintln(writer, "<hr>")
html.WriteFooter(writer)
fmt.Fprintln(writer, "</body>")
}
func (s state) writeDashboard(writer io.Writer) {
}