diff --git a/data.go b/data.go index 1bc5042..1e1c59c 100644 --- a/data.go +++ b/data.go @@ -41,6 +41,7 @@ type Data struct { token string num int projectId int + filterId int minimumVersion string tmpl *template.Template ctx context.Context @@ -60,15 +61,7 @@ func NewData(ctx context.Context, url, token string, num int) *Data { ctx: ctx, num: num, } - fm := map[string]any{ - "shorten": func(max int, s string) string { - if len(s) <= max { - return s - } - return s[:max] + "⋯" - }, - } - data.tmpl = template.Must(template.New("index").Funcs(fm).ParseFS(content, "*.tmpl")) + data.tmpl = template.Must(template.New("index").ParseFS(content, "*.tmpl")) return data } @@ -126,11 +119,10 @@ func (d *Data) getProject() { d.Timestamp = time.Now() d.Project = project - log.Println("Got project details for id", d.projectId, "with", len(d.Project.Versions), "version entries") + log.Println("Got project details for id", d.projectId, + "with", len(d.Project.Versions), "version entries") } -const statusFilter = `status%5B%5D=10&status%5B%5D=20&status%5B%5D=30&status%5B%5D=40&status%5B%5D=50&severity%5B%5D=20` - var fields = []string{"id", "description", "summary", @@ -149,9 +141,12 @@ var fields = []string{"id", } func (d *Data) getIssues() { - url := fmt.Sprintf("%s/issues?project_id=%d&page_size=%d&%s&select=%s", - d.url, d.projectId, d.num, statusFilter, - strings.Join(fields, ",")) + url := fmt.Sprintf("%s/issues?project_id=%d&filter_id=%d&select=%s&page_size=%d", + d.url, + d.projectId, + d.filterId, + strings.Join(fields, ","), + d.num) req, e := http.NewRequestWithContext(d.ctx, "GET", url, nil) if nil != e { d.mux.Lock() @@ -202,7 +197,11 @@ func (d *Data) getIssues() { } d.Issues = issues d.Features = features - log.Println("Got", len(iss.Issues), "entries, of which", open, "are open and relevant:", len(features), "features and", len(issues), "issues") + log.Println("Got", + len(iss.Issues), "entries, of which", + open, "are open and relevant:", + len(features), "features and", + len(issues), "issues") } func (d *Data) Loop() { diff --git a/main.go b/main.go index 93b1e9b..df6e760 100644 --- a/main.go +++ b/main.go @@ -31,13 +31,14 @@ import ( ) var ( - fl_url = flag.String("url", "https://bugs.gnunet.org/api/rest", "URL to the issues") - fl_token = flag.String("token", os.Getenv("MANTIS_API_TOKEN"), "API-Token") - fl_port = flag.String("port", ":8080", "[ip]:port to serve") - fl_num = flag.Int("num", 250, "number of issues to retrieve at once") - fl_min = flag.String("min", "0.9.1", "minimum version we care for") - fl_freq = flag.Duration("fr", 30*time.Minute, "update frequency") - fl_proj = flag.Int("project", 23, "project id to use") + fl_url = flag.String("url", "https://bugs.gnunet.org/api/rest", "URL to the issues") + fl_token = flag.String("token", os.Getenv("MANTIS_API_TOKEN"), "API-Token") + fl_port = flag.String("port", ":8080", "[ip]:port to serve") + fl_num = flag.Int("num", 250, "number of issues to retrieve at once") + fl_min = flag.String("min", "0.9.1", "minimum version we care for") + fl_freq = flag.Duration("fr", 30*time.Minute, "update frequency") + fl_proj = flag.Int("project", 23, "project id to use") + fl_filter = flag.Int("filter", 229, "filter id to apply for search") ) func main() { @@ -47,6 +48,7 @@ func main() { var ctx = context.Background() var data = NewData(ctx, *fl_url, *fl_token, *fl_num) data.projectId = *fl_proj + data.filterId = *fl_filter data.minimumVersion = *fl_min data.Freq = *fl_freq diff --git a/table.tmpl b/table.tmpl index 63fa082..cdadc66 100644 --- a/table.tmpl +++ b/table.tmpl @@ -63,20 +63,22 @@ details.version {
- {{- range $top.TargetVersions }} + {{- range $vname := $top.TargetVersions }} + {{- with $version := $versions.Get . }} |
- {{- $version := $versions.Get . }}
-
{{ . }} ({{ $version.Timestamp.Format "02 Jan 06"}})-{{$version.Description }}
+ {{ $vname }} ({{ $version.Timestamp.Format "02 Jan 06"}})+{{ $version.Description }}
|
{{- end}}
+ {{- end}}
---|---|
{{ . }} | {{- range $tar := $top.TargetVersions }} + {{- with $version := $versions.Get . }}{{ with $features.ByCategoryAndTarget $cat $tar }}
{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} features{{ else }}1 feature{{ end }}@@ -93,6 +95,7 @@ details.version { | {{ end }}
+ {{ end }}