aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-08-25 14:37:41 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-08-25 14:18:46 +0000
commitb76bd413e84767248dd3b352c3f81f35389ae19a (patch)
tree4129f971b441c8ba899be01acdbca95f92d6977c
parent30e7d9a7611bac37a253e608f3cac37bbcefb8a1 (diff)
dashboard: display labels in groups
Display subsystems and bug presence labels separately from other labels as these are most important. Also, displaying subsystems together with other labels confuses users over our #syz set interface.
-rw-r--r--dashboard/app/bug.html13
-rw-r--r--dashboard/app/main.go55
2 files changed, 59 insertions, 9 deletions
diff --git a/dashboard/app/bug.html b/dashboard/app/bug.html
index d21af6548..de7957cf5 100644
--- a/dashboard/app/bug.html
+++ b/dashboard/app/bug.html
@@ -16,11 +16,14 @@ Page with details about a single bug.
<b>{{.Bug.Title}}</b><br><br>
Status: {{if .Bug.ExternalLink}}<a href="{{.Bug.ExternalLink}}">{{.Bug.Status}}</a>{{else}}{{.Bug.Status}}{{end}}<br>
- {{if .Labels}}
- Labels: {{range .Labels}}
- <span class="bug-label">{{link .Link .Name}}</span>
- {{- end}}
- <a href="https://github.com/google/syzkaller/blob/master/docs/syzbot.md#labels">(incorrect?)</a><br>
+ {{if .LabelGroups}}
+ {{range $group := .LabelGroups}}
+ {{$group.Name}}: {{range $group.Labels}}
+ <span class="bug-label">{{link .Link .Name}}</span>
+ {{- end}}
+ <br>
+ {{end}}
+ <a href="https://github.com/google/syzkaller/blob/master/docs/syzbot.md#labels">[Documentation on labels]</a><br>
{{- end}}
{{if .DebugSubsystems}}
{{link .DebugSubsystems "[Debug subsystem assignment]"}}<br>
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index e6a3acd98..2bab7c66e 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -254,10 +254,15 @@ type uiBugPage struct {
SampleReport template.HTML
Crashes *uiCrashTable
TestPatchJobs *uiJobList
- Labels []*uiBugLabel
+ LabelGroups []*uiBugLabelGroup
DebugSubsystems string
}
+type uiBugLabelGroup struct {
+ Name string
+ Labels []*uiBugLabel
+}
+
const (
sectionBugList = "bug_list"
sectionJobList = "job_list"
@@ -1075,9 +1080,7 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
Sections: sections,
SampleReport: sampleReport,
Crashes: crashesTable,
- }
- for _, entry := range bug.Labels {
- data.Labels = append(data.Labels, makeBugLabelUI(c, bug, entry))
+ LabelGroups: getLabelGroups(c, bug),
}
if accessLevel == AccessAdmin && !bug.hasUserSubsystems() {
data.DebugSubsystems = html.AmendURL(data.Bug.Link, "debug_subsystems", "1")
@@ -1115,6 +1118,50 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
return serveTemplate(w, "bug.html", data)
}
+type labelGroupInfo struct {
+ Label BugLabelType
+ Name string
+}
+
+var labelGroupOrder = []labelGroupInfo{
+ {
+ Label: OriginLabel,
+ Name: "Bug presence",
+ },
+ {
+ Label: SubsystemLabel,
+ Name: "Subsystems",
+ },
+ {
+ Label: EmptyLabel, // all the rest
+ Name: "Labels",
+ },
+}
+
+func getLabelGroups(c context.Context, bug *Bug) []*uiBugLabelGroup {
+ var ret []*uiBugLabelGroup
+ seenLabel := map[string]bool{}
+ for _, info := range labelGroupOrder {
+ obj := &uiBugLabelGroup{
+ Name: info.Name,
+ }
+ for _, entry := range bug.Labels {
+ if seenLabel[entry.String()] {
+ continue
+ }
+ if entry.Label == info.Label || info.Label == EmptyLabel {
+ seenLabel[entry.String()] = true
+ obj.Labels = append(obj.Labels, makeBugLabelUI(c, bug, entry))
+ }
+ }
+ if len(obj.Labels) == 0 {
+ continue
+ }
+ ret = append(ret, obj)
+ }
+ return ret
+}
+
func debugBugSubsystems(c context.Context, w http.ResponseWriter, bug *Bug) error {
service := getSubsystemService(c, bug.Namespace)
if service == nil {