dashboard/app: refactor few things related to fix bisections

This commit is contained in:
Dmitry Vyukov 2019-10-04 18:02:27 +02:00
parent 671dd8203a
commit 3e1e84d48e
5 changed files with 16 additions and 19 deletions

View File

@ -38,10 +38,8 @@ Page with details about a single bug.
{{end}}
{{if .FixBisections}}
{{if .FixBisections.Crashes}}
{{template "crash_list" .FixBisections}}
{{end}}
{{end}}
{{template "crash_list" .Crashes}}
</body>

View File

@ -617,7 +617,7 @@ func TestFixBisectionsListed(t *testing.T) {
// Check the bug page and ensure that a bisection is listed out.
content, err = c.httpRequest("GET", url, "", AccessAdmin)
c.expectEQ(err, nil)
c.expectTrue(bytes.Contains(content, []byte("All fix bisections (1)")))
c.expectTrue(bytes.Contains(content, []byte("Fix bisections (1)")))
// Advance time by 30 days. No notification emails.
{

View File

@ -366,16 +366,14 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
}
crashesTable := &uiCrashTable{
Crashes: crashes,
Caption: fmt.Sprintf("All crashes (%d):", bug.NumCrashes),
Caption: fmt.Sprintf("Crashes (%d)", bug.NumCrashes),
}
hasMaintainers := false
for _, crash := range crashesTable.Crashes {
if len(crash.Maintainers) != 0 {
hasMaintainers = true
crashesTable.HasMaintainers = true
break
}
}
crashesTable.HasMaintainers = hasMaintainers
dups, err := loadDupsForBug(c, r, bug, state, managers)
if err != nil {
return err
@ -418,9 +416,11 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
if err != nil {
return err
}
if len(fixBisections) != 0 {
data.FixBisections = &uiCrashTable{
Crashes: fixBisections,
Caption: fmt.Sprintf("All fix bisections (%d):", len(fixBisections)),
Caption: fmt.Sprintf("Fix bisections (%v)", len(fixBisections)),
}
}
}
return serveTemplate(w, "bug.html", data)

View File

@ -929,14 +929,13 @@ func queryCrashForJob(c context.Context, job *Job, bugKey *db.Key) (*Crash, erro
}
// Now, create a crash object with the crash details from the job.
ret := &Crash{
Manager: crash.Manager,
Time: job.Finished,
Maintainers: nil,
Log: job.Log,
Report: job.CrashReport,
ReproOpts: crash.ReproOpts,
ReproSyz: crash.ReproSyz,
ReproC: crash.ReproC,
ReportLen: 0,
}
return ret, nil
}

View File

@ -290,7 +290,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the
{{define "crash_list"}}
{{if .}}
<table class="list_table">
<caption>{{.Caption}}</caption>
<caption>{{.Caption}}:</caption>
<thead>
<tr>
<th><a onclick="return sortTable(this, 'Manager', textSort)" href="#">Manager</a></th>