Skip to content

Commit

Permalink
feat(endpoint): change timestamp design in log page
Browse files Browse the repository at this point in the history
  • Loading branch information
macrat committed Nov 26, 2022
1 parent c5b601b commit 92599d3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
9 changes: 9 additions & 0 deletions internal/endpoint/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ var (
"time2str": func(t time.Time) string {
return t.Format(time.RFC3339)
},
"time2str_date": func(t time.Time) string {
return t.Format("2006-01-02")
},
"time2str_time": func(t time.Time) string {
return t.Format("15:04:05")
},
"time2str_zone": func(t time.Time) string {
return t.Format("Z07:00")
},
"time2rfc822": func(t time.Time) string {
return t.Format(time.RFC822)
},
Expand Down
14 changes: 13 additions & 1 deletion internal/endpoint/templates/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
td.healthy::before { background-color: rgb(var(--healthy)) }
td.unknown::before { background-color: rgb(var(--fg)) }

.time-t {
display: inline-block;
margin: 0 .1em;
opacity: .3;
}
.timezone {
display: inline-block;
margin-left: .1em;
font-size: 70%;
opacity: .5;
}

.latency {
text-align: right;
}
Expand Down Expand Up @@ -75,7 +87,7 @@
{{ define "log-records" }}
<tbody>{{ range .}}
<tr>
<td><time title="{{ .Time | time2humanize }}">{{ .Time | time2str }}</time></td>
<td><time title="{{ .Time | time2humanize }}">{{ .Time | time2str_date }}<span class="time-t">T</span>{{ .Time | time2str_time }}<span class="timezone">{{ .Time | time2str_zone }}</span></time></td>
<td class="status {{ .Status | to_lower }}">{{ .Status }}</td>
<td class="latency">{{ .Latency }}</td>
<td class="target">{{ .Target }}</td>
Expand Down

0 comments on commit 92599d3

Please sign in to comment.