[dataquery] Paginate stored query runs #11199
Description
Is your feature request related to an existing module?
dataquery.
Describe the solution you'd like
This is a change to the endpoint only. No front-end change is in scope.
GET /dataquery/queries/{queryID}/run/{runID} returns every row of a stored run in one response. Add count and offset query parameters so a client can request one page at a time, following the existing pattern of an optional parameter with a fallback.
The rows are already cached in dataquery_run_results keyed by RunID. A client runs the query once, keeps the run ID it gets back, and pages through the cache on every request after that. Both parameters are optional, so existing callers are unaffected.
Three things the implementation has to account for:
- The endpoint filters the rows down to the candidates the user can access. That filter has to be applied before the page is cut, otherwise a page comes back short and the offsets stop lining up.
- The response needs to carry the total row count after filtering, so the client knows how many pages there are.
- PR #11191 rewrites the same method. This should be built on top of it.
Additional context
jsx/DataTable receives the full row array as a prop and pages in component state, so sorting, filtering and CSV export all operate over every row it holds. A paged source breaks those three unless the table also learns to delegate them to the server. That is separate work. See #7332.
Activity