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
Timestamp time.Time
Freq time.Duration
Lasterror error
}

View File

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

View File

@ -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():

View File

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