aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-01-07 20:47:29 +0100
committerTaras Madan <tarasmadan@google.com>2025-01-09 10:20:58 +0000
commit7cc17001e974d9ff7d7ce042c4e2ad2e8ec0e55e (patch)
treebd76bcfe68cf89381bd61ba5f8036665ad5cd523 /dashboard
parent9220929f371b5549fde0c05fdb17e18ec842f077 (diff)
dashboard/app: add targeting controls to the coverage page
It allows to control known parameters: 1. Period (months or days). 2. Target subsystem. 3. Target manager. And adds the disabled "Only unique" checkbox.
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/app/graphs.go26
-rw-r--r--dashboard/app/static/coverage.js11
2 files changed, 33 insertions, 4 deletions
diff --git a/dashboard/app/graphs.go b/dashboard/app/graphs.go
index 54520820f..9918f9200 100644
--- a/dashboard/app/graphs.go
+++ b/dashboard/app/graphs.go
@@ -10,6 +10,7 @@ import (
"net/http"
"net/url"
"regexp"
+ "slices"
"sort"
"strconv"
"time"
@@ -194,8 +195,8 @@ func handleFoundBugsGraph(c context.Context, w http.ResponseWriter, r *http.Requ
return serveTemplate(w, "graph_histogram.html", data)
}
-type funcStyleBodyJS func(ctx context.Context, projectID, ns, subsystem, manager string,
- periods []coveragedb.TimePeriod) (template.CSS, template.HTML, template.HTML, error)
+type funcStyleBodyJS func(ctx context.Context, projectID string, scope *cover.SelectScope, sss, managers []string,
+) (template.CSS, template.HTML, template.HTML, error)
func handleCoverageHeatmap(c context.Context, w http.ResponseWriter, r *http.Request) error {
return handleHeatmap(c, w, r, cover.DoHeatMapStyleBodyJS)
@@ -235,9 +236,28 @@ func handleHeatmap(c context.Context, w http.ResponseWriter, r *http.Request, f
if err != nil {
return fmt.Errorf("%s: %w", err.Error(), ErrClientBadRequest)
}
+ managers, err := CachedManagerList(c, hdr.Namespace)
+ if err != nil {
+ return err
+ }
+ ssService := getNsConfig(c, hdr.Namespace).Subsystems.Service
+ var subsystems []string
+ for _, ss := range ssService.List() {
+ subsystems = append(subsystems, ss.Name)
+ }
+ slices.Sort(managers)
+ slices.Sort(subsystems)
+
var style template.CSS
var body, js template.HTML
- if style, body, js, err = f(c, "syzkaller", hdr.Namespace, ss, manager, periods); err != nil {
+ if style, body, js, err = f(c, "syzkaller",
+ &cover.SelectScope{
+ Ns: hdr.Namespace,
+ Subsystem: ss,
+ Manager: manager,
+ Periods: periods,
+ },
+ subsystems, managers); err != nil {
return fmt.Errorf("failed to generate heatmap: %w", err)
}
return serveTemplate(w, "custom_content.html", struct {
diff --git a/dashboard/app/static/coverage.js b/dashboard/app/static/coverage.js
index 16eb4fcd7..5a17ad0a9 100644
--- a/dashboard/app/static/coverage.js
+++ b/dashboard/app/static/coverage.js
@@ -1,7 +1,8 @@
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-initTogglers();
+$(document).ready(initTogglers());
+$(document).ready(initUpdateForm);
// Initializes the file tree onClick collapse logic.
function initTogglers(){
@@ -11,6 +12,14 @@ function initTogglers(){
});
}
+function initUpdateForm(){
+ var curUrlParams = new URLSearchParams(window.location.search);
+ $('#target-period').val(curUrlParams.get('period'));
+ $('#target-subsystem').val(curUrlParams.get('subsystem'));
+ $('#target-manager').val(curUrlParams.get('manager'));
+ $("#only-unique").prop("checked", curUrlParams.get('subsystem') == "1");
+}
+
// This handler is called when user clicks on the coverage percentage.
// It downloads the kernel file coverage html block and adjust page to show it.
// "#file-content-prev" and "#file-content-curr" are the file content <div>s.