Skip to content

POC: filter by ecosystem using pills - #319

Draft
kokes wants to merge 1 commit into
git-pkgs:mainfrom
kokes:kokes/filter-pills
Draft

POC: filter by ecosystem using pills#319
kokes wants to merge 1 commit into
git-pkgs:mainfrom
kokes:kokes/filter-pills

Conversation

@kokes

@kokes kokes commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

I found the dropdown for filtering by ecosystem to be lacking for two reasons:

  1. It was clunky to switch between ecosystems
  2. It showed ecosystems I had no packages for

(There was also the issue of jagged hit counts I addressed for the dashboard in an earlier PR.)

It now looks like this:

image

Marking this as a draft and a POC, because it's completely vibe coded and I haven't looked at the code to clean it up in any way just yet.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new pill/count data is derived from GetCacheStats() (not aligned with “cached packages” semantics) and the new filter links should URL-encode query values to avoid malformed URLs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This draft/POC updates the “Cached Packages” UI to replace the ecosystem dropdown with clickable “pill” filters and to show only ecosystems that have packages (with per-ecosystem counts), improving navigation and discoverability.

Changes:

  • Replaced the ecosystem <select> with pill-style filter links showing per-ecosystem counts (plus an “All” pill).
  • Added template helpers for pill styling and a builder to generate the ecosystem filter list.
  • Updated the packages list handler and template rendering tests to include the new data fields.
File summaries
File Description
internal/server/templates/pages/packages_list.html Replaces ecosystem dropdown with filter pills; adjusts list row layout and sort behavior.
internal/server/templates.go Exposes ecosystemPillClass helper to templates.
internal/server/templates_test.go Updates page render test data; adds tests for ecosystem filter building and pill classes.
internal/server/server.go Populates new TotalPackages / EcosystemFilters fields for the packages list page.
internal/server/dashboard.go Adds pill class helpers and buildEcosystemFilters; extends page data types.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/server/server.go
Comment on lines +801 to +808
var ecosystemFilters []EcosystemFilter
var totalPackages int64
if stats, err := s.db.GetCacheStats(); err != nil {
s.logger.Error("failed to get cache stats for ecosystem filters", "error", err)
} else {
totalPackages = stats.TotalPackages
ecosystemFilters = buildEcosystemFilters(stats.EcosystemCounts)
}
Comment on lines +21 to +22
<a href="/ui/packages?ecosystem={{.Ecosystem}}{{if $.SortBy}}&sort={{$.SortBy}}{{end}}"
class="{{ecosystemPillClass .Ecosystem}}{{if eq $.Ecosystem .Ecosystem}} ring-2 ring-current ring-offset-1 dark:ring-offset-gray-900{{end}}">
Comment on lines +15 to +16
<a href="/ui/packages{{if .SortBy}}?sort={{.SortBy}}{{end}}"
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 hover:opacity-90{{if not .Ecosystem}} ring-2 ring-gray-400 dark:ring-gray-500 ring-offset-1 dark:ring-offset-gray-900{{end}}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants