added frequency

This commit is contained in:
Gitea 2023-12-27 03:18:58 +00:00
parent 44464c9477
commit 5a37ffb1cf
4 changed files with 10 additions and 7 deletions

View File

@ -46,6 +46,7 @@ type Data struct {
Issues Issues Issues Issues
Timestamp time.Time Timestamp time.Time
Freq time.Duration
Lasterror error Lasterror error
} }

View File

@ -20,16 +20,16 @@ pre {
<h1>GNU Taler Dashboard</h1> <h1>GNU Taler Dashboard</h1>
<a href="/">Table view</a> <a href="/">Table view</a>
<h2>List View</h2> <h2>List View</h2>
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}} {{ with .Lasterror }}, Last error: {{ . }} {{end}}
<p> <!-- p>
{{ $issues := .Issues }} {{ $issues := .Issues }}
{{ range $issues.Tags }} {{ range $issues.Tags }}
<button>{{ . }}</button> <button>{{ . }}</button>
{{ end }} {{ end }}
</p> </p -->
{{ range $cat := $issues.Categories }} {{ range $cat := $issues.Categories }}
<h3>{{ . }}</h3> <h3>{{ . }}</h3>

View File

@ -36,6 +36,7 @@ var (
fl_port = flag.String("port", ":8080", "[ip]:port to serve") fl_port = flag.String("port", ":8080", "[ip]:port to serve")
fl_num = flag.Int("num", 100, "number of issues to retrieve at once") 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_min = flag.String("min", "0.9.3", "minimum version we care for")
fl_freq = flag.Duration("fr", time.Minute, "update frequency")
) )
func main() { func main() {
@ -47,10 +48,11 @@ func main() {
data.filterId = 230 data.filterId = 230
data.projectId = 23 data.projectId = 23
data.minimumVersion = *fl_min data.minimumVersion = *fl_min
data.Freq = *fl_freq
data.update() data.update()
go func() { go func() {
var ticker = time.NewTicker(15 * time.Second) var ticker = time.NewTicker(*fl_freq)
for range ticker.C { for range ticker.C {
select { select {
case <-ctx.Done(): case <-ctx.Done():

View File

@ -49,15 +49,15 @@ details {
<h1>GNU Taler Dashboard</h1> <h1>GNU Taler Dashboard</h1>
<a href="/list">List view</a> <a href="/list">List view</a>
<h2>Table View</h2> <h2>Table View</h2>
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}} {{ with .Lasterror }}, Last error: {{ . }} {{end}}
{{ $issues := .Issues }} {{ $issues := .Issues }}
<p> <!--p>
{{ range $issues.Tags }} {{ range $issues.Tags }}
<button>{{ . }}</button> <button>{{ . }}</button>
{{ end }} {{ end }}
</p> </p-->
<table> <table>
<tr> <tr>