From 5a37ffb1cfdbca104e3b47bd7e066b73efc14b2f Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 27 Dec 2023 03:18:58 +0000 Subject: [PATCH] added frequency --- data.go | 1 + list.tmpl | 6 +++--- main.go | 4 +++- table.tmpl | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/data.go b/data.go index 7d78b69..46f2716 100644 --- a/data.go +++ b/data.go @@ -46,6 +46,7 @@ type Data struct { Issues Issues Timestamp time.Time + Freq time.Duration Lasterror error } diff --git a/list.tmpl b/list.tmpl index ee62dff..2494501 100644 --- a/list.tmpl +++ b/list.tmpl @@ -20,16 +20,16 @@ pre {

GNU Taler Dashboard

Table view

List View

- Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}} + Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updating every {{.Freq}} {{ with .Lasterror }}, Last error: {{ . }} {{end}} -

+ {{ range $cat := $issues.Categories }}

{{ . }}

diff --git a/main.go b/main.go index 4b88eb7..39a269b 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ var ( fl_port = flag.String("port", ":8080", "[ip]:port to serve") fl_num = flag.Int("num", 100, "number of issues to retrieve at once") fl_min = flag.String("min", "0.9.3", "minimum version we care for") + fl_freq = flag.Duration("fr", time.Minute, "update frequency") ) func main() { @@ -47,10 +48,11 @@ func main() { data.filterId = 230 data.projectId = 23 data.minimumVersion = *fl_min + data.Freq = *fl_freq data.update() go func() { - var ticker = time.NewTicker(15 * time.Second) + var ticker = time.NewTicker(*fl_freq) for range ticker.C { select { case <-ctx.Done(): diff --git a/table.tmpl b/table.tmpl index 1d7a959..258228b 100644 --- a/table.tmpl +++ b/table.tmpl @@ -49,15 +49,15 @@ details {

GNU Taler Dashboard

List view

Table View

- Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}} + Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updateting every {{ .Freq }} {{ with .Lasterror }}, Last error: {{ . }} {{end}} {{ $issues := .Issues }} -

+