Make model catalog more compact#6
Conversation
|
Warning Review limit reached
More reviews will be available in 50 minutes and 27 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a ChangesModels Browser Card/Table View Toggle
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7404d70309
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| hx-get="/models?full=1" | ||
| hx-target="#models-browser" | ||
| hx-swap="outerHTML" | ||
| hx-include="#models-filters" | ||
| hx-vals='{"view":"table"}'>Audit table</button> |
There was a problem hiding this comment.
Preserve presets when toggling audit view
When this toggle is used from a role's Suggest results, the request is only /models?full=1 plus #models-filters; that form does not submit .Filters.ActivePreset, so buildIndexData leaves the preset path and rebuilds the ordinary catalog. The Audit table button therefore clears the recommendation banner/sections instead of showing the same suggested candidates in table mode; include the active preset in the submitted state when it is set.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/adminapi/templates/partials_models_row.html (1)
62-62: 💤 Low valueUnused variable
$modelID.This variable is defined but never referenced within
model_card. Themodel_actionstemplate defines its own$modelIDfrom.Model.ID. Consider removing this line to reduce noise.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/adminapi/templates/partials_models_row.html` at line 62, The variable assignment `$modelID := .ID` at line 62 in the partials_models_row.html template is defined but never used within the model_card template block. Remove this unused variable declaration to eliminate unnecessary code and reduce template noise. The model_actions template handles its own modelID variable definition from .Model.ID, so this declaration is redundant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/adminapi/adminapi_test.go`:
- Around line 212-223: In the "table audit" subtest, add negative assertions
after the existing check for "catalog-audit-table" to verify that card-related
markers are absent from the rendered HTML. This ensures that table mode and card
mode are mutually exclusive and prevents regressions where both modes could be
rendered simultaneously. Use strings.Contains with a negation check to assert
that card mode markers do not appear in the output when in table view mode.
In `@internal/adminapi/templates/partials_models_row.html`:
- Line 125: The hx-vals attribute at line 125 embeds {{$modelID}} directly into
a JSON string without proper escaping, which will break the JSON if the model ID
contains special characters like double quotes or backslashes. Fix this by
either using Go's JSON marshaling capabilities in the template to properly
escape the model_id value before embedding it in hx-vals, or by moving the
dynamic model_id value into hidden input fields within the HTML while keeping
only static values in the hx-vals attribute to ensure the JSON remains
well-formed regardless of model ID content.
---
Nitpick comments:
In `@internal/adminapi/templates/partials_models_row.html`:
- Line 62: The variable assignment `$modelID := .ID` at line 62 in the
partials_models_row.html template is defined but never used within the
model_card template block. Remove this unused variable declaration to eliminate
unnecessary code and reduce template noise. The model_actions template handles
its own modelID variable definition from .Model.ID, so this declaration is
redundant.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3accfb2f-04b9-41a4-ac57-997a34a576a0
📒 Files selected for processing (5)
internal/adminapi/adminapi_test.gointernal/adminapi/handlers.gointernal/adminapi/templates/partials_layout.htmlinternal/adminapi/templates/partials_models_browser.htmlinternal/adminapi/templates/partials_models_row.html
7404d70 to
03560c6
Compare
Summary
Test Plan
Summary by CodeRabbit
New Features
Tests
Style