aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-05-24 21:13:12 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-05-24 21:13:12 +0300
commit653dbb5cc89e60cbef7df2d1962da966193d7fd2 (patch)
tree5c7bd0662933262702d9acf802618faaf73f654a
parenteapi page improvements (diff)
downloadsoko-653dbb5cc89e60cbef7df2d1962da966193d7fd2.tar.gz
soko-653dbb5cc89e60cbef7df2d1962da966193d7fd2.tar.bz2
soko-653dbb5cc89e60cbef7df2d1962da966193d7fd2.zip
app: add all stable requests page
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--pkg/app/handler/categories/utils.go10
-rw-r--r--pkg/app/handler/packages/changed_versions.templ40
-rw-r--r--pkg/app/handler/packages/eapi.templ2
-rw-r--r--pkg/app/serve.go5
4 files changed, 54 insertions, 3 deletions
diff --git a/pkg/app/handler/categories/utils.go b/pkg/app/handler/categories/utils.go
index ee65d9c..84a9f68 100644
--- a/pkg/app/handler/categories/utils.go
+++ b/pkg/app/handler/categories/utils.go
@@ -33,6 +33,16 @@ var categoriesViewTabs = []layout.SubTab{
Link: "/packages/keyworded",
Icon: "fa fa-circle-o mr-1",
},
+ {
+ Name: "Stable Requests",
+ Link: templ.URL("/packages/stabilization"),
+ Icon: "fa fa-check-circle-o",
+ },
+ {
+ Name: "EAPI cleanup",
+ Link: templ.URL("/packages/eapi6"),
+ Icon: "fa fa-trash-o",
+ },
}
func RenderPage(w http.ResponseWriter, r *http.Request, title string, currentTab string, content templ.Component) {
diff --git a/pkg/app/handler/packages/changed_versions.templ b/pkg/app/handler/packages/changed_versions.templ
index 3b268ad..1f0af89 100644
--- a/pkg/app/handler/packages/changed_versions.templ
+++ b/pkg/app/handler/packages/changed_versions.templ
@@ -1,10 +1,12 @@
package packages
-import "soko/pkg/app/utils"
-import "soko/pkg/models"
import "net/http"
import "soko/pkg/app/handler/categories"
import "soko/pkg/app/handler/feeds"
+import "soko/pkg/app/handler/packages/components"
+import "soko/pkg/app/utils"
+import "soko/pkg/database"
+import "soko/pkg/models"
templ changedVersionsPage(pageType string, versions []*models.Version) {
<div class="container mb-5">
@@ -74,3 +76,37 @@ func KeywordedFeed(w http.ResponseWriter, r *http.Request) {
keywordedVersions := GetKeywordedVersions(250)
feeds.Changes("Keyworded packages in Gentoo.", "Keyworded packages in Gentoo.", keywordedVersions, w)
}
+
+templ allStableRequests(results []*models.PkgCheckResult) {
+ <div class="container mb-5">
+ @components.Stabilizations(results)
+ </div>
+}
+
+func AllStableRequests(w http.ResponseWriter, r *http.Request) {
+ var results []*models.PkgCheckResult
+ err := database.DBCon.Model(&results).
+ Column("atom", "cpv", "message").
+ Where("class = ?", "StableRequest").
+ OrderExpr(`substring(message,' \d+ ')::INT DESC`).
+ Select()
+ if err != nil {
+ http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
+ return
+ }
+ categories.RenderPage(w, r, "All Stable Requests", "Stable Requests", allStableRequests(results))
+}
+
+func AllStableRequestsFeed(w http.ResponseWriter, r *http.Request) {
+ var results []*models.PkgCheckResult
+ err := database.DBCon.Model(&results).
+ Column("atom", "cpv", "message").
+ Where("class = ?", "StableRequest").
+ OrderExpr(`substring(message,' \d+ ')::INT DESC`).
+ Select()
+ if err != nil {
+ http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
+ return
+ }
+ utils.StabilizationFeed(w, "https://packages.gentoo.org/packages/stabilization", "All Stable Requests", results)
+}
diff --git a/pkg/app/handler/packages/eapi.templ b/pkg/app/handler/packages/eapi.templ
index 5221d37..5a476a0 100644
--- a/pkg/app/handler/packages/eapi.templ
+++ b/pkg/app/handler/packages/eapi.templ
@@ -109,5 +109,5 @@ func Eapi(w http.ResponseWriter, r *http.Request) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
- categories.RenderPage(w, r, "EAPI 6 Overview", "EAPI", eapiOverview(result))
+ categories.RenderPage(w, r, "EAPI 6 Overview", "EAPI cleanup", eapiOverview(result))
}
diff --git a/pkg/app/serve.go b/pkg/app/serve.go
index 8f71ae7..a33668e 100644
--- a/pkg/app/serve.go
+++ b/pkg/app/serve.go
@@ -94,6 +94,11 @@ func Serve() {
setRoute("GET /packages/updated", packages.Updated)
setRoute("GET /packages/stable", packages.Stabilized)
setRoute("GET /packages/keyworded", packages.Keyworded)
+ setRoute("GET /packages/stabilization", packages.AllStableRequests)
+ setRoute("GET /packages/stabilization.json", packages.AllStableRequestsFeed)
+ setRoute("GET /packages/stabilization.list", packages.AllStableRequestsFeed)
+ setRoute("GET /packages/stabilization.xml", packages.AllStableRequestsFeed)
+ setRoute("GET /packages/stabilization.atom", packages.AllStableRequestsFeed)
setRoute("GET /packages/{category}/{package}", packages.Show)
setRoute("GET /packages/{category}/{package}/{pageName}", packages.Show)
setRoute("GET /{$}", index.Show)