Skip to content

Commit

Permalink
display last report status
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmasek committed Jan 14, 2025
1 parent 574ca91 commit c16b8c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions handlers/server_gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func handleAbout(db storage.Storage, config *conf.Config) http.HandlerFunc {
return
}
var lastReportTime, nextReportAfter string
lastReportStatus := ""
if lastReport == nil {
lastReportTime = "never"
nextReportAfter = "error"
Expand All @@ -125,6 +126,7 @@ func handleAbout(db storage.Storage, config *conf.Config) http.HandlerFunc {
In(&config.Timezone).Format(timeFormat)
} else {
lastReportTime = lastReport.Timestamp.In(&config.Timezone).Format(timeFormat)
lastReportStatus = lastReport.Status
nextReportAfter = NextReportTime(config, lastReport.Timestamp).
In(&config.Timezone).Format(timeFormat)
}
Expand All @@ -134,6 +136,7 @@ func handleAbout(db storage.Storage, config *conf.Config) http.HandlerFunc {

err = tmpl.Execute(w, map[string]any{
"lastReportTime": lastReportTime,
"lastReportStatus": lastReportStatus,
"serverTime": serverTime,
"nextReportTime": nextReportAfter,
"ReportAfter": config.ReportAfter,
Expand Down
2 changes: 1 addition & 1 deletion handlers/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h2>Beacon</h2>
<div class="block rows rows-short-labels">
<div class="row">
<span class="label">Last Report:</span>
<span class="value">{{ .lastReportTime }}</span>
<span class="value">{{ .lastReportTime }} {{ lastReportStatus }}</span>
</div>
<div class="row">
<span class="label">Current Time:</span>
Expand Down

0 comments on commit c16b8c4

Please sign in to comment.