Display dates as well as timestamps in status page (#7544)

* Display dates as well as timestamps in the status page

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>

* Trim trailing whitespaces

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
This commit is contained in:
Sylvain Rabot 2020-07-10 00:08:43 +02:00 committed by GitHub
parent be96951c56
commit 6a00626ee9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View file

@ -99,14 +99,14 @@
<tr>
<th>Number Of Series </th>
<th>Number of Chunks</th>
<th>Current Max Time</th>
<th>Current Min Time</th>
<th>Current Max Time</th>
</tr>
<tr>
<td scope="row">{{ .NumSeries}}</td>
<td>{{.ChunkCount}}</td>
<td>{{ .MaxTime}}</td>
<td>{{ .MinTime}}</td>
<td>{{ .MinTime | unixToTime }} ({{ .MinTime }})</td>
<td>{{ .MaxTime | unixToTime }} ({{ .MaxTime }})</td>
</tr>
</tbody>
</table>

View file

@ -982,6 +982,10 @@ func tmplFuncs(consolesPath string, opts *Options) template_text.FuncMap {
"since": func(t time.Time) time.Duration {
return time.Since(t) / time.Millisecond * time.Millisecond
},
"unixToTime": func(i int64) time.Time {
t := time.Unix(i/int64(time.Microsecond), 0).UTC()
return t
},
"consolesPath": func() string { return consolesPath },
"pathPrefix": func() string { return opts.ExternalURL.Path },
"pageTitle": func() string { return opts.PageTitle },