aboutsummaryrefslogtreecommitdiff
path: root/internal/server
diff options
context:
space:
mode:
Diffstat (limited to 'internal/server')
-rw-r--r--internal/server/server.go34
-rw-r--r--internal/server/templates/index.html2
2 files changed, 30 insertions, 6 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 50a41af..28b3662 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -539,7 +539,7 @@ func templateFuncs() template.FuncMap {
}
return "bg-neutral-200 dark:bg-neutral-800"
},
- "tickTooltipData": func(tick *storage.TickData, mode, timezone string) string {
+ "tickTooltipData": func(tick *storage.TickData, mode, timezone string, hidePing bool) string {
if tick == nil {
data := map[string]interface{}{"header": "No data"}
b, _ := json.Marshal(data)
@@ -586,7 +586,13 @@ func templateFuncs() template.FuncMap {
statusClass = tickStatusClass(tick.Status)
rows = append(rows,
map[string]string{"label": "Status", "value": tick.Status, "class": statusClass},
- map[string]string{"label": "Response", "value": fmt.Sprintf("%dms", tick.ResponseTime), "class": ""},
+ )
+ if !hidePing {
+ rows = append(rows,
+ map[string]string{"label": "Response", "value": fmt.Sprintf("%dms", tick.ResponseTime), "class": ""},
+ )
+ }
+ rows = append(rows,
map[string]string{"label": "Timezone", "value": fmt.Sprintf("%s (%s)", tzAbbr, utcOffset), "class": ""},
)
case "minute":
@@ -595,7 +601,13 @@ func templateFuncs() template.FuncMap {
rows = append(rows,
map[string]string{"label": "Checks", "value": fmt.Sprintf("%d", tick.TotalChecks), "class": ""},
map[string]string{"label": "Uptime", "value": fmt.Sprintf("%.1f%%", tick.UptimePercent), "class": statusClass},
- map[string]string{"label": "Avg Response", "value": fmt.Sprintf("%dms", int(tick.AvgResponse)), "class": ""},
+ )
+ if !hidePing {
+ rows = append(rows,
+ map[string]string{"label": "Avg Response", "value": fmt.Sprintf("%dms", int(tick.AvgResponse)), "class": ""},
+ )
+ }
+ rows = append(rows,
map[string]string{"label": "Timezone", "value": fmt.Sprintf("%s (%s)", tzAbbr, utcOffset), "class": ""},
)
case "hour":
@@ -604,7 +616,13 @@ func templateFuncs() template.FuncMap {
rows = append(rows,
map[string]string{"label": "Checks", "value": fmt.Sprintf("%d", tick.TotalChecks), "class": ""},
map[string]string{"label": "Uptime", "value": fmt.Sprintf("%.1f%%", tick.UptimePercent), "class": statusClass},
- map[string]string{"label": "Avg Response", "value": fmt.Sprintf("%dms", int(tick.AvgResponse)), "class": ""},
+ )
+ if !hidePing {
+ rows = append(rows,
+ map[string]string{"label": "Avg Response", "value": fmt.Sprintf("%dms", int(tick.AvgResponse)), "class": ""},
+ )
+ }
+ rows = append(rows,
map[string]string{"label": "Timezone", "value": fmt.Sprintf("%s (%s)", tzAbbr, utcOffset), "class": ""},
)
case "day":
@@ -613,7 +631,13 @@ func templateFuncs() template.FuncMap {
rows = append(rows,
map[string]string{"label": "Checks", "value": fmt.Sprintf("%d", tick.TotalChecks), "class": ""},
map[string]string{"label": "Uptime", "value": fmt.Sprintf("%.1f%%", tick.UptimePercent), "class": statusClass},
- map[string]string{"label": "Avg Response", "value": fmt.Sprintf("%dms", int(tick.AvgResponse)), "class": ""},
+ )
+ if !hidePing {
+ rows = append(rows,
+ map[string]string{"label": "Avg Response", "value": fmt.Sprintf("%dms", int(tick.AvgResponse)), "class": ""},
+ )
+ }
+ rows = append(rows,
map[string]string{"label": "Timezone", "value": fmt.Sprintf("%s (%s)", tzAbbr, utcOffset), "class": ""},
)
default:
diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html
index 62a56b4..d689416 100644
--- a/internal/server/templates/index.html
+++ b/internal/server/templates/index.html
@@ -111,7 +111,7 @@
<!-- History Bar -->
<div class="mt-3 flex gap-px">
{{range $monitor.Ticks}}
- <div class="flex-1 h-6 rounded-sm {{tickColor .}}"{{if not $monitor.DisablePingTooltips}} data-tooltip='{{tickTooltipData . $.TickMode $.Timezone}}'{{end}}></div>
+ <div class="flex-1 h-6 rounded-sm {{tickColor .}}"{{if not $monitor.DisablePingTooltips}} data-tooltip='{{tickTooltipData . $.TickMode $.Timezone $monitor.HidePing}}'{{end}}></div>
{{else}}
{{range seq $.TickCount}}
<div class="flex-1 h-6 rounded-sm bg-neutral-200 dark:bg-neutral-800"{{if not $monitor.DisablePingTooltips}} data-tooltip='{"header":"No data"}'{{end}}></div>