From beccef76e8ec0987a6aa50c20a52feaa608e2cec Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 20 Apr 2024 01:27:17 +0100 Subject: [PATCH] fix: added config option for page refresh interval --- chart/values.yaml | 2 ++ internal/config/config.go | 6 +++++- internal/http/status.go | 2 ++ internal/resources/static/icon.png | Bin 0 -> 9959 bytes internal/resources/views/index.html | 3 ++- 5 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 internal/resources/static/icon.png 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 0000000000000000000000000000000000000000..5e2cea8916935ec6db55a055c77716558f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lEBjOjSwjKUqGJA`T0^;$_vTD$uANd)*ynOxB__0_| z?e&u_RR~J{a>W?>SQ8FGZR1CVuq-iSI*o9bV;otQL@}d$9%l4gWH{z7=_3S6-y%mb zqqI`wB^8*66b5pGwboODwJ>c^ZjE4!%J^6nv(5kW4bfCT7n<`T=}3Gqooj%al9pnr I0wV1H0OI0vng9R* literal 0 HcmV?d00001 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 }}