aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-05-16 09:04:39 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-05-16 09:04:39 +0300
commit366153a7cdd2b9c2de4ec435156737085921c656 (patch)
tree647b08b73941a2da69755e113d4fd694a05acd32 /pkg/app/handler
parenteapi6 overview: minor improvements (diff)
downloadsoko-366153a7cdd2b9c2de4ec435156737085921c656.tar.gz
soko-366153a7cdd2b9c2de4ec435156737085921c656.tar.bz2
soko-366153a7cdd2b9c2de4ec435156737085921c656.zip
bugs: show all general bugs
Closes: https://bugs.gentoo.org/931966 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'pkg/app/handler')
-rw-r--r--pkg/app/handler/categories/show.go2
-rw-r--r--pkg/app/handler/maintainer/show.go2
-rw-r--r--pkg/app/handler/packages/components/bugs.templ12
-rw-r--r--pkg/app/handler/packages/show.go2
-rw-r--r--pkg/app/handler/packages/show.templ8
5 files changed, 13 insertions, 13 deletions
diff --git a/pkg/app/handler/categories/show.go b/pkg/app/handler/categories/show.go
index 5e9151b..a7dad6b 100644
--- a/pkg/app/handler/categories/show.go
+++ b/pkg/app/handler/categories/show.go
@@ -146,7 +146,7 @@ func ShowSecurity(w http.ResponseWriter, r *http.Request) {
DistinctOn("id::INT").
Column("id", "summary", "component", "assignee").
OrderExpr("id::INT").
- Where("component = ?", "Vulnerabilities").
+ Where("component = ?", models.BugComponentVulnerabilities).
Where("id IN (?)",
database.DBCon.Model((*models.PackageToBug)(nil)).
Column("bug_id").
diff --git a/pkg/app/handler/maintainer/show.go b/pkg/app/handler/maintainer/show.go
index dc80ec2..410854b 100644
--- a/pkg/app/handler/maintainer/show.go
+++ b/pkg/app/handler/maintainer/show.go
@@ -240,7 +240,7 @@ func ShowSecurity(w http.ResponseWriter, r *http.Request) {
Column("id", "summary", "component", "assignee").
OrderExpr("id::INT").
With("wanted", query).
- Where("component = ?", "Vulnerabilities").
+ Where("component = ?", models.BugComponentVulnerabilities).
Where("id IN (?)",
database.DBCon.Model((*models.PackageToBug)(nil)).
Column("bug_id").
diff --git a/pkg/app/handler/packages/components/bugs.templ b/pkg/app/handler/packages/components/bugs.templ
index ee49df2..b601903 100644
--- a/pkg/app/handler/packages/components/bugs.templ
+++ b/pkg/app/handler/packages/components/bugs.templ
@@ -3,11 +3,11 @@ package components
import "soko/pkg/models"
import "strconv"
-templ bugsList(title, component string, bugs []*models.Bug, titleClass, id string) {
+templ bugsList(title string, component models.BugComponent, bugs []*models.Bug, titleClass, id string) {
<h3 id={ id } class={ titleClass }>{ title }</h3>
<ul class="list-group">
for _, bug := range bugs {
- if bug.Component == component {
+ if bug.MatchesComponent(component) {
<li class="list-group-item">
<div class="row">
<div class="col-md-12">
@@ -36,13 +36,13 @@ templ Bugs(atom string, generalCount, stabilizationCount, keywordingCount int, b
<div class="col-md-9">
if len(bugs) > 0 {
if generalCount > 0 {
- @bugsList("Bug Reports", "Current packages", bugs, "mb-4", "packages")
+ @bugsList("Bug Reports", models.BugComponentGeneral, bugs, "mb-4", "packages")
}
if stabilizationCount > 0 {
- @bugsList("Stabilization Bug Reports", "Stabilization", bugs, "my-4", "stabilization")
+ @bugsList("Stabilization Bug Reports", models.BugComponentStabilization, bugs, "my-4", "stabilization")
}
if keywordingCount > 0 {
- @bugsList("Keywording Bug Reports", "Keywording", bugs, "my-4", "keywording")
+ @bugsList("Keywording Bug Reports", models.BugComponentKeywording, bugs, "my-4", "keywording")
}
} else {
<div class="row pt-5">
@@ -123,7 +123,7 @@ templ SecurityBugs(atom string, bugs []*models.Bug) {
<div class="row">
<div class="col-md-9">
if len(bugs) > 0 {
- @bugsList("Security Bug Reports", "Vulnerabilities", bugs, "mb-4", "security")
+ @bugsList("Security Bug Reports", models.BugComponentVulnerabilities, bugs, "mb-4", "security")
} else {
<div class="row pt-5">
<div class="col-md-4">
diff --git a/pkg/app/handler/packages/show.go b/pkg/app/handler/packages/show.go
index b5c017f..a3c71b7 100644
--- a/pkg/app/handler/packages/show.go
+++ b/pkg/app/handler/packages/show.go
@@ -216,7 +216,7 @@ func changelogJSON(w http.ResponseWriter, r *http.Request) {
func countBugs(gpackage *models.Package) (securityBugs, nonSecurityBugs int) {
for _, bug := range gpackage.Bugs {
- if bug.Component == "Vulnerabilities" {
+ if bug.Component == string(models.BugComponentVulnerabilities) {
securityBugs++
} else {
nonSecurityBugs++
diff --git a/pkg/app/handler/packages/show.templ b/pkg/app/handler/packages/show.templ
index fa3b33f..6718ae0 100644
--- a/pkg/app/handler/packages/show.templ
+++ b/pkg/app/handler/packages/show.templ
@@ -98,7 +98,7 @@ func collectAllBugs(pkg *models.Package) (atom string, generalCount, stabilizati
bugs = make([]*models.Bug, 0, len(pkg.Bugs))
handled := make(map[string]struct{}, len(pkg.Bugs))
for _, bug := range pkg.Bugs {
- if bug.Component == "Current packages" {
+ if bug.Component != string(models.BugComponentVulnerabilities) {
generalCount++
bugs = append(bugs, bug)
handled[bug.Id] = struct{}{}
@@ -109,10 +109,10 @@ func collectAllBugs(pkg *models.Package) (atom string, generalCount, stabilizati
if _, found := handled[bug.Id]; found {
continue
}
- if bug.Component == "Stabilization" {
+ if bug.Component == string(models.BugComponentStabilization) {
stabilizationCount++
bugs = append(bugs, bug)
- } else if bug.Component == "Keywording" {
+ } else if bug.Component == string(models.BugComponentKeywording) {
keywordingCount++
bugs = append(bugs, bug)
}
@@ -125,7 +125,7 @@ func collectAllBugs(pkg *models.Package) (atom string, generalCount, stabilizati
func collectSecurityBugs(pkg *models.Package) (string, []*models.Bug) {
bugs := make([]*models.Bug, 0, len(pkg.Bugs))
for _, bug := range pkg.Bugs {
- if bug.Component == "Vulnerabilities" {
+ if bug.Component == string(models.BugComponentVulnerabilities) {
bugs = append(bugs, bug)
}
}