seperate features from issues

This commit is contained in:
Özgür Kesim 2023-12-27 13:53:36 +01:00
parent 475fc7c257
commit 3fb0453a86
Signed by: oec
GPG Key ID: F136A7F922D018D7
3 changed files with 127 additions and 15 deletions

87
data.go
View File

@ -28,6 +28,8 @@ import (
"io" "io"
"log" "log"
"net/http" "net/http"
"runtime/debug"
"sort"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -44,6 +46,7 @@ type Data struct {
ctx context.Context ctx context.Context
Issues Issues Issues Issues
Features Issues
Projects Projects Projects Projects
Timestamp time.Time Timestamp time.Time
Freq time.Duration Freq time.Duration
@ -128,14 +131,20 @@ func (d *Data) update() {
// Filter issues with old target versions out // Filter issues with old target versions out
var issues = Issues{} var issues = Issues{}
var features = Issues{}
for _, issue := range iss.Issues { for _, issue := range iss.Issues {
if issue.Resolution.Name == "open" && if issue.Resolution.Name == "open" &&
strings.Compare(d.minimumVersion, issue.TargetVersion.Name) < 0 { strings.Compare(d.minimumVersion, issue.TargetVersion.Name) < 0 {
issues = append(issues, issue) if issue.Severity.Name == "feature" {
features = append(features, issue)
} else {
issues = append(issues, issue)
}
} }
} }
d.Issues = issues d.Issues = issues
fmt.Println("got", len(issues), "issues") d.Features = features
fmt.Println("got", len(iss.Issues), "entries: ", len(features), "features and ", len(issues), "issues")
} }
func (d *Data) Loop() { func (d *Data) Loop() {
@ -175,3 +184,77 @@ func (d *Data) printTemplate(w io.Writer, name string) {
log.Println(e) log.Println(e)
} }
} }
func (d *Data) TargetVersions() (tv []string) {
d.mux.RLock()
defer d.mux.RUnlock()
var m = map[string]bool{}
for _, s := range d.Issues.TargetVersions() {
m[s] = true
}
for _, s := range d.Features.TargetVersions() {
m[s] = true
}
for s := range m {
tv = append(tv, s)
}
sort.Strings(tv)
return
}
func (d *Data) Categories() (cs []string) {
d.mux.RLock()
defer d.mux.RUnlock()
var m = map[string]bool{}
for _, s := range d.Issues.Categories() {
m[s] = true
}
for _, s := range d.Features.Categories() {
m[s] = true
}
for s := range m {
cs = append(cs, s)
}
sort.Strings(cs)
return
}
func (d *Data) Tags() (ts []string) {
d.mux.RLock()
defer d.mux.RUnlock()
var m = map[string]bool{}
for _, s := range d.Issues.Tags() {
m[s] = true
}
for _, s := range d.Features.Tags() {
m[s] = true
}
for s := range m {
ts = append(ts, s)
}
sort.Strings(ts)
return
}
func (d *Data) Commit() string {
var version, timestamp = "<unknown>", "<unknown>"
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
switch setting.Key {
case "vcs.revision":
n := len(setting.Value)
if n > 8 {
n = 8
}
version = setting.Value[:n]
case "vcs.time":
timestamp = setting.Value
}
}
}
return version + " from " + timestamp
}

View File

@ -9,9 +9,12 @@ body {
h3 { h3 {
color: brown; color: brown;
} }
h4 {
margin-left: 5%;
}
details { details {
margin-left: 10%; margin-left: 5%;
margin-right: 10%; margin-right: 5%;
} }
pre { pre {
max-width: 100%; max-width: 100%;
@ -25,15 +28,25 @@ pre {
Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updateting every {{ .Freq }} (no auto-refresh) Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updateting every {{ .Freq }} (no auto-refresh)
{{ with .Lasterror }}, Last error: {{ . }} {{end}} {{ with .Lasterror }}, Last error: {{ . }} {{end}}
<!-- p> {{ $top := . }}
{{ $features := .Features }}
{{ $issues := .Issues }} {{ $issues := .Issues }}
{{ range $issues.Tags }} <!-- p>
{{ range $top.Tags }}
<button>{{ . }}</button> <button>{{ . }}</button>
{{ end }} {{ end }}
</p --> </p -->
{{ range $cat := $issues.Categories }} {{ range $cat := $top.Categories }}
<h3>{{ . }}</h3> <h3>{{ . }}</h3>
<h4>Features</h4>
{{ range $features.ByCategory $cat }}
<details>
<summary><a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}</summary>
<pre>{{ .Description }}</pre>
</details>
{{ end }}
<h4>Issues</h4>
{{ range $issues.ByCategory $cat }} {{ range $issues.ByCategory $cat }}
<details> <details>
<summary><a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}</summary> <summary><a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}</summary>
@ -42,6 +55,6 @@ pre {
{{ end }} {{ end }}
{{ end }} {{ end }}
<p> <p>
<i>end of dashboard - <a href="https://git.kesim.org/taler/taler-dashboard">https://git.kesim.org/taler/taler-dashboard</a> </i> <i>taler-dashboard - version: {{.Commit}} - <a href="https://git.kesim.org/taler/taler-dashboard">https://git.kesim.org/taler/taler-dashboard</a> </i>
</body> </body>
</html> </html>

View File

@ -28,11 +28,16 @@ tr:hover {
.normal { .normal {
font-weight: normal; font-weight: normal;
} }
.data { .feature {
background: #cde; background: #cde;
border-radius: 5px; border-radius: 5px;
padding: 8px; padding: 8px;
} }
.issue {
background: #edc;
border-radius: 5px;
padding: 8px;
}
details { details {
max-width: 30em; max-width: 30em;
overflow-x: auto; overflow-x: auto;
@ -50,9 +55,11 @@ details {
Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updateting every {{ .Freq }} (no auto-refresh) Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updateting every {{ .Freq }} (no auto-refresh)
{{ with .Lasterror }}, Last error: {{ . }} {{end}} {{ with .Lasterror }}, Last error: {{ . }} {{end}}
{{ $top := . }}
{{ $features := .Features }}
{{ $issues := .Issues }} {{ $issues := .Issues }}
<!--p> <!--p>
{{ range $issues.Tags }} {{ range $top.Tags }}
<button>{{ . }}</button> <button>{{ . }}</button>
{{ end }} {{ end }}
</p--> </p-->
@ -60,7 +67,7 @@ details {
<table> <table>
<tr> <tr>
<th class="side"></th> <th class="side"></th>
{{ range $issues.TargetVersions }} {{ range $top.TargetVersions }}
<th> <th>
<details> <details>
<summary>{{ . }}</summary> <summary>{{ . }}</summary>
@ -71,13 +78,22 @@ details {
</th> </th>
{{ end }} {{ end }}
</tr> </tr>
{{ range $cat := $issues.Categories }} {{ range $cat := $top.Categories }}
<tr> <tr>
<th class="side">{{ . }}</th> <th class="side">{{ . }}</th>
{{ range $tar := $issues.TargetVersions }} {{ range $tar := $top.TargetVersions }}
<td> <td>
{{ with $features.ByCategoryAndTarget $cat $tar }}
<details class="feature">
<summary>{{ $l := len .}} {{ if lt 1 $l }} {{ $l }} features {{ else }} 1 feature {{ end }} </summary>
{{ range . }}
<a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}<br>
{{ end }}
</details>
{{ end }}
{{ with $issues.ByCategoryAndTarget $cat $tar }} {{ with $issues.ByCategoryAndTarget $cat $tar }}
<details class="data"> <details class="issue">
<summary>{{ $l := len .}} {{ if lt 1 $l }} {{ $l }} issues {{ else }} 1 issue {{ end }} </summary> <summary>{{ $l := len .}} {{ if lt 1 $l }} {{ $l }} issues {{ else }} 1 issue {{ end }} </summary>
{{ range . }} {{ range . }}
<a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}<br> <a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}<br>
@ -91,6 +107,6 @@ details {
</table> </table>
<p> <p>
<i>end of dashboard - <a href="https://git.kesim.org/taler/taler-dashboard">https://git.kesim.org/taler/taler-dashboard</a> </i> <i>taler-dashboard - version: {{.Commit}} - <a href="https://git.kesim.org/taler/taler-dashboard">https://git.kesim.org/taler/taler-dashboard</a> </i>
</body> </body>
</html> </html>