add information about assignment status

This commit is contained in:
Özgür Kesim 2023-12-28 17:03:33 +01:00
parent ba0d009881
commit 2f6c7f2a7d
Signed by: oec
GPG Key ID: F136A7F922D018D7
3 changed files with 149 additions and 94 deletions

View File

@ -36,7 +36,7 @@ type Issue struct {
Category KeyVal
TargetVersion KeyVal `json:"target_version"`
Reporter KeyVal
handler KeyVal
Handler KeyVal
Status KeyVal
Resolution KeyVal
ViewState KeyVal `json:"view_state"`
@ -103,6 +103,15 @@ func (b ByCategory) Less(i, j int) bool {
}
func (b ByCategory) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ByAssignment []Issue
func (b ByAssignment) Len() int { return len(b) }
func (b ByAssignment) Less(i, j int) bool {
return strings.Compare(b[i].Handler.Name, b[j].Handler.Name) < 0
}
func (b ByAssignment) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ById []Issue
func (b ById) Len() int { return len(b) }
@ -117,6 +126,19 @@ func (b ByTarget) Less(i, j int) bool {
}
func (b ByTarget) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
type ByHandlerAndId []Issue
func (b ByHandlerAndId) Len() int { return len(b) }
func (b ByHandlerAndId) Less(i, j int) bool {
if (b[i].Handler.Name == "") == (b[j].Handler.Name == "") {
return b[i].Id < b[j].Id
} else if b[i].Handler.Name == "" {
return true
}
return false
}
func (b ByHandlerAndId) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
func (i Issues) Tags() (tags []string) {
var m = map[string]bool{}
for _, issue := range i {
@ -131,6 +153,19 @@ func (i Issues) Tags() (tags []string) {
return
}
func (is Issues) Assigned(assigned bool) (n int) {
for _, i := range is {
if assigned == (i.Handler.Name != "") {
n += 1
}
}
return n
}
func (i *Issue) IsHandled() bool {
return i.Handler.Name != ""
}
func (i Issues) TargetVersions() (targets []string) {
var m = map[string]bool{}
for _, issue := range i {
@ -164,7 +199,7 @@ func (i Issues) ByCategory(cat string) (issues Issues) {
issues = append(issues, issue)
}
}
sort.Sort(ById(issues))
sort.Sort(sort.Reverse(ByHandlerAndId(issues)))
return issues
}
@ -175,6 +210,6 @@ func (i Issues) ByCategoryAndTarget(cat, tar string) (issues Issues) {
issues = append(issues, is)
}
}
sort.Sort(ById(issues))
sort.Sort(sort.Reverse(ByHandlerAndId(issues)))
return
}

View File

@ -42,14 +42,18 @@ pre {
<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>
<summary>
{{ if .IsHandled }}<span title="assigned to {{.Handler.Name}}">🥷</span>{{else}}<span title="unassigned">❓</span>{{end}}
<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>
<summary>
{{ if .IsHandled }}<span title="assigned to {{.Handler.Name}}">🥷</span>{{else}}<span title="unassigned">❓</span>{{end}}
<a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}</summary>
<pre>{{ .Description }}</pre>
</details>
{{ end -}}

View File

@ -23,10 +23,10 @@ th.side {
text-align: right;
}
tr:hover {
background: #efe;
background: #efefef;
}
.feature {
background: #cde;
background: #cdf;
}
.issue {
background: #edc;
@ -34,6 +34,16 @@ tr:hover {
.minh {
min-height: 5em;
}
summary {
display: flex;
justify-content: space-between;
align-items: center;
gap: 5px;
}
.assignment {
font-size: smaller;
color: grey;
}
details {
max-width: 50vw;
border-radius: 5px;
@ -97,16 +107,22 @@ details[open].issue {
{{- with $version := $versions.Get . }}
<td><div class="minh">{{ with $features.ByCategoryAndTarget $cat $tar }}
<details class="feature">
<summary>{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} features{{ else }}1 feature{{ end }}</summary>
<summary>{{ $l := len .}}{{ if lt 1 $l }}{{ $l }} features{{ else }}1 feature{{ end }}
{{- $unassigned := .Assigned false }}{{if gt $unassigned 0 }} <span class="assignment">({{ $unassigned}} unassigned)</span>{{ end -}}
</summary>
{{- range . }}
{{ if .IsHandled }}<span title="assigned to {{.Handler.Name}}">🥷</span>{{else}}<span title="unassigned">❓</span>{{end}}
<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="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 }}
{{- $unassigned := .Assigned false }}{{if gt $unassigned 0 }} <span class="assignment">({{ $unassigned}} unassigned)</span>{{ end -}}
</summary>
{{- range . }}
{{ if .IsHandled }}<span title="assigned to {{.Handler.Name}}">🥷</span>{{else}}<span title="unassigned">❓</span>{{end}}
<a href="https://bugs.gnunet.org/view.php?id={{.Id}}" target="_blank">{{.Id}}</a> {{.Summary}}<br>{{end}}
</details>
{{ end -}}