Added search to new case contact datatable view#6627
Merged
compwron merged 10 commits intorubyforgood:mainfrom Dec 16, 2025
Merged
Added search to new case contact datatable view#6627compwron merged 10 commits intorubyforgood:mainfrom
compwron merged 10 commits intorubyforgood:mainfrom
Conversation
compwron
previously approved these changes
Dec 15, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements server-side DataTables functionality for the new case contacts table to improve performance with large datasets. The implementation includes backend processing via a CaseContactDatatable class, policy updates to authorize access, and comprehensive frontend column renderers.
Key Changes:
- Server-side DataTables processing with search across creator name, email, case number, notes, and contact types
- Authorization via
CaseContactPolicy#datatable?for admins, supervisors, and volunteers - 11 column renderers handling icons, links, duration formatting, and draft badges
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| app/datatables/case_contact_datatable.rb | New datatable class implementing server-side search, ordering, and pagination with ActiveRecord queries |
| app/policies/case_contact_policy.rb | Added datatable? permission aliased to existing authorization method |
| app/controllers/case_contacts/case_contacts_new_design_controller.rb | Added datatable action to return JSON response |
| config/routes.rb | Added POST route for datatable endpoint |
| app/views/case_contacts/case_contacts_new_design/index.html.erb | Updated data-source attribute to point to new datatable endpoint |
| app/javascript/src/dashboard.js | Configured DataTables with server-side processing, AJAX setup, and 11 column renderers |
| app/javascript/tests/dashboard.test.js | Comprehensive Jest tests for DataTable configuration and column renderers |
| spec/datatables/case_contact_datatable_spec.rb | RSpec tests for data structure, search, ordering, pagination, and edge cases |
| spec/policies/case_contact_policy_spec.rb | Tests for datatable permission authorization |
| spec/requests/case_contacts/case_contacts_new_design_spec.rb | Integration tests for datatable endpoint authorization and scoped data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
Thanks for triggering the review @compwron addressed final two issues and fixed tests |
compwron
approved these changes
Dec 16, 2025
Collaborator
|
:) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What github issue is this PR for, if any?
Resolves #6504
What changed, and why?
Added server-side search to the new case contacts table for better performance with large datasets.
Backend:
CaseContactDatatableto handle server-side DataTables processing with search across creator name, creator email, case number, notes, and contact typesdatatable?permission inCaseContactPolicyfor admins, supervisors, and volunteers.to_sqlpattern instead of raw SQL for maintainabilityFrontend:
dashboard.jsto configure DataTables with server-side processingWhy?
Loading all case contacts client-side would get slow with lots of data. Server-side processing lets the database handle filtering and pagination, only returning one page at a time.
How is this tested?
rspec (46 tests):
spec/datatables/case_contact_datatable_spec.rb- 35 tests for data structure, search, ordering, pagination, sanitizationspec/policies/case_contact_policy_spec.rb- 3 tests for permissionsspec/requests/case_contacts/case_contacts_new_design_spec.rb- 8 tests for endpoint authorization and scoped datajest (48 tests):
app/javascript/__tests__/dashboard.test.js- tests for DataTable config, AJAX setup, all column renderers