Conversation
…inga into report-index-page
There was a problem hiding this comment.
Pull request overview
Adds a dedicated Reports index page and wires it into the admin sidebar so admins can navigate to and manage generated reports.
Changes:
- Adds
reports#indexUI (with action buttons) and updates routes to exposeindexanddestroy, removing the oldfiltercollection route. - Moves the “filtering” behavior into
reports#new(GET params) and updates the new report form/tests accordingly. - Adds i18n keys (EN/ES) for the new index/destroy UI and introduces a new sidebar icon.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
test/controllers/reports_controller_test.rb |
Updates route/auth tests and adds coverage for index and destroy flows. |
config/routes.rb |
Exposes reports#index and reports#destroy; removes filter route. |
config/locales/es/reports.es.yml |
Adds ES strings for reports index and destroy confirmations/success. |
config/locales/es/components.es.yml |
Adds ES sidebar label for “Reports”. |
config/locales/en/reports.en.yml |
Adds EN strings for reports index and destroy confirmations/success. |
config/locales/en/components.en.yml |
Adds EN sidebar label for “Reports”. |
app/views/reports/new.html.erb |
Changes filter form target from removed filter_reports_path to new_report_path. |
app/views/reports/index.html.erb |
Introduces reports listing table + actions (view/edit/delete) and create button. |
app/controllers/reports_controller.rb |
Adds index and destroy; moves filter logic into new. |
app/components/sidebar_component.rb |
Adds “Reports” navigation item using the new icon. |
app/assets/images/icons/reports-fill.svg |
Adds new reports icon asset used by sidebar. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,9 +1,33 @@ | |||
| class ReportsController < ApplicationController | |||
| def index | |||
| @reports = Report.all | |||
There was a problem hiding this comment.
@reports = Report.all will load and render every report, and Shared::IndexTableComponent renders all provided records into the DOM (client-side pagination/filtering). This is unbounded and can degrade performance as the reports table grows; consider ordering and adding server-side limiting/pagination (e.g., order(created_at: :desc) plus real pagination) before passing records to the table.
| @reports = Report.all | |
| page = params[:page].to_i | |
| page = 1 if page < 1 | |
| per_page = 50 | |
| @reports = Report.order(created_at: :desc) | |
| .limit(per_page) | |
| .offset((page - 1) * per_page) |
TL;DR
Added icon and navigation for the reports view page.
What is this PR trying to achieve?
To add navigation for viewing the reports page.
How did you achieve it?
Added the Reports sidebar navigation item (using the reports-fill icon) and adds the i18n keys so the label appears correctly in supported locales.
Checklist