aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-08 15:40:27 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-08 15:48:07 +0200
commite97b06d3cef9296e9d0e827c42bccdd36b555986 (patch)
tree50b5412c21b4db8eeeb028947498f586144415c6
parenta788005625429fe22b1b55fd969e22f1864cb88e (diff)
dashboard/app: show patch testing requests on bug page
Fixes #1547
-rw-r--r--dashboard/app/admin.html58
-rw-r--r--dashboard/app/bug.html1
-rw-r--r--dashboard/app/main.go44
-rw-r--r--dashboard/app/templates.html63
4 files changed, 101 insertions, 65 deletions
diff --git a/dashboard/app/admin.html b/dashboard/app/admin.html
index edbdc9f7e..172070821 100644
--- a/dashboard/app/admin.html
+++ b/dashboard/app/admin.html
@@ -23,62 +23,6 @@ Main page.
<br><br>
{{template "manager_list" $.Managers}}
-
- <table class="list_table">
- <caption id="jobs"><a class="plain" href="#jobs">Recent jobs:</a></caption>
- <thead>
- <tr>
- <th>Bug</th>
- <th>Created</th>
- <th>Duration</th>
- <th>User</th>
- <th>Patch</th>
- <th>Repo</th>
- <th>Manager</th>
- <th>Result</th>
- </tr>
- </thead>
- <tbody>
- {{range $job := $.Jobs}}
- <tr>
- <td class="title"><a href="{{$job.BugLink}}">{{$job.BugTitle}}</a></td>
- <td class="time">{{link $job.ExternalLink (formatTime $job.Created)}}</td>
- <td class="time" title="started: {{formatTime $job.Started}}&#013;finished: {{formatTime $job.Finished}}">
- {{formatDuration $job.Duration}}{{if gt $job.Attempts 1}} ({{$job.Attempts}}){{end}}
- </td>
- <td>
- {{if eq $job.Type 0}}
- {{$job.User}}
- {{else if eq $job.Type 1}}
- bisect
- {{else if eq $job.Type 2}}
- bisect fix
- {{end}}
- </td>
- <td>{{optlink $job.PatchLink "patch"}}</td>
- <td class="kernel" title="{{$job.KernelAlias}}">{{$job.KernelAlias}}</td>
- <td title="{{$job.Namespace}}/{{$job.Reporting}}">{{$job.Manager}}</td>
- <td class="result">
- {{if $job.ErrorLink}}
- {{link $job.ErrorLink "error"}}
- {{else if $job.LogLink}}
- {{link $job.LogLink "log"}}
- ({{if $job.Commit}}1{{else}}{{len $job.Commits}}{{end}})
- {{else if $job.CrashTitle}}
- {{optlink $job.CrashReportLink "report"}}
- {{optlink $job.CrashLogLink "log"}}
- {{else if formatTime $job.Finished}}
- OK
- {{else if formatTime $job.Started}}
- running
- {{else}}
- pending
- {{end}}
- </td>
- </tr>
- {{end}}
- </tbody>
- </table>
- <br><br>
+ {{template "job_list" $.Jobs}}
</body>
</html>
diff --git a/dashboard/app/bug.html b/dashboard/app/bug.html
index e09ed7e98..96a75389e 100644
--- a/dashboard/app/bug.html
+++ b/dashboard/app/bug.html
@@ -31,6 +31,7 @@ Page with details about a single bug.
{{template "bug_list" .DupOf}}
{{template "bug_list" .Dups}}
{{template "bug_list" .Similar}}
+ {{template "job_list" .TestPatchJobs}}
{{if .SampleReport}}
<br><b>Sample crash report:</b><br>
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index 151afe91f..5bdceec24 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -63,7 +63,7 @@ type uiAdminPage struct {
Header *uiHeader
Log []byte
Managers []*uiManager
- Jobs []*uiJob
+ Jobs *uiJobList
}
type uiManager struct {
@@ -120,6 +120,7 @@ type uiBugPage struct {
SampleReport []byte
Crashes *uiCrashTable
FixBisections *uiCrashTable
+ TestPatchJobs *uiJobList
}
type uiBugGroup struct {
@@ -135,6 +136,11 @@ type uiBugGroup struct {
Bugs []*uiBug
}
+type uiJobList struct {
+ PerBug bool
+ Jobs []*uiJob
+}
+
type uiBug struct {
Namespace string
Title string
@@ -306,7 +312,7 @@ func handleAdmin(c context.Context, w http.ResponseWriter, r *http.Request) erro
Header: hdr,
Log: errorLog,
Managers: managers,
- Jobs: jobs,
+ Jobs: &uiJobList{Jobs: jobs},
}
return serveTemplate(w, "admin.html", data)
}
@@ -384,6 +390,10 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
return err
}
}
+ testPatchJobs, err := loadTestPatchJobs(c, bug)
+ if err != nil {
+ return err
+ }
data := &uiBugPage{
Header: hdr,
Now: timeNow(c),
@@ -395,6 +405,10 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
Similar: similar,
SampleReport: sampleReport,
Crashes: crashesTable,
+ TestPatchJobs: &uiJobList{
+ PerBug: true,
+ Jobs: testPatchJobs,
+ },
}
// bug.BisectFix is set to BisectNot in two cases :
// - no fix bisections have been performed on the bug
@@ -429,15 +443,10 @@ func findBugByID(c context.Context, r *http.Request) (*Bug, error) {
}
func getUIJob(c context.Context, bug *Bug, jobType JobType) (*uiJob, error) {
- job, _, jobKey, _, err := loadBisectJob(c, bug, jobType)
+ job, crash, jobKey, _, err := loadBisectJob(c, bug, jobType)
if err != nil {
return nil, err
}
- crash := new(Crash)
- crashKey := db.NewKey(c, "Crash", "", job.CrashID, bug.key(c))
- if err := db.Get(c, crashKey, crash); err != nil {
- return nil, fmt.Errorf("failed to get crash: %v", err)
- }
build, err := loadBuild(c, bug.Namespace, crash.BuildID)
if err != nil {
return nil, err
@@ -1061,6 +1070,25 @@ func loadRecentJobs(c context.Context) ([]*uiJob, error) {
return results, nil
}
+func loadTestPatchJobs(c context.Context, bug *Bug) ([]*uiJob, error) {
+ bugKey := bug.key(c)
+ var jobs []*Job
+ keys, err := db.NewQuery("Job").
+ Ancestor(bugKey).
+ Filter("Type=", JobTestPatch).
+ Filter("Finished>=", time.Time{}).
+ Order("-Finished").
+ GetAll(c, &jobs)
+ if err != nil {
+ return nil, err
+ }
+ var results []*uiJob
+ for i, job := range jobs {
+ results = append(results, makeUIJob(job, keys[i], nil, nil, nil))
+ }
+ return results, nil
+}
+
func makeUIJob(job *Job, jobKey *db.Key, bug *Bug, crash *Crash, build *Build) *uiJob {
ui := &uiJob{
Type: job.Type,
diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html
index 441b07dfe..163df1d2f 100644
--- a/dashboard/app/templates.html
+++ b/dashboard/app/templates.html
@@ -333,3 +333,66 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the
</table>
{{end}}
{{end}}
+
+
+
+{{/* List of jobs, invoked with *uiJobList */}}
+{{define "job_list"}}
+{{if $.Jobs}}
+ <table class="list_table">
+ <caption id="jobs"><a class="plain" href="#jobs">{{if $.PerBug}}Patch testing requests:{{else}}Recent jobs:{{end}}</a></caption>
+ <thead>
+ <tr>
+ {{if not $.PerBug}}<th>Bug</th>{{end}}
+ <th>Created</th>
+ <th>Duration</th>
+ <th>User</th>
+ <th>Patch</th>
+ <th>Repo</th>
+ {{if not $.PerBug}}<th>Manager</th>{{end}}
+ <th>Result</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{range $job := $.Jobs}}
+ <tr>
+ {{if not $.PerBug}}<td class="title"><a href="{{$job.BugLink}}">{{$job.BugTitle}}</a></td>{{end}}
+ <td class="time">{{link $job.ExternalLink (formatTime $job.Created)}}</td>
+ <td class="time" title="started: {{formatTime $job.Started}}&#013;finished: {{formatTime $job.Finished}}">
+ {{formatDuration $job.Duration}}{{if gt $job.Attempts 1}} ({{$job.Attempts}}){{end}}
+ </td>
+ <td>
+ {{if eq $job.Type 0}}
+ {{$job.User}}
+ {{else if eq $job.Type 1}}
+ bisect
+ {{else if eq $job.Type 2}}
+ bisect fix
+ {{end}}
+ </td>
+ <td>{{optlink $job.PatchLink "patch"}}</td>
+ <td class="kernel" title="{{$job.KernelAlias}}">{{$job.KernelAlias}}</td>
+ {{if not $.PerBug}}<td title="{{$job.Namespace}}/{{$job.Reporting}}">{{$job.Manager}}</td>{{end}}
+ <td class="result">
+ {{if $job.ErrorLink}}
+ {{link $job.ErrorLink "error"}}
+ {{else if $job.LogLink}}
+ {{link $job.LogLink "log"}}
+ ({{if $job.Commit}}1{{else}}{{len $job.Commits}}{{end}})
+ {{else if $job.CrashTitle}}
+ {{optlink $job.CrashReportLink "report"}}
+ {{optlink $job.CrashLogLink "log"}}
+ {{else if formatTime $job.Finished}}
+ OK
+ {{else if formatTime $job.Started}}
+ running
+ {{else}}
+ pending
+ {{end}}
+ </td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+{{end}}
+{{end}}