From 787009c621e17230febd9e38e172c99b2da0009c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 20 May 2024 13:18:40 +0200 Subject: [PATCH 1/5] Removed fonts --- views/components/head_fonts.gotmpl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/views/components/head_fonts.gotmpl b/views/components/head_fonts.gotmpl index 18be2a7..b6c0f89 100644 --- a/views/components/head_fonts.gotmpl +++ b/views/components/head_fonts.gotmpl @@ -1,6 +1,2 @@ {{ define "fonts" }} - - - - {{ end }} From ff1c848c584e6526fece62b9e2acb8a79405c4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 20 May 2024 13:19:22 +0200 Subject: [PATCH 2/5] Bumped to v8 --- main.go | 2 +- views/layouts/main.gotmpl | 12 ++++++++++++ views/pages/datapoint_values.gotmpl | 11 +++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index cdb81ce..5a635fe 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ import ( "time" ) -const VERSION = "v7" +const VERSION = "v8" var ( logger *slog.Logger diff --git a/views/layouts/main.gotmpl b/views/layouts/main.gotmpl index 741061b..f6cbe97 100644 --- a/views/layouts/main.gotmpl +++ b/views/layouts/main.gotmpl @@ -5,6 +5,18 @@ {{ template "fonts" }} + + + + + +
diff --git a/views/pages/datapoint_values.gotmpl b/views/pages/datapoint_values.gotmpl index fe4651c..f568b95 100644 --- a/views/pages/datapoint_values.gotmpl +++ b/views/pages/datapoint_values.gotmpl @@ -2,8 +2,19 @@ {{ $version := .VERSION }} + + {{ block "page_label" . }}{{end}} +
+ +
+
{{ range .Data.Values }}
{{ format_time .Ts }}
From 7724c742ad8dfc1f80d41df3aab70afc622164fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 20 May 2024 13:21:22 +0200 Subject: [PATCH 3/5] Version parameter --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 5a635fe..e191dd5 100644 --- a/main.go +++ b/main.go @@ -32,6 +32,7 @@ var ( logger *slog.Logger flagConfigFile string flagDev bool + flagVersion bool service *ws.Service logFile *os.File parsedTemplates map[string]*template.Template @@ -59,6 +60,7 @@ func init() { // {{{ cfgPath := path.Join(confDir, "smon.yaml") flag.StringVar(&flagConfigFile, "config", cfgPath, "Path and filename of the YAML configuration file") flag.BoolVar(&flagDev, "dev", false, "reload templates on each request") + flag.BoolVar(&flagVersion, "version", false, "Display version and exit") flag.Parse() componentFilenames, err = getComponentFilenames(viewFS) @@ -70,6 +72,11 @@ func init() { // {{{ } // }}} func main() { // {{{ + if flagVersion { + fmt.Println(VERSION) + os.Exit(0) + } + var err error werr.Init() From e4dbabfea5b2a40c41dcd9342f1624c2490e882b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 20 May 2024 18:57:47 +0200 Subject: [PATCH 4/5] Fixed last updated value on datapoints --- datapoint.go | 2 ++ main.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/datapoint.go b/datapoint.go index 055c7a3..f02dfb8 100644 --- a/datapoint.go +++ b/datapoint.go @@ -117,6 +117,8 @@ func DatapointAdd[T any](name string, value T) (err error) { // {{{ return } + service.Db.Conn.Exec(`UPDATE datapoint SET last_value = NOW() WHERE name=$1`, name) + return } // }}} diff --git a/main.go b/main.go index e191dd5..762ae72 100644 --- a/main.go +++ b/main.go @@ -268,7 +268,7 @@ func entryDatapoint(w http.ResponseWriter, r *http.Request, sess *session.T) { / WHERE service=$1 AND prio=$2 - `, + `, (*notificationService).GetType(), (*notificationService).GetPrio(), problemID, From 63956de837f5cf608524df892ebfac69f63a2029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 20 May 2024 18:58:17 +0200 Subject: [PATCH 5/5] Bumped to v9 --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 762ae72..70192db 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ import ( "time" ) -const VERSION = "v8" +const VERSION = "v9" var ( logger *slog.Logger