Update layout for projects#1305
Conversation
✅ Deploy Preview for antenna-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for antenna-ssec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThis PR implements sorting functionality for the projects listing with backend API support and a refactored SortControl component. It also includes related UI adjustments across multiple pages and a minor dependency upgrade. ChangesSorting Feature and UI Cleanup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Actionable comments posted: 1
🤖 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 `@ami/main/api/views.py`:
- Line 158: The Project model's name field is used in ordering (ordering_fields
includes "name") but lacks a DB index; update the Project model by adding
db_index=True to the name field declaration (Project.name) or alternatively
declare an Index on "name" inside the Project.Meta.indexes so sorts by name use
the index; migrate the DB after change to apply the new index.
🪄 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
Run ID: 188d3959-ae86-4161-a080-ca9ff08e9603
⛔ Files ignored due to path filters (1)
ui/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (11)
ami/main/api/views.pyui/package.jsonui/src/design-system/components/sort-control.tsxui/src/pages/jobs/jobs.tsxui/src/pages/occurrences/occurrences.tsxui/src/pages/project-details/new-project-dialog.tsxui/src/pages/project/team/team-columns.tsxui/src/pages/project/team/team.tsxui/src/pages/projects/project-gallery.tsxui/src/pages/projects/projects.tsxui/src/utils/language.ts
💤 Files with no reviewable changes (2)
- ui/src/pages/project/team/team-columns.tsx
- ui/src/pages/projects/project-gallery.tsx
| serializer_class = ProjectSerializer | ||
| pagination_class = ProjectPagination | ||
| permission_classes = [ObjectPermission] | ||
| ordering_fields = ["name", "created_at", "updated_at"] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if Project model's name field has a database index
rg -nP --type=py -C5 'class Project\(' --glob '**/models*.py' | rg -P '(db_index|Index|indexes)' -A10 -B10Repository: RolnickLab/antenna
Length of output: 44
🏁 Script executed:
# Find Project model definition
rg -n 'class Project' --type=pyRepository: RolnickLab/antenna
Length of output: 1625
🏁 Script executed:
# Check if models files exist in ami/main
find ami/main -name '*models*' -type fRepository: RolnickLab/antenna
Length of output: 81
🏁 Script executed:
# Get context around line 158 in views.py to understand the model being used
cat -n ami/main/api/views.py | sed -n '150,170p'Repository: RolnickLab/antenna
Length of output: 1041
🏁 Script executed:
# Read the Project model definition
cat -n ami/main/models.py | sed -n '266,350p'Repository: RolnickLab/antenna
Length of output: 3554
🏁 Script executed:
# Also search for Meta class and any indexes in Project model
rg -n 'class Project\(|name.*Field|db_index|class Meta' ami/main/models.py | head -50Repository: RolnickLab/antenna
Length of output: 1559
🏁 Script executed:
# Read lines around 485 to check if Meta class is part of Project model
cat -n ami/main/models.py | sed -n '470,495p'Repository: RolnickLab/antenna
Length of output: 1354
🏁 Script executed:
# Read the complete Meta class for Project model
cat -n ami/main/models.py | sed -n '485,550p'Repository: RolnickLab/antenna
Length of output: 4529
🏁 Script executed:
# Continue reading the Meta class to see if indexes are defined
cat -n ami/main/models.py | sed -n '550,570p'Repository: RolnickLab/antenna
Length of output: 770
🏁 Script executed:
# Final confirmation: search for any indexes definition in Project model
rg -n 'indexes\s*=' ami/main/models.py | head -20Repository: RolnickLab/antenna
Length of output: 307
🏁 Script executed:
# Check which models have indexes defined (context around those lines)
rg -n -B10 'indexes\s*=' ami/main/models.py | grep -E '(^[0-9]+-class |indexes)' | head -30Repository: RolnickLab/antenna
Length of output: 307
🏁 Script executed:
# Check if there are any migrations that add an index to Project.name
find . -name '*migrations*' -type d | head -5Repository: RolnickLab/antenna
Length of output: 191
🏁 Script executed:
# Search for any migration files that might add index to name field
rg -n 'name.*index|AddIndex.*name' --type=py -i | grep -i project | head -20Repository: RolnickLab/antenna
Length of output: 44
Add database index to Project.name field for sort performance.
The name field in the Project model currently lacks a database index, but is included in ordering_fields, enabling API sorting by project name. As the number of projects grows, queries sorted by name will scan the full table without an index. Add db_index=True to the name field in ami/main/models.py line 269 or define an index in the Project model's Meta class.
🧰 Tools
🪛 Ruff (0.15.12)
[warning] 158-158: Mutable default value for class attribute
(RUF012)
🤖 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 `@ami/main/api/views.py` at line 158, The Project model's name field is used in
ordering (ordering_fields includes "name") but lacks a DB index; update the
Project model by adding db_index=True to the name field declaration
(Project.name) or alternatively declare an Index on "name" inside the
Project.Meta.indexes so sorts by name use the index; migrate the DB after change
to apply the new index.

The more projects we add, the more difficult the project page is to navigate. For most users, the main view will be a more compact list of projects they are a member of, but for super admins with access to all projects it can be a bit tricky. Also, in some cases, users might want to explore public projects they are not a member of. Also that list can get pretty long!
In this PR, we make some simple UI updates, to improve the situation a bit.
Summary of changes
Thoughts for future
A search feature would be nice, but it requires a few more backend updates and maybe not our highest prio. Also a more compact table view for projects could be interesting to explore...
Deploy notes
Sort projects by name required a tiny BE update.
Screenshots
Before

After

Summary by CodeRabbit
New Features
Bug Fixes
UI Improvements
Dependencies
nova-ui-kitto v1.1.36.