diff options
author | Max Magorsch <arzano@gentoo.org> | 2020-09-22 22:50:59 +0000 |
---|---|---|
committer | Max Magorsch <arzano@gentoo.org> | 2020-09-22 22:50:59 +0000 |
commit | 1a09a4ef57ca70ddb385b7a6b00ca4f489644e42 (patch) | |
tree | 5c77673a5592cef23d1adbb485a8bbbd33d06ac8 | |
parent | Add a link to the CI results in the QA report tab (diff) | |
download | soko-1a09a4ef57ca70ddb385b7a6b00ca4f489644e42.tar.gz soko-1a09a4ef57ca70ddb385b7a6b00ca4f489644e42.tar.bz2 soko-1a09a4ef57ca70ddb385b7a6b00ca4f489644e42.zip |
Include potential stable requests in maintainer results
Thanks to sam and mgorny for the suggestion
Closes: https://bugs.gentoo.org/742344
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r-- | pkg/app/handler/maintainer/show.go | 7 | ||||
-rw-r--r-- | pkg/models/package.go | 9 | ||||
-rw-r--r-- | pkg/portage/maintainers/update.go | 21 | ||||
-rw-r--r-- | web/templates/maintainer/components/stabilization.tmpl | 96 | ||||
-rw-r--r-- | web/templates/maintainer/maintainerheader.tmpl | 1 | ||||
-rw-r--r-- | web/templates/maintainer/show.tmpl | 2 |
6 files changed, 128 insertions, 8 deletions
diff --git a/pkg/app/handler/maintainer/show.go b/pkg/app/handler/maintainer/show.go index 9c0e8da..d8cae8b 100644 --- a/pkg/app/handler/maintainer/show.go +++ b/pkg/app/handler/maintainer/show.go @@ -55,6 +55,13 @@ func Show(w http.ResponseWriter, r *http.Request) { query = query. Relation("Versions"). Relation("PullRequests") + } else if strings.HasSuffix(r.URL.Path, "/stabilization") { + pageName = "stabilization" + query = query. + Relation("Versions"). + Relation("PkgCheckResults"). + Relation("Versions.PkgCheckResults"). + Relation("Bugs") } else if strings.HasSuffix(r.URL.Path, "/bugs") { pageName = "bugs" query = query. diff --git a/pkg/models/package.go b/pkg/models/package.go index 0608e92..6a639a1 100644 --- a/pkg/models/package.go +++ b/pkg/models/package.go @@ -28,10 +28,11 @@ type Maintainer struct { } type MaintainerPackagesInformation struct { - Outdated int - PullRequests int - Bugs int - SecurityBugs int + Outdated int + PullRequests int + Bugs int + SecurityBugs int + StableRequests int } type Upstream struct { diff --git a/pkg/portage/maintainers/update.go b/pkg/portage/maintainers/update.go index 66a4a33..66438d0 100644 --- a/pkg/portage/maintainers/update.go +++ b/pkg/portage/maintainers/update.go @@ -33,6 +33,8 @@ func FullImport() { Relation("Outdated"). Relation("PullRequests"). Relation("Bugs"). + Relation("Versions"). + Relation("Versions.PkgCheckResults"). Select() // TODO in future we want an incremental update here @@ -45,6 +47,7 @@ func FullImport() { securityBugs := 0 pullrequestIds := []string{} nonSecurityBugs := 0 + stableRequests := 0 for _, gpackage := range gpackages { found := false @@ -69,14 +72,24 @@ func FullImport() { } } + // Find Stable Requests + for _, version := range gpackage.Versions { + for _, pkgcheckWarning := range version.PkgCheckResults { + if pkgcheckWarning.Class == "StableRequest" { + stableRequests++ + } + } + } + } } maintainer.PackagesInformation = models.MaintainerPackagesInformation{ - Outdated: outdated, - PullRequests: len(utils.Deduplicate(pullrequestIds)), - Bugs: nonSecurityBugs, - SecurityBugs: securityBugs, + Outdated: outdated, + PullRequests: len(utils.Deduplicate(pullrequestIds)), + Bugs: nonSecurityBugs, + SecurityBugs: securityBugs, + StableRequests: stableRequests, } if maintainer.Name == "" { diff --git a/web/templates/maintainer/components/stabilization.tmpl b/web/templates/maintainer/components/stabilization.tmpl new file mode 100644 index 0000000..b12fd0d --- /dev/null +++ b/web/templates/maintainer/components/stabilization.tmpl @@ -0,0 +1,96 @@ +{{define "stabilization"}} + <div class="row"> + <div class="col-md-9"> + + <h3>Stable Requests</h3> + <ul class="timeline"> + {{$stable_requests := 0}} + {{range .Packages}} + {{range $index, $element := .Versions}} + {{ if .PkgCheckResults }} + {{ range .PkgCheckResults }} + {{if eq .Class "StableRequest"}} + {{$stable_requests = (add $stable_requests 1)}} + <li> + <ul class="list-group"> + <li class="list-group-item"> + <a href="/packages/{{.Category}}/{{.Package}}" class="text-dark"><strong>{{.Category}}/{{.Package}}-{{.Version}}</strong></a><br/> + <span class="kk-version kk-cell-sep-right text-muted"> + {{ .Message }} + </span> + </li> + </ul> + </li> + {{end}} + {{end}} + {{end}} + {{end}} + {{end}} + </ul> + {{if eq $stable_requests 0}} + <div class="text-center w-100"><i>- No Stable Requests found -</i></div> + {{end}} + + + {{$security_bugs := 0}} + {{$non_security_bugs := 0}} + {{range .Packages}} + {{range .Bugs}} + {{if eq .Component "Vulnerabilities"}} + {{$security_bugs = (add $security_bugs 1)}} + {{else}} + {{$non_security_bugs = (add $non_security_bugs 1)}} + {{end}} + {{end}} + {{end}} + + {{$general_bugs := 0}} + {{$stabilization_bugs := 0}} + {{$keywording_bugs := 0}} + {{range .Packages}} + {{range .Bugs}} + {{if eq .Component "Current packages"}} + {{$general_bugs = (add $general_bugs 1)}} + {{else if eq .Component "Stabilization"}} + {{$stabilization_bugs = (add $stabilization_bugs 1)}} + {{else if eq .Component "Keywording"}} + {{$keywording_bugs = (add $keywording_bugs 1)}} + {{end}} + {{end}} + {{end}} + + + {{if $non_security_bugs}} + {{if $stabilization_bugs}} + <h3 id="stabilization" class="my-4">Stabilization Bug Reports</h3> + <ul class="list-group"> + {{range .Packages}} + {{range .Bugs}} + {{if eq .Component "Stabilization"}} + <li class="list-group-item"> + <div class="row"> + <div class="col-md-12"> + <i class="fa fa-bug" aria-hidden="true"></i> + <a href="https://bugs.gentoo.org/{{.Id}}" class="text-dark"><b>{{.Summary}}</b></a> + </div> + <div class="col-md-12 text-muted"> + {{.Id}} - Assigned to {{.Assignee}} + </div> + </div> + </li> + {{end}} + {{end}} + {{end}} + </ul> + {{end}} + {{end}} + </div> + <div class="col-md-3 pt-5"> + <h4 class="">Description</h4> + <span class="text-muted"> + This page lists potential stabilization candidates. Please have a look at the <a href="https://wiki.gentoo.org/wiki/Stable_request">wiki page</a> for more information. + </span> + </div> + </div> +{{end}} + diff --git a/web/templates/maintainer/maintainerheader.tmpl b/web/templates/maintainer/maintainerheader.tmpl index 4a25792..c0a4de9 100644 --- a/web/templates/maintainer/maintainerheader.tmpl +++ b/web/templates/maintainer/maintainerheader.tmpl @@ -52,6 +52,7 @@ <div class="col-md-12 pt-4 mt-1"> <nav class="nav kk-package-nav"> <a class="nav-link {{if eq .PageName "packages"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}"><i class="fa fa-info mr-1" aria-hidden="true"></i> Packages <span class="ml-1 badge badge-pill kk-misc-badge">{{len .Packages}}</span></a> + <a class="nav-link {{if eq .PageName "stabilization"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/stabilization"><i class="fa fa-check-circle-o mr-1" aria-hidden="true"></i> Stabilization <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.StableRequests}}</span></a> <a class="nav-link {{if eq .PageName "outdated"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/outdated"><i class="fa fa-tag mr-1" aria-hidden="true"></i> Outdated <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.Outdated}}</span></a> <a class="nav-link {{if eq .PageName "pull-requests"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/pull-requests"><span class="octicon octicon-git-pull-request opticon-resource-icon ml-1"></span> Pull requests <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.PullRequests}}</span></a> <a class="nav-link {{if eq .PageName "bugs"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/bugs"><i class="fa fa-bug" aria-hidden="true"></i> Bugs <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.Bugs}}</span></a> diff --git a/web/templates/maintainer/show.tmpl b/web/templates/maintainer/show.tmpl index 58f14ff..2f7ee1e 100644 --- a/web/templates/maintainer/show.tmpl +++ b/web/templates/maintainer/show.tmpl @@ -14,6 +14,8 @@ {{template "outdated" .}} {{else if eq .PageName "pull-requests"}} {{template "pull-requests" .}} + {{else if eq .PageName "stabilization"}} + {{template "stabilization" .}} {{else if eq .PageName "bugs"}} {{template "bugs" .}} {{else if eq .PageName "security"}} |