Skip to content
Permalink
Browse files

dashboard/app: show managers per namespaces

End users are interested for managers only for a single namespace.
So show them per-namespace.
  • Loading branch information...
dvyukov committed Nov 22, 2018
1 parent 79d9c31 commit 97aa259615d7b50a18f9b32a99d6dad9ffbb5cab
Showing with 72 additions and 55 deletions.
  1. +14 −2 dashboard/app/main.go
  2. +2 −53 dashboard/app/main.html
  3. +56 −0 dashboard/app/templates.html
@@ -44,6 +44,7 @@ type uiMain struct {
}

type uiManager struct {
Now time.Time
Namespace string
Name string
Link string
@@ -86,6 +87,7 @@ type uiBugNamespace struct {
Caption string
FixedLink string
FixedCount int
Managers []*uiManager
Groups []*uiBugGroup
}

@@ -162,9 +164,9 @@ func handleMain(c context.Context, w http.ResponseWriter, r *http.Request) error
var errorLog []byte
var managers []*uiManager
var jobs []*uiJob
accessLevel := accessLevel(c, r)
if r.FormValue("fixed") == "" {
var err error
accessLevel := accessLevel(c, r)
managers, err = loadManagers(c, accessLevel)
if err != nil {
return err
@@ -184,14 +186,23 @@ func handleMain(c context.Context, w http.ResponseWriter, r *http.Request) error
if err != nil {
return err
}
for _, ns := range bugNamespaces {
for _, mgr := range managers {
if ns.Name == mgr.Namespace {
ns.Managers = append(ns.Managers, mgr)
}
}
}
data := &uiMain{
Header: commonHeader(c, r),
Now: timeNow(c),
Log: errorLog,
Managers: managers,
Jobs: jobs,
BugNamespaces: bugNamespaces,
}
if accessLevel == AccessAdmin {
data.Managers = managers
}
return serveTemplate(w, "main.html", data)
}

@@ -757,6 +768,7 @@ func loadManagers(c context.Context, accessLevel AccessLevel) ([]*uiManager, err
link = ""
}
results = append(results, &uiManager{
Now: timeNow(c),
Namespace: mgr.Namespace,
Name: mgr.Name,
Link: link,
@@ -24,59 +24,7 @@
<br><br>
{{end}}

{{if $.Managers}}
<table class="list_table">
<caption id="managers"><a class="plain" href="#managers">Managers:</a></caption>
<tr>
<th>Name</th>
<th>Active</th>
<th>Uptime</th>
<th>Build</th>
<th>Kernel</th>
<th>Syzkaller</th>
<th>Corpus</th>
<th>Coverage</th>
<th>Crashes</th>
<th>Execs</th>
<th>Failed Build</th>
</tr>
{{range $mgr := $.Managers}}
<tr>
<td>
{{if $mgr.Link}}<a href="{{$mgr.Link}}">{{end}}
{{$mgr.Namespace}}/{{$mgr.Name}}
{{if $mgr.Link}}</a>{{end}}
</td>
<td class="stat {{if $mgr.LastActiveBad}}bad{{end}}">{{formatLateness $.Now $mgr.LastActive}}</td>
<td class="stat">{{formatDuration $mgr.CurrentUpTime}}</td>
{{if $mgr.CurrentBuild}}
<td class="stat">{{formatLateness $.Now $mgr.CurrentBuild.Time}}</td>
<td class="stat" title="{{$mgr.CurrentBuild.KernelAlias}} {{$mgr.CurrentBuild.KernelCommit}}
{{formatTime $mgr.CurrentBuild.KernelCommitDate}}">{{formatShortHash $mgr.CurrentBuild.KernelCommit}}</td>
<td class="stat" title="{{$mgr.CurrentBuild.SyzkallerCommit}}">{{formatShortHash $mgr.CurrentBuild.SyzkallerCommit}}</td>
{{else}}
<td></td>
<td></td>
<td></td>
{{end}}
<td class="stat">{{formatStat $mgr.MaxCorpus}}</td>
<td class="stat">
{{if $mgr.CoverLink}}
<a href="{{$mgr.CoverLink}}" target="_blank">
{{end}}
{{formatStat $mgr.MaxCover}}
{{if $mgr.CoverLink}}
</a>
{{end}}
</td>
<td class="stat">{{formatStat $mgr.TotalCrashes}}</td>
<td class="stat">{{formatStat $mgr.TotalExecs}}</td>
<td class="stat">{{if $mgr.FailedBuildBugLink}}<a href="{{$mgr.FailedBuildBugLink}}" class="bad">bug</a>{{end}}</td>
</tr>
{{end}}
</table>
<br><br>
{{end}}
{{template "manager_list" $.Managers}}

{{if $.Jobs}}
<table class="list_table">
@@ -132,6 +80,7 @@
{{if $ns.FixedLink}}
<a href="{{$ns.FixedLink}}">fixed bugs ({{$ns.FixedCount}})</a>
{{end}}
{{template "manager_list" $ns.Managers}}
{{range $group := $ns.Groups}}
{{template "bug_list" $group}}
{{end}}
@@ -102,3 +102,59 @@ <h1><a href="/">syzbot</a></h1>
{{end}}
{{end}}
{{end}}

{{/* List of managers, invoked with []*uiManager */}}
{{define "manager_list"}}
{{if .}}
<table class="list_table">
<caption id="managers"><a class="plain" href="#managers">Managers:</a></caption>
<tr>
<th>Name</th>
<th>Active</th>
<th>Uptime</th>
<th>Build</th>
<th>Kernel</th>
<th>Syzkaller</th>
<th>Corpus</th>
<th>Coverage</th>
<th>Crashes</th>
<th>Execs</th>
<th>Failed Build</th>
</tr>
{{range $mgr := .}}
<tr>
<td>
{{if $mgr.Link}}<a href="{{$mgr.Link}}">{{end}}
{{$mgr.Namespace}}/{{$mgr.Name}}
{{if $mgr.Link}}</a>{{end}}
</td>
<td class="stat {{if $mgr.LastActiveBad}}bad{{end}}">{{formatLateness $mgr.Now $mgr.LastActive}}</td>
<td class="stat">{{formatDuration $mgr.CurrentUpTime}}</td>
{{if $mgr.CurrentBuild}}
<td class="stat">{{formatLateness $mgr.Now $mgr.CurrentBuild.Time}}</td>
<td class="stat" title="{{$mgr.CurrentBuild.KernelAlias}} {{$mgr.CurrentBuild.KernelCommit}}
{{formatTime $mgr.CurrentBuild.KernelCommitDate}}">{{formatShortHash $mgr.CurrentBuild.KernelCommit}}</td>
<td class="stat" title="{{$mgr.CurrentBuild.SyzkallerCommit}}">{{formatShortHash $mgr.CurrentBuild.SyzkallerCommit}}</td>
{{else}}
<td></td>
<td></td>
<td></td>
{{end}}
<td class="stat">{{formatStat $mgr.MaxCorpus}}</td>
<td class="stat">
{{if $mgr.CoverLink}}
<a href="{{$mgr.CoverLink}}" target="_blank">
{{end}}
{{formatStat $mgr.MaxCover}}
{{if $mgr.CoverLink}}
</a>
{{end}}
</td>
<td class="stat">{{formatStat $mgr.TotalCrashes}}</td>
<td class="stat">{{formatStat $mgr.TotalExecs}}</td>
<td class="stat">{{if $mgr.FailedBuildBugLink}}<a href="{{$mgr.FailedBuildBugLink}}" class="bad">bug</a>{{end}}</td>
</tr>
{{end}}
</table>
{{end}}
{{end}}

0 comments on commit 97aa259

Please sign in to comment.
You can’t perform that action at this time.