POC: filter by ecosystem using pills - #319
Draft
kokes wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
🟡 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 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}}"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found the dropdown for filtering by ecosystem to be lacking for two reasons:
(There was also the issue of jagged hit counts I addressed for the dashboard in an earlier PR.)
It now looks like this:
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.