diff --git a/data.go b/data.go index 4f92795..8ee87a7 100644 --- a/data.go +++ b/data.go @@ -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 = "", "" + 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 +} diff --git a/list.tmpl b/list.tmpl index cb8d63a..6442237 100644 --- a/list.tmpl +++ b/list.tmpl @@ -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}} - - {{ range $cat := $issues.Categories }} + {{ range $cat := $top.Categories }}

{{ . }}

+

Features

+ {{ range $features.ByCategory $cat }} +
+ {{.Id}} {{.Summary}} +
{{ .Description }}
+
+ {{ end }} +

Issues

{{ range $issues.ByCategory $cat }}
{{.Id}} {{.Summary}} @@ -42,6 +55,6 @@ pre { {{ end }} {{ end }}

- end of dashboard - https://git.kesim.org/taler/taler-dashboard + taler-dashboard - version: {{.Commit}} - https://git.kesim.org/taler/taler-dashboard diff --git a/table.tmpl b/table.tmpl index 60ca873..886d466 100644 --- a/table.tmpl +++ b/table.tmpl @@ -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 }} @@ -60,7 +67,7 @@ details { - {{ range $issues.TargetVersions }} + {{ range $top.TargetVersions }} {{ end }} - {{ range $cat := $issues.Categories }} + {{ range $cat := $top.Categories }} - {{ range $tar := $issues.TargetVersions }} + {{ range $tar := $top.TargetVersions }}
{{ . }} @@ -71,13 +78,22 @@ details {
{{ . }} + {{ with $features.ByCategoryAndTarget $cat $tar }} +
+ {{ $l := len .}} {{ if lt 1 $l }} {{ $l }} features {{ else }} 1 feature {{ end }} + {{ range . }} + {{.Id}} {{.Summary}}
+ {{ end }} +
+ {{ end }} + {{ with $issues.ByCategoryAndTarget $cat $tar }} -
+
{{ $l := len .}} {{ if lt 1 $l }} {{ $l }} issues {{ else }} 1 issue {{ end }} {{ range . }} {{.Id}} {{.Summary}}
@@ -91,6 +107,6 @@ details {

- end of dashboard - https://git.kesim.org/taler/taler-dashboard + taler-dashboard - version: {{.Commit}} - https://git.kesim.org/taler/taler-dashboard