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"
"log"
"net/http"
"runtime/debug"
"sort"
"strings"
"sync"
"time"
@ -44,6 +46,7 @@ type Data struct {
ctx context.Context
Issues Issues
Features Issues
Projects Projects
Timestamp time.Time
Freq time.Duration
@ -128,14 +131,20 @@ func (d *Data) update() {
// Filter issues with old target versions out
var issues = Issues{}
var features = Issues{}
for _, issue := range iss.Issues {
if issue.Resolution.Name == "open" &&
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
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() {
@ -175,3 +184,77 @@ func (d *Data) printTemplate(w io.Writer, name string) {
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 {
color: brown;
}
h4 {
margin-left: 5%;
}
details {
margin-left: 10%;
margin-right: 10%;
margin-left: 5%;
margin-right: 5%;
}
pre {
max-width: 100%;
@ -25,15 +28,25 @@ pre {
Data from {{ .Timestamp.Format "02 Jan 06 15:04 MST"}}, updateting every {{ .Freq }} (no auto-refresh)
{{ with .Lasterror }}, Last error: {{ . }} {{end}}
<!-- p>
{{ $top := . }}
{{ $features := .Features }}
{{ $issues := .Issues }}
{{ range $issues.Tags }}
<!-- p>
{{ range $top.Tags }}
<button>{{ . }}</button>
{{ end }}
</p -->
{{ range $cat := $issues.Categories }}
{{ range $cat := $top.Categories }}
<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 }}
<details>
<summary><a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}</summary>
@ -42,6 +55,6 @@ pre {
{{ end }}
{{ end }}
<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>
</html>

View File

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