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 cdb81ce..70192db 100644 --- a/main.go +++ b/main.go @@ -26,12 +26,13 @@ import ( "time" ) -const VERSION = "v7" +const VERSION = "v9" 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() @@ -261,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, 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 }} 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 }}