diff options
| author | Fuwn <[email protected]> | 2026-01-20 05:35:34 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-20 05:35:34 -0800 |
| commit | c889e599b2c27e2966a5b46817d7fa3f397bcd74 (patch) | |
| tree | fb107570f7defc8dba0dd8f3eea09e3db15af5bb | |
| parent | fix: Add database type to config validation (diff) | |
| download | kaze-c889e599b2c27e2966a5b46817d7fa3f397bcd74.tar.xz kaze-c889e599b2c27e2966a5b46817d7fa3f397bcd74.zip | |
feat: Add hide_ping option to hide response time
| -rw-r--r-- | ideas.md | 1 | ||||
| -rw-r--r-- | internal/config/config.go | 1 | ||||
| -rw-r--r-- | internal/server/server.go | 2 | ||||
| -rw-r--r-- | internal/server/templates/index.html | 2 |
4 files changed, 4 insertions, 2 deletions
@@ -45,7 +45,6 @@ - Alert escalation policies ### Monitor Types -- Database connection monitoring - Custom script/command execution - WebSocket monitoring diff --git a/internal/config/config.go b/internal/config/config.go index 9cc9eac..b819d8f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -88,6 +88,7 @@ type MonitorConfig struct { ExpectedContent string `yaml:"expected_content,omitempty"` // Expected text in response body VerifySSL *bool `yaml:"verify_ssl,omitempty"` HideSSLDays bool `yaml:"hide_ssl_days,omitempty"` // Hide SSL days left from display + HidePing bool `yaml:"hide_ping,omitempty"` // Hide response time from display RoundResponseTime bool `yaml:"round_response_time,omitempty"` // Round response time to nearest second RoundUptime bool `yaml:"round_uptime,omitempty"` // Round uptime percentage (e.g., 99.99% → 100%) DisablePingTooltips bool `yaml:"disable_ping_tooltips,omitempty"` // Disable hover tooltips on ping history bars diff --git a/internal/server/server.go b/internal/server/server.go index ab1ca4c..50a41af 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -149,6 +149,7 @@ type MonitorData struct { Status string StatusClass string ResponseTime int64 + HidePing bool // Hide response time from display UptimePercent float64 Ticks []*storage.TickData // Aggregated tick data for history bar SSLDaysLeft int @@ -237,6 +238,7 @@ func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) { Name: monCfg.Name, Type: monCfg.Type, Link: template.URL(monCfg.Link), + HidePing: monCfg.HidePing, DisablePingTooltips: monCfg.DisablePingTooltips, } diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html index 0e36c16..62a56b4 100644 --- a/internal/server/templates/index.html +++ b/internal/server/templates/index.html @@ -95,7 +95,7 @@ <span class="text-xs px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 uppercase">{{.Type}}</span> </div> <div class="flex items-center gap-4 text-xs text-neutral-500 dark:text-neutral-400"> - <span>{{formatDuration .ResponseTime}}</span> + {{if not .HidePing}}<span>{{formatDuration .ResponseTime}}</span>{{end}} {{if gt .SSLDaysLeft 0}} <span class="{{if lt .SSLDaysLeft 14}}text-yellow-600 dark:text-yellow-400{{else if lt .SSLDaysLeft 7}}text-red-600 dark:text-red-400{{end}}" data-tooltip='{{.SSLTooltip}}'>SSL: {{.SSLDaysLeft}}d</span> {{end}} |