dashboard/app: add similarity domains for namespaces

It does not make sense to show similar bugs across linux/openbsd/akaros.
Allow restricting similarity domains for namespaces.

Fixes #742
This commit is contained in:
Dmitry Vyukov 2018-09-24 11:12:44 +02:00
parent 684e7e3250
commit 7ffd14ab85
2 changed files with 10 additions and 0 deletions

View File

@ -47,6 +47,9 @@ type Config struct {
AccessLevel AccessLevel
// Name used in UI.
DisplayTitle string
// Unique string that allows to show "similar bugs" across different namespaces.
// Similar bugs are shown only across namespaces with the same value of SimilarityDomain.
SimilarityDomain string
// Per-namespace clients that act only on a particular namespace.
Clients map[string]string
// A unique key for hashing, can be anything.
@ -197,6 +200,9 @@ func checkNamespace(ns string, cfg *Config, namespaces, clientNames map[string]b
if cfg.DisplayTitle == "" {
cfg.DisplayTitle = ns
}
if cfg.SimilarityDomain == "" {
cfg.SimilarityDomain = ns
}
checkClients(clientNames, cfg.Clients)
for name, mgr := range cfg.Managers {
checkManager(ns, name, mgr)

View File

@ -504,6 +504,7 @@ func loadSimilarBugs(c context.Context, r *http.Request, bug *Bug, state *Report
managers := make(map[string][]string)
var results []*uiBug
accessLevel := accessLevel(c, r)
domain := config.Namespaces[bug.Namespace].SimilarityDomain
for _, similar := range similar {
if accessLevel < similar.sanitizeAccess(accessLevel) {
continue
@ -511,6 +512,9 @@ func loadSimilarBugs(c context.Context, r *http.Request, bug *Bug, state *Report
if similar.Namespace == bug.Namespace && similar.Seq == bug.Seq {
continue
}
if config.Namespaces[similar.Namespace].SimilarityDomain != domain {
continue
}
if managers[similar.Namespace] == nil {
mgrs, err := managerList(c, similar.Namespace)
if err != nil {