aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-07-03 16:00:52 +0200
committerTaras Madan <tarasmadan@google.com>2024-07-04 09:25:11 +0000
commitdc6bbff0c2fe403c39d8a1d057f668088b09069f (patch)
treed30f9427959a36f1fe7c080a010ed9c61d217414
parent3f2748a3a15aac63efeb991dee40bfc870ae581d (diff)
dashboard/app: make coverage menu and page optional
-rw-r--r--dashboard/app/config.go7
-rw-r--r--dashboard/app/handler.go2
-rw-r--r--dashboard/app/main.go6
-rw-r--r--dashboard/app/templates.html2
4 files changed, 15 insertions, 2 deletions
diff --git a/dashboard/app/config.go b/dashboard/app/config.go
index 6a4a3d530..547a30779 100644
--- a/dashboard/app/config.go
+++ b/dashboard/app/config.go
@@ -121,6 +121,13 @@ type Config struct {
DisplayDiscussions bool
// Cache what we display on the web dashboard.
CacheUIPages bool
+ // Enables coverage aggregation.
+ Coverage *CoverageConfig
+}
+
+type CoverageConfig struct {
+ BatchProject string
+ BatchServiceAccount string
}
// DiscussionEmailConfig defines the correspondence between an email and a DiscussionSource.
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go
index d6f9b6861..145f79ef9 100644
--- a/dashboard/app/handler.go
+++ b/dashboard/app/handler.go
@@ -206,6 +206,7 @@ type uiHeader struct {
MissingBackports int
Namespaces []uiNamespace
ShowSubsystems bool
+ ShowCoverageMenu bool
}
type uiNamespace struct {
@@ -290,6 +291,7 @@ func commonHeader(c context.Context, r *http.Request, w http.ResponseWriter, ns
}
h.BugCounts = &cached.Total
h.MissingBackports = cached.MissingBackports
+ h.ShowCoverageMenu = getNsConfig(c, ns).Coverage != nil
}
return h, nil
}
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index 4d68b14cd..1e16525c8 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -55,7 +55,7 @@ func initHTTPHandlers() {
http.Handle("/x/bisect.txt", handlerWrapper(handleTextX(textLog)))
http.Handle("/x/error.txt", handlerWrapper(handleTextX(textError)))
http.Handle("/x/minfo.txt", handlerWrapper(handleTextX(textMachineInfo)))
- for ns := range getConfig(context.Background()).Namespaces {
+ for ns, nsConfig := range getConfig(context.Background()).Namespaces {
http.Handle("/"+ns, handlerWrapper(handleMain))
http.Handle("/"+ns+"/fixed", handlerWrapper(handleFixed)) // nolint: goconst // remove it with goconst 1.7.0+
http.Handle("/"+ns+"/invalid", handlerWrapper(handleInvalid))
@@ -64,7 +64,9 @@ func initHTTPHandlers() {
http.Handle("/"+ns+"/graph/fuzzing", handlerWrapper(handleGraphFuzzing))
http.Handle("/"+ns+"/graph/crashes", handlerWrapper(handleGraphCrashes))
http.Handle("/"+ns+"/graph/found-bugs", handlerWrapper(handleFoundBugsGraph))
- http.Handle("/"+ns+"/graph/coverage", handlerWrapper(handleCoverageGraph))
+ if nsConfig.Coverage != nil {
+ http.Handle("/"+ns+"/graph/coverage", handlerWrapper(handleCoverageGraph))
+ }
http.Handle("/"+ns+"/repos", handlerWrapper(handleRepos))
http.Handle("/"+ns+"/bug-summaries", handlerWrapper(handleBugSummaries))
http.Handle("/"+ns+"/subsystems", handlerWrapper(handleSubsystemsList))
diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html
index 63830d7ed..f45e28632 100644
--- a/dashboard/app/templates.html
+++ b/dashboard/app/templates.html
@@ -84,8 +84,10 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the
<span style="color:DarkOrange;">📈</span> Fuzzing</a>
<a class="navigation_tab{{if eq .URLPath (printf "/%v/graph/crashes" $.Namespace)}}_selected{{end}}" href='/{{$.Namespace}}/graph/crashes'>
<span style="color:DarkOrange;">📈</span> Crashes</a>
+ {{if .ShowCoverageMenu}}
<a class="navigation_tab{{if eq .URLPath (printf "/%v/graph/coverage" $.Namespace)}}_selected{{end}}" href='/{{$.Namespace}}/graph/coverage'>
<span style="color:DarkOrange;">📈</span> Coverage</a>
+ {{end}}
</td>
{{if .ContactEmail}}
<td class="navigation-right">