aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-03-16 23:43:06 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2024-03-16 23:43:06 +0200
commit234e86635b103fb5058698ae97ce35970b876009 (patch)
treef768976f9eb1070f34dbe4767f28f4e679ed7acc
parentapp/package/useflags: show all local useflags (diff)
downloadsoko-234e86635b103fb5058698ae97ce35970b876009.tar.gz
soko-234e86635b103fb5058698ae97ce35970b876009.tar.bz2
soko-234e86635b103fb5058698ae97ce35970b876009.zip
remove user preferences for dependencies default page
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--pkg/app/handler/packages/qareport.templ2
-rw-r--r--pkg/app/handler/packages/show.templ14
-rw-r--r--pkg/app/handler/user/packages.templ28
-rw-r--r--pkg/models/userpreferences.go20
4 files changed, 8 insertions, 56 deletions
diff --git a/pkg/app/handler/packages/qareport.templ b/pkg/app/handler/packages/qareport.templ
index 29603a1..619b7f5 100644
--- a/pkg/app/handler/packages/qareport.templ
+++ b/pkg/app/handler/packages/qareport.templ
@@ -2,7 +2,7 @@ package packages
import "soko/pkg/models"
-templ qaReport(pkg *models.Package, userPreferences *models.UserPreferences) {
+templ qaReport(pkg *models.Package) {
<div class="row">
<div class="col-md-9">
<h3>Pkgcheck Warnings</h3>
diff --git a/pkg/app/handler/packages/show.templ b/pkg/app/handler/packages/show.templ
index 3ef4341..33af701 100644
--- a/pkg/app/handler/packages/show.templ
+++ b/pkg/app/handler/packages/show.templ
@@ -5,7 +5,7 @@ import "soko/pkg/app/handler/packages/components"
import "soko/pkg/app/layout"
import "soko/pkg/models"
-func showViewTabs(pkg *models.Package, userPreference *models.PackagesPreferences) []layout.SubTab {
+func showViewTabs(pkg *models.Package) []layout.SubTab {
securityBugs, nonSecurityBugs := countBugs(pkg)
return []layout.SubTab{
{
@@ -15,7 +15,7 @@ func showViewTabs(pkg *models.Package, userPreference *models.PackagesPreference
},
{
Name: "Dependencies",
- Link: templ.URL("/packages/" + pkg.Atom + "/" + userPreference.Dependencies.Default),
+ Link: templ.URL("/packages/" + pkg.Atom + "/dependencies"),
Icon: "fa fa-link",
},
{
@@ -49,7 +49,7 @@ func showViewTabs(pkg *models.Package, userPreference *models.PackagesPreference
}
}
-templ tabbedHeader(pkg *models.Package, currentSubTab string, userPreference *models.PackagesPreferences) {
+templ tabbedHeader(pkg *models.Package, currentSubTab string) {
<div class="kk-header-container">
<div class="container">
<div class="row">
@@ -76,7 +76,7 @@ templ tabbedHeader(pkg *models.Package, currentSubTab string, userPreference *mo
</div>
<div class="col-md-12 pt-4 mt-1">
<nav class="nav kk-package-nav">
- for _, tab := range showViewTabs(pkg, userPreference) {
+ for _, tab := range showViewTabs(pkg) {
<a class={ "nav-link", templ.KV("active", tab.Name == currentSubTab) } href={ tab.Link }>
<i class={ tab.Icon } aria-hidden="true"></i> { tab.Name }
if tab.BadgeValue != "" {
@@ -133,15 +133,15 @@ func collectSecurityBugs(pkg *models.Package) (bool, []*models.Bug) {
templ show(pkg *models.Package, currentSubTab string, userPreferences models.UserPreferences) {
if currentSubTab == "Reverse Dependencies" {
- @tabbedHeader(pkg, "Dependencies", &userPreferences.Packages)
+ @tabbedHeader(pkg, "Dependencies")
} else {
- @tabbedHeader(pkg, currentSubTab, &userPreferences.Packages)
+ @tabbedHeader(pkg, currentSubTab)
}
<div class="tab-content" id="myTabContent">
<div class="container mb-5 tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
switch currentSubTab {
case "QA report":
- @qaReport(pkg, &userPreferences)
+ @qaReport(pkg)
case "Pull requests":
@components.PullRequests(len(pkg.PullRequests) > 0, pkg.PullRequests)
case "Bugs":
diff --git a/pkg/app/handler/user/packages.templ b/pkg/app/handler/user/packages.templ
index dd01068..f0a6206 100644
--- a/pkg/app/handler/user/packages.templ
+++ b/pkg/app/handler/user/packages.templ
@@ -14,7 +14,6 @@ templ packages(preferences models.PackagesPreferences) {
<div class="col-2 mt-1">
<div class="nav flex-column" role="tablist" aria-orientation="vertical" style="position: fixed;">
<a class="nav-link user-pref-nav-link active" id="overview-tab" href="#overview" aria-controls="overview-settings">Overview</a>
- <a class="nav-link user-pref-nav-link" id="dependencies-tab" href="#dependencies">Dependencies</a>
<a class="nav-link user-pref-nav-link" id="pull-requests-tab" href="#pull-requests" aria-controls="pull-requests-settings">Pull requests</a>
<a class="nav-link user-pref-nav-link" id="bugs-tab" href="#bugs" aria-controls="bugs-settings">Bugs</a>
<a class="nav-link user-pref-nav-link" id="security-tab" href="#security" aria-controls="security-settings">Security</a>
@@ -226,27 +225,6 @@ templ packages(preferences models.PackagesPreferences) {
</div>
</div>
</div>
- <h3 class="mt-5" id="dependencies">Dependencies</h3>
- <hr class="mt-1"/>
- <div class="card">
- <div class="card-body">
- Default Page
- <select class="form-control form-control-sm ml-1" style="max-width: 200px;display: inline;" name="dependencies-default-page" id="dependencies-default-page">
- <option
- value="dependencies"
- if preferences.Dependencies.Default == "dependencies" {
- selected
- }
- >dependencies</option>
- <option
- value="reverse-dependencies"
- if preferences.Dependencies.Default == "reverse-dependencies" {
- selected
- }
- >reverse-dependencies</option>
- </select>
- </div>
- </div>
<h3 class="mt-5" id="pull-requests">Pull requests</h3>
<hr class="mt-1"/>
<div class="card">
@@ -379,12 +357,6 @@ func EditPackagesPreferences(w http.ResponseWriter, r *http.Request) {
}
}
- // Dependencies
- defaultDependenciesPage := r.Form.Get("dependencies-default-page")
- if defaultDependenciesPage == "dependencies" || defaultDependenciesPage == "reverse-dependencies" {
- userPreferences.Packages.Dependencies.Default = defaultDependenciesPage
- }
-
//
// Store cookie
//
diff --git a/pkg/models/userpreferences.go b/pkg/models/userpreferences.go
index c31c6dc..023f153 100644
--- a/pkg/models/userpreferences.go
+++ b/pkg/models/userpreferences.go
@@ -18,7 +18,6 @@ type GeneralPreferences struct {
type PackagesPreferences struct {
Overview PackagesOverviewPreferences
- Dependencies PackagesDependenciesPreferences
PullRequests PackagesPullRequestsPreferences
Bugs PackagesBugsPreferences
Security PackagesSecurityPreferences
@@ -35,10 +34,6 @@ type PackagesOverviewPreferences struct {
ChangelogLength int
}
-type PackagesDependenciesPreferences struct {
- Default string
-}
-
type PackagesPullRequestsPreferences struct {
Layout string
}
@@ -77,7 +72,6 @@ func GetDefaultUserPreferences() UserPreferences {
userPreferences.General = GeneralPreferences{}
userPreferences.Packages = PackagesPreferences{}
userPreferences.Packages.Overview = PackagesOverviewPreferences{}
- userPreferences.Packages.Dependencies = PackagesDependenciesPreferences{}
userPreferences.Packages.PullRequests = PackagesPullRequestsPreferences{}
userPreferences.Packages.Bugs = PackagesBugsPreferences{}
userPreferences.Packages.Security = PackagesSecurityPreferences{}
@@ -96,8 +90,6 @@ func GetDefaultUserPreferences() UserPreferences {
userPreferences.Packages.Overview.ChangelogType = "compact"
userPreferences.Packages.Overview.ChangelogLength = 5
- userPreferences.Packages.Dependencies.Default = "dependencies"
-
userPreferences.Packages.PullRequests.Layout = "default"
userPreferences.Packages.Bugs.Layout = "default"
@@ -159,10 +151,6 @@ func (u *UserPreferences) Sanitize() {
u.Packages.Overview.ChangelogLength = 100
}
- if !(u.Packages.Dependencies.Default == "dependencies" || u.Packages.Dependencies.Default == "reverse-dependencies") {
- u.Packages.Dependencies.Default = defaultUserPreferences.Packages.Dependencies.Default
- }
-
if !(u.Packages.PullRequests.Layout == "default") {
u.Packages.PullRequests.Layout = defaultUserPreferences.Packages.PullRequests.Layout
}
@@ -207,11 +195,3 @@ func (u *UserPreferences) Sanitize() {
func GetAllKeywords() []string {
return []string{"alpha", "amd64", "arm", "arm64", "hppa", "ia64", "loong", "m68k", "mips", "ppc", "ppc64", "riscv", "s390", "sparc", "x86", "amd64-linux", "arm-linux", "arm64-linux", "ppc64-linux", "x86-linux", "ppc-macos", "x64-macos", "sparc-solaris", "sparc64-solaris", "x64-solaris", "x86-solaris", "x64-winnt", "x86-winnt", "x64-cygwin"}
}
-
-func createSlice(n int) []int {
- slice := []int{}
- for i := 0; i <= n; i++ {
- slice = append(slice, i)
- }
- return slice
-}