diff --git a/chart/values.yaml b/chart/values.yaml index 61d857a..4a3f872 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -29,6 +29,8 @@ configuration: ui: # The title of the page title: Status Page + # How often the page reloads + refresh: 30s imagePullSecrets: [] nameOverride: "" diff --git a/internal/config/config.go b/internal/config/config.go index 41b7b91..796c24d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -25,7 +25,8 @@ type Service struct { } type UI struct { - PageTitle string `yaml:"title"` + PageTitle string `yaml:"title"` + RefreshInterval time.Duration `yaml:"refresh"` } type Metrics struct { @@ -96,6 +97,9 @@ func setDefaults(conf *Config) { if conf.UI.PageTitle == "" { conf.UI.PageTitle = "PromPage" } + if conf.UI.RefreshInterval == 0 { + conf.UI.RefreshInterval = time.Second * 30 + } } func (c *Config) Validate() error { diff --git a/internal/http/status.go b/internal/http/status.go index ff8df64..4cc2e65 100644 --- a/internal/http/status.go +++ b/internal/http/status.go @@ -34,6 +34,7 @@ type statusData struct { Outage string BannerClasses string Version string + Refresh int } func (s statusData) Sprintf(format string, a ...any) string { @@ -59,6 +60,7 @@ func NewStatusPageHandler(app *app.App, cache *ResultCache) echo.HandlerFunc { Outage: op, BannerClasses: bannerClasses(op), Version: app.Version, + Refresh: int(app.Config.UI.RefreshInterval / time.Millisecond), } var buf bytes.Buffer if err := tmpl.Execute(&buf, data); err != nil { diff --git a/internal/resources/static/icon.png b/internal/resources/static/icon.png new file mode 100644 index 0000000..5e2cea8 Binary files /dev/null and b/internal/resources/static/icon.png differ diff --git a/internal/resources/views/index.html b/internal/resources/views/index.html index f085170..713c2ee 100644 --- a/internal/resources/views/index.html +++ b/internal/resources/views/index.html @@ -4,6 +4,7 @@ + {{ .Config.UI.PageTitle }} @@ -54,7 +55,7 @@

{{ .Service.Name }}