Feat: Add misc resources - announcements, issue-circuit and task runs to Avo#7316
Feat: Add misc resources - announcements, issue-circuit and task runs to Avo#7316ShinichiShi wants to merge 1 commit intoCircuitVerse:masterfrom
Conversation
WalkthroughAdded three new Avo admin resource classes with corresponding controllers. The Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
app/avo/resources/announcement.rb (1)
22-22: Nit: missing space aftersortable:.Inconsistent with line 21 and the rest of the file.
- field :updated_at, as: :date_time, readonly: true, sortable:true, hide_on: %i[new edit] + field :updated_at, as: :date_time, readonly: true, sortable: true, hide_on: %i[new edit]
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 02045f28-f6b7-4e39-9cf2-7fa097b4f5f7
📒 Files selected for processing (6)
app/avo/resources/announcement.rbapp/avo/resources/issue_circuit_datum.rbapp/avo/resources/maintenance_tasks_run.rbapp/controllers/avo/announcements_controller.rbapp/controllers/avo/issue_circuit_data_controller.rbapp/controllers/avo/maintenance_tasks_runs_controller.rb
| def fields | ||
| field :id, as: :id, link_to_resource: true | ||
| field :body, as: :textarea, required: true | ||
| field :link, as: :text | ||
|
|
||
| field :created_at, as: :date_time, readonly: true, sortable: true, hide_on: %i[new edit] | ||
| field :updated_at, as: :date_time, readonly: true, sortable:true, hide_on: %i[new edit] | ||
| end |
There was a problem hiding this comment.
Missing start_date / end_date fields.
The announcements table schema includes start_date and end_date (per db/migrate/20201013035451_create_announcements.rb), which are semantically important for announcement lifecycle management. They're not exposed here, so admins can't view or edit them through Avo. Consider adding them as :date_time fields.
Proposed addition
field :body, as: :textarea, required: true
field :link, as: :text
+ field :start_date, as: :date_time
+ field :end_date, as: :date_time
field :created_at, as: :date_time, readonly: true, sortable: true, hide_on: %i[new edit]|
|
||
| def fields | ||
| field :id, as: :id, link_to_resource: true | ||
| field :body, as: :textarea, required: true |
There was a problem hiding this comment.
required: true not mirrored at the model level.
Announcement has no validates :body, presence: true (per app/models/announcement.rb) and the DB column is nullable. The Avo required: true only adds a client-side hint; submissions that bypass it will still persist with a blank body. Consider adding a model-level validation for consistent enforcement.
|
@ShinichiShi Existing resources are to be fixed before adding more resources to avo. Please check the sentry errors |
Fixes #7314
Describe the changes you have made in this PR -
This PR completes the addition of all the resources to Avo dashboard by adding the remaining independent ones - announcements, issue-circuit data and maintainance-task runs
Screenshots of the UI changes (If any) -
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
The current resources are independent. These were present in the RailsAdmin dashboard and uses similar logic.
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.
Summary by CodeRabbit