You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/10/06 05:43:24 UTC

[PR] fix(ops): show the count in the alert rules pagination total [rocketmq-dashboard]

zjncs opened a new pull request, #5616:
URL: https://github.com/apache/rocketmq-dashboard/pull/5616

   Closes #5615
   
   ## Problem
   
   `showTotal={(total) => t('alerts.totalRules', { count: total })}` passed `count` as a `t()` param, but the `totalRules` template has **no `{count}` placeholder** (`{ zh: '规则总数', en: 'Total Rules' }` — it doubles as the plain header-card label at line 918, where the count is a separate element). The i18n helper only substitutes `{key}` occurrences, so the count was silently dropped and the pagination showed "Total Rules" with no number — unlike every other paginated page (e.g. deliveries: `` showTotal: (count) => `${t('common.total')} ${count}` ``).
   
   ## Fix
   
   Append the count explicitly, keeping the domain label:
   
   ```tsx
   showTotal={(total) => `${t('alerts.totalRules')} ${total}`}
   ```
   
   ## Verification
   
   - New `AlertsPaginationTotal.test.tsx` (deterministic): renders the page with one rule and asserts the `.ant-pagination-total-text` contains a digit and the total — **FAILS on master** (label only, no number), **PASSES with this change** ("规则总数 1")
   - Regression: the existing `AlertsPage.test.tsx` suite 28/28 in isolation
   - Mutation check: reverting the one-line change makes the new test fail again; restoring it passes
   
   ## Collision note
   
   `alerts.tsx` is touched by several open PRs but none modifies this pagination line; the change is a single expression at ~1048 with a comment.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org