unbridled-41 opened a new issue, #4610:
URL: https://github.com/apache/rocketmq-dashboard/issues/4610
### Studio Version
branch: master
git commit id: d50ffecc9d7e8f8f46da64198831bd7952e6974e
### Problem
The ops audit table (`web/src/pages/ops/audit.tsx:316-406`) and the business
alert rules table (`web/src/pages/ops/alerts.tsx:647-697`) are server-paginated
— the data source holds only the current page's rows while `current`/`total`
come from the server — but every sortable column uses a client-side `sorter`.
Clicking a column header re-orders only the ~20 rows of the current page while
the sort arrows and the pagination suggest a full-data sort.
- `audit.tsx`: 6 client sorters; the time column additionally sets
`defaultSortOrder: 'descend'`, presenting a sort arrow on first paint even
though the arrow only re-states the server's `ORDER BY gmt_create DESC` for one
page.
- `alerts.tsx`: 6 client sorters on the same pattern (Table with
`pagination={false}` plus an external `Pagination` bound to server `total`).
Trigger (deterministic): with more than one page of audit records, click the
操作人 (operator) column header. The visible page re-orders by operator, the
header shows the active sort arrow, but records on other pages are not
considered — an operator looking for "the earliest failure" or "all records of
operator X sorted" gets a page-local ordering that silently misrepresents the
dataset. Switching pages loses the sort arrow state entirely (uncontrolled
sorter), so the UI alternates between "sorted" and "unsorted" appearances page
by page.
### Evidence
- `web/src/pages/ops/audit.tsx:316-406` columns define `sorter: (a, b) =>
...` with no `onChange` wiring to the query; `listAuditRecords`
(`api/audit.ts`) sends no sort parameters, and the server query is fixed `ORDER
BY gmt_create, id DESC` (`MybatisPlusAuditRepository.java:64`).
- `web/src/pages/ops/audit.tsx:521-537`: controlled `pagination={{ current,
pageSize, total }}` with server-side `total` — confirming the dataSource is one
page of a larger set.
- `web/src/pages/ops/alerts.tsx:1003-1017`: Table `pagination={false}` +
external `Pagination` with server `totalRules`; columns at `:647-697` carry the
same client sorters.
- Note the repo already documents this page's server-side semantics:
`AuditRepository.applyFilters` javadoc says the paged list, summary and hotspot
queries must share one source of truth.
### Impact
- Page-local sort presented as a global sort: operators make decisions (find
earliest/oldest, group by operator) on a reordered slice of 20 rows while up to
`total - 20` rows are invisible and unordered.
- `defaultSortOrder: 'descend'` on audit time makes the very first screen
claim a sort state the user did not choose, and it duplicates (only for the
current page) what the server already guarantees.
### Expected behavior
Either (a) sorting is performed server-side (sort field/order passed to the
list API and applied in the SQL order-by), or (b) client sorters are removed
from server-paginated columns so the UI never claims a sort it cannot deliver.
The minimal, non-breaking option is (b); the header arrows then reflect exactly
what is shown.
### Related work
- #835 (closed) and PR #2857 (closed, unmerged): null-safety of the audit
timestamp comparator (`NaN` comparisons) — a different defect inside the same
sorter functions; the page-local-sort semantics were not covered.
- #3337/#4331-family fixes wired server-side parameters for other inventory
interactions (search, refresh) but left sorting client-side.
### PR
Fix incoming.
--
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]