Compare commits
No commits in common. "63956de837f5cf608524df892ebfac69f63a2029" and "35b475e46f5ce3e96846fc650344532e26995f2e" have entirely different histories.
63956de837
...
35b475e46f
@ -117,8 +117,6 @@ 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
|
||||
} // }}}
|
||||
|
||||
|
9
main.go
9
main.go
@ -26,13 +26,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const VERSION = "v9"
|
||||
const VERSION = "v7"
|
||||
|
||||
var (
|
||||
logger *slog.Logger
|
||||
flagConfigFile string
|
||||
flagDev bool
|
||||
flagVersion bool
|
||||
service *ws.Service
|
||||
logFile *os.File
|
||||
parsedTemplates map[string]*template.Template
|
||||
@ -60,7 +59,6 @@ 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)
|
||||
@ -72,11 +70,6 @@ func init() { // {{{
|
||||
} // }}}
|
||||
|
||||
func main() { // {{{
|
||||
if flagVersion {
|
||||
fmt.Println(VERSION)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
werr.Init()
|
||||
|
@ -1,2 +1,6 @@
|
||||
{{ define "fonts" }}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">
|
||||
{{ end }}
|
||||
|
@ -5,18 +5,6 @@
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
{{ template "fonts" }}
|
||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/main.css">
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.2.1/dist/chart.umd.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/luxon@3.3.0/build/global/luxon.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@1.3.1"></script>
|
||||
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"chart.js": "/js/{{ .VERSION }}/lib/chartjs/index.d.ts"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="layout">
|
||||
|
@ -2,19 +2,8 @@
|
||||
{{ $version := .VERSION }}
|
||||
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/datapoints.css">
|
||||
|
||||
<script type="module" defer>
|
||||
import { DataGraph } from "/js/{{ .VERSION }}/datapoint_graph.mjs"
|
||||
const graph = new DataGraph({{ .Data.Datapoint }})
|
||||
graph.setData({{ .Data.Values }})
|
||||
graph.render('chart')
|
||||
</script>
|
||||
|
||||
{{ block "page_label" . }}{{end}}
|
||||
|
||||
<div>
|
||||
<canvas id="chart"></canvas>
|
||||
</div>
|
||||
|
||||
<div id="values">
|
||||
{{ range .Data.Values }}
|
||||
<div class="value">{{ format_time .Ts }}</div>
|
||||
|
Loading…
Reference in New Issue
Block a user