Skip to content

Commit

Permalink
dashboard/app: show when bugs are fixed and where
Browse files Browse the repository at this point in the history
  • Loading branch information
dvyukov committed Nov 6, 2017
1 parent a296166 commit 6db82ca
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dashboard/app/bug.html
Expand Up @@ -14,6 +14,8 @@
Last: {{formatTime .Bug.LastTime}}<br>
Reporting: {{if .Bug.Link}}<a href="{{.Bug.Link}}">{{.Bug.Status}}</a>{{else}}{{.Bug.Status}}{{end}}<br>
Commits: {{.Bug.Commits}}<br>
Patched on: {{.Bug.PatchedOn}}<br>
Missing on: {{.Bug.MissingOn}}<br>

<table class="list_table">
<caption>Crashes:</caption>
Expand Down
38 changes: 34 additions & 4 deletions dashboard/app/main.go
Expand Up @@ -55,6 +55,8 @@ type uiBug struct {
Status string
Link string
Commits string
PatchedOn []string
MissingOn []string
}

type uiCrash struct {
Expand Down Expand Up @@ -109,7 +111,11 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
if err != nil {
return err
}
uiBug := createUIBug(c, bug, state)
managers, err := managerList(c, bug.Namespace)
if err != nil {
return err
}
uiBug := createUIBug(c, bug, state, managers)
crashes, err := loadCrashesForBug(c, bug)
if err != nil {
return err
Expand Down Expand Up @@ -149,9 +155,17 @@ func fetchBugs(c context.Context) ([]*uiBugGroup, error) {
if err != nil {
return nil, err
}
managers := make(map[string][]string)
for ns := range config.Namespaces {
mgrs, err := managerList(c, ns)
if err != nil {
return nil, err
}
managers[ns] = mgrs
}
groups := make(map[string][]*uiBug)
for _, bug := range bugs {
uiBug := createUIBug(c, bug, state)
uiBug := createUIBug(c, bug, state, managers[bug.Namespace])
groups[bug.Namespace] = append(groups[bug.Namespace], uiBug)
}
var res []*uiBugGroup
Expand All @@ -166,7 +180,7 @@ func fetchBugs(c context.Context) ([]*uiBugGroup, error) {
return res, nil
}

func createUIBug(c context.Context, bug *Bug, state *ReportingState) *uiBug {
func createUIBug(c context.Context, bug *Bug, state *ReportingState, managers []string) *uiBug {
_, _, _, reportingIdx, status, link, err := needReport(c, "", state, bug)
if err != nil {
status = err.Error()
Expand All @@ -185,7 +199,23 @@ func createUIBug(c context.Context, bug *Bug, state *ReportingState) *uiBug {
ReportingIndex: reportingIdx,
Status: status,
Link: link,
Commits: fmt.Sprintf("%q", bug.Commits),
PatchedOn: bug.PatchedOn,
}
if len(bug.Commits) != 0 {
uiBug.Commits = fmt.Sprintf("%q", bug.Commits)
for _, mgr := range managers {
found := false
for _, mgr1 := range bug.PatchedOn {
if mgr == mgr1 {
found = true
break
}
}
if !found {
uiBug.MissingOn = append(uiBug.MissingOn, mgr)
}
}
sort.Strings(uiBug.MissingOn)
}
return uiBug
}
Expand Down
2 changes: 2 additions & 0 deletions dashboard/app/main.html
Expand Up @@ -7,6 +7,7 @@
<th>Repro</th>
<th>Last</th>
<th>Status</th>
<th>Patched</th>
</tr>
{{range $b := $.Bugs}}
<tr>
Expand All @@ -15,6 +16,7 @@
<td class="repro">{{formatReproLevel $b.ReproLevel}}</td>
<td class="time">{{formatTime $b.LastTime}}</td>
<td class="status">{{if $b.Link}}<a href="{{$b.Link}}">{{$b.Status}}</a>{{else}}{{$b.Status}}{{end}}</td>
<td class="patched">{{if $b.Commits}}{{len $b.PatchedOn}}/{{len $b.MissingOn}}{{end}}</td>
</tr>
{{end}}
</table>
Expand Down
4 changes: 4 additions & 0 deletions dashboard/app/static/style.css
Expand Up @@ -98,6 +98,10 @@ table td, table th {
max-width: 300pt;
}

.list_table .patched {
text-align: center;
}

.list_table .kernel {
width: 200pt;
max-width: 200pt;
Expand Down

0 comments on commit 6db82ca

Please sign in to comment.