Commit 89474259 authored by ale's avatar ale

Improve table formatting on debug page

parent 9b40732a
......@@ -19,7 +19,7 @@ var (
<h1>Tabacco</h1>
<p>Started at {{.StartTime}}.</p>
<p>Started at {{fmtDate .StartTime}}.</p>
<h3>Latest backups</h3>
......@@ -34,16 +34,16 @@ var (
</tr>
</thead>
<tbody>
{{range .Backups}}
<tr>
<td><b>{{.BackupID}}</b></td>
<td>{{.BackupTimestamp}}</td>
<td>{{.BackupHost}}</td>
<td colspan="2"></td>
</tr>
{{range .Datasets}}
{{range $outidx, $b := .Backups}}
{{range $idx, $d := $b.Datasets}}
<tr>
{{if eq $idx 0}}
<td><b>{{$b.BackupID}}</b></td>
<td>{{fmtDate $b.BackupTimestamp}}</td>
<td>{{$b.BackupHost}}</td>
{{else}}
<td colspan="3"></td>
{{end}}
<td>{{.DatasetID}}</td>
<td>{{.DatasetSource}}</td>
</tr>
......@@ -61,7 +61,9 @@ var (
func init() {
latestDatasetsTemplate = template.Must(
template.New("latest").Parse(latestDatasetsHTML))
template.New("latest").Funcs(map[string]interface{}{
"fmtDate": fmtDate,
}).Parse(latestDatasetsHTML))
startTime = time.Now()
}
......@@ -131,3 +133,7 @@ func (s *httpServer) handleDebug(w http.ResponseWriter, r *http.Request) {
}
io.Copy(w, &buf) // nolint
}
func fmtDate(t time.Time) string {
return t.Format(time.RFC3339)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment