From 77cb8b493e25b29c8d79f123c197c34714645a1f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 20 Jan 2026 05:06:51 -0800 Subject: feat: Add clickable link option for monitor names --- config.example.yaml | 1 + internal/config/config.go | 1 + internal/server/server.go | 2 ++ internal/server/templates/index.html | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.example.yaml b/config.example.yaml index 9dab8b2..5ceba5f 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -80,6 +80,7 @@ groups: - name: "API" type: https target: "https://api.example.com/health" + link: "https://docs.example.com/api" # Custom link when clicking the monitor name interval: 30s timeout: 10s expected_status: 200 diff --git a/internal/config/config.go b/internal/config/config.go index dfd403a..7bad5f9 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -77,6 +77,7 @@ type MonitorConfig struct { Name string `yaml:"name"` Type string `yaml:"type"` // http, https, tcp, gemini Target string `yaml:"target"` + Link string `yaml:"link,omitempty"` // Custom URL for clicking the monitor name (e.g., docs page) Interval Duration `yaml:"interval"` Timeout Duration `yaml:"timeout"` Retries int `yaml:"retries,omitempty"` // Number of retry attempts before marking as down diff --git a/internal/server/server.go b/internal/server/server.go index 6b5ded3..af3660e 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -144,6 +144,7 @@ type GroupData struct { type MonitorData struct { Name string Type string + Link string // Custom URL for clicking the monitor name Status string StatusClass string ResponseTime int64 @@ -233,6 +234,7 @@ func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) { md := MonitorData{ Name: monCfg.Name, Type: monCfg.Type, + Link: monCfg.Link, DisablePingTooltips: monCfg.DisablePingTooltips, } diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html index 9d98b44..12bcb12 100644 --- a/internal/server/templates/index.html +++ b/internal/server/templates/index.html @@ -88,7 +88,7 @@ {{else}}
{{end}} - {{.Name}} + {{if .Link}}{{.Name}}{{else}}{{.Name}}{{end}} {{.Type}}
-- cgit v1.2.3