Skip to content

Feat: Add misc resources - announcements, issue-circuit and task runs to Avo#7316

Open
ShinichiShi wants to merge 1 commit intoCircuitVerse:masterfrom
ShinichiShi:avo-migrate-misc-resource
Open

Feat: Add misc resources - announcements, issue-circuit and task runs to Avo#7316
ShinichiShi wants to merge 1 commit intoCircuitVerse:masterfrom
ShinichiShi:avo-migrate-misc-resource

Conversation

@ShinichiShi
Copy link
Copy Markdown
Contributor

@ShinichiShi ShinichiShi commented Apr 16, 2026

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) -

image ---

Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance:

  • I have reviewed every single line of the AI-generated code
  • I can explain the purpose and logic of each function/component I added
  • I have tested edge cases and understand how the code handles them
  • I have modified the AI output to follow this project's coding standards and conventions

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

  • I have added proper PR title and linked to the issue
  • I have performed a self-review of my code
  • I can explain the purpose of every function, class, and logic block I added
  • I understand why my changes work and have tested them thoroughly
  • I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • My code follows the project's style guidelines and conventions

Note: Please check Allow edits from maintainers if you would like us to assist in the PR.

Summary by CodeRabbit

  • New Features
    • Added admin panel for announcements with searchable content and link management
    • Added admin interface for issue circuit data with data field display
    • Added admin interface for maintenance task runs with task monitoring, status tracking, error details, and execution metrics

@ShinichiShi ShinichiShi requested a review from a team as a code owner April 16, 2026 20:38
@ShinichiShi ShinichiShi requested review from senbo1 and removed request for a team April 16, 2026 20:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2026

Walkthrough

Added three new Avo admin resource classes with corresponding controllers. The Announcement resource displays the body attribute, includes a Ransack-based search query filtering by body content, and defines fields for id, body (textarea, required), link, and timestamps. The IssueCircuitDatum resource maps to the IssueCircuitDatum model with fields for id, data (textarea), and timestamps. The MaintenanceTasksRun resource is configured for MaintenanceTasks::Run with fields for task metadata, status badge with color-coding, error details, and serialized arguments/metadata. Each resource has a corresponding empty controller inheriting from Avo::ResourcesController.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and uses non-descriptive terms like 'misc resources' without clarifying which specific resources are being added or their purpose. Replace 'misc resources' with specific resource names (e.g., 'Add Announcement, IssueCircuitData, and MaintenanceTasksRun resources to Avo').
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed All coding requirements from issue #7314 are met: Announcement, IssueCircuitData, and MaintenanceTasksRun resources added to Avo with corresponding controllers and field configurations.
Out of Scope Changes check ✅ Passed All changes are directly aligned with adding the three specified resources to Avo; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/avo/resources/announcement.rb (1)

22-22: Nit: missing space after sortable:.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 17a6d88 and dd14fcb.

📒 Files selected for processing (6)
  • app/avo/resources/announcement.rb
  • app/avo/resources/issue_circuit_datum.rb
  • app/avo/resources/maintenance_tasks_run.rb
  • app/controllers/avo/announcements_controller.rb
  • app/controllers/avo/issue_circuit_data_controller.rb
  • app/controllers/avo/maintenance_tasks_runs_controller.rb

Comment on lines +16 to +23
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

@tachyons
Copy link
Copy Markdown
Member

@ShinichiShi Existing resources are to be fixed before adding more resources to avo. Please check the sentry errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Add announcement resources to Avo

2 participants