zhaohai666 opened a new pull request, #2517:
URL: https://github.com/apache/rocketmq-dashboard/pull/2517
# PR: Server-side paging for message query
**Branch:** `feature/studio-message-paging`
## Summary
Introduces server-side pagination for the message query endpoint and moves
the
message query page from client-side pagination of a full result set to paged
requests, so large result sets no longer overload the browser or the API
response.
## Backend
- `MessageProvider` / `InstanceProvider`
- New default `queryMessagesPage(...)` that throws `501 Paged message query
is not supported by this provider`, keeping non-Apache providers safe.
- `RocketMQMessageProvider`
- Overrides `queryMessagesPage(...)`; slices the provider-resolved query
window using `Pagination.pageOffset` and returns a `PageResult`.
- `ApacheInstanceProvider`
- Delegates the new method to `MessageProvider`.
- `MessageService`
- New `queryMessagesPage(...)` validates the query window, dispatches
through
the instance registry, and records query history with the paged total.
- `MessageController`
- New `GET /api/messages/page` endpoint with `page` (default 1) and
`pageSize` (default 20) request params.
## Frontend
- `api/message.ts`
- New `MessagePageResult` type and `queryMessagesPage` API call.
- `services/messageService.ts`
- `queryMessagesPage` wrapper with mock-mode fallback (slices in memory).
- `pages/instance/message.tsx`
- Tracks `page` / `pageSize` / `total` state; the query form issues paged
requests and the table re-queries on page or page-size change. The
"查询完成" toast now reports the server-side total instead of the local
array length.
- Tests updated: `MessagePage.test.tsx` and `MessagePageAsyncState.test.tsx`
now mock `queryMessagesPage` with `PageResult` shapes and assert the extra
`page` / `pageSize` parameters.
## Verification
- `mvn -o test` — all server tests pass
- `tsc -b` — no type errors
- `vitest run` on both message page suites — 25 tests pass
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]