feat(explore): add packages explore page
Implements public package discovery page in the Explore menu. Shows public and global packages with pagination, filtering by type, and search. Adds admin setting to enable/disable the packages tab. Updates package search to support PublicOrGlobal filter for showing packages that are either public OR global. Includes new locale strings and templates.
This commit is contained in:
@@ -194,6 +194,8 @@ type PackageSearchOptions struct {
|
||||
Properties map[string]string // only results are found which contain all listed version properties with the specific value
|
||||
IsInternal optional.Option[bool]
|
||||
IsPrivate optional.Option[bool] // filter by private/public packages
|
||||
IsGlobal optional.Option[bool] // filter by global packages
|
||||
PublicOrGlobal bool // if true, shows public packages OR global packages (for explore page)
|
||||
HasFileWithName string // only results are found which are associated with a file with the specific name
|
||||
HasFiles optional.Option[bool] // only results are found which have associated files
|
||||
Sort VersionSort
|
||||
@@ -220,8 +222,19 @@ func (opts *PackageSearchOptions) ToConds() builder.Cond {
|
||||
if opts.PackageID != 0 {
|
||||
cond = cond.And(builder.Eq{"package.id": opts.PackageID})
|
||||
}
|
||||
if opts.IsPrivate.Has() {
|
||||
cond = cond.And(builder.Eq{"package.is_private": opts.IsPrivate.Value()})
|
||||
if opts.PublicOrGlobal {
|
||||
// For explore page: show packages that are either public OR global
|
||||
cond = cond.And(builder.Or(
|
||||
builder.Eq{"package.is_private": false},
|
||||
builder.Eq{"package.is_global": true},
|
||||
))
|
||||
} else {
|
||||
if opts.IsPrivate.Has() {
|
||||
cond = cond.And(builder.Eq{"package.is_private": opts.IsPrivate.Value()})
|
||||
}
|
||||
if opts.IsGlobal.Has() {
|
||||
cond = cond.And(builder.Eq{"package.is_global": opts.IsGlobal.Value()})
|
||||
}
|
||||
}
|
||||
if opts.Name.Value != "" {
|
||||
if opts.Name.ExactMatch {
|
||||
|
||||
Reference in New Issue
Block a user