Fix endpoints search/filter to work across all pages - #229
Merged
Merged
Conversation
…nt one Endpoints/Index.vue filtered the search box and status dropdown purely client-side over props.endpoints.data, which is only the current paginated page (15 records). Any account with more than one page of endpoints would see "No endpoints found" for a search term or status that existed on another page, even though a real match existed. DashboardController::endpoints() now applies the search/status filters server-side before paginating. The Vue page submits filters as query params via Inertia's router.get, mirroring the pattern already used on the Events and Deliveries pages. Fixes #111
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 was broken
The Endpoints management page's search box and status filter (
resources/js/Pages/Endpoints/Index.vue) only operated onprops.endpoints.data, which is just the current paginated page (15 records) returned by Laravel's paginator. A user with more than 15 endpoints who searched for a name/URL/description, or filtered by "Active"/"Inactive", would see "No endpoints found" even when a real match existed on another page — functionally broken search/filtering on a core management page.This is the same root-cause bug class already fixed for the Events page in #227 (originally #97) — this addresses the separate, unfixed instance on the Endpoints page.
What changed
DashboardController::endpoints()now applies thesearch(matchingname,url,description) andstatus(active/inactive) filters server-side, before pagination, and returns the appliedfiltersas a prop.Endpoints/Index.vuenow submits the search/status filters as query params via Inertia'srouter.get(on Enter for the search box, on change for the status dropdown, and on "Clear"), mirroring the pattern already used on the Events and Deliveries pages, instead of filtering only the current page's data client-side.tests/Feature/DashboardEndpointsSearchFilterTest.phpcovering: finding a match beyond the first page via search, finding a match beyond the first page via status filter, and confirming search still can't leak another user's endpoints.Full test suite passes (264 passed, 1 pre-existing skip).
Fixes #111