This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new ec3c55505 fix(alerts): render the rule count in the pagination total
(#4641)
ec3c55505 is described below
commit ec3c555057a60d7074ba38c8242d0082d705a138
Author: Apulupie <[email protected]>
AuthorDate: Thu Oct 1 17:24:05 2026 +0800
fix(alerts): render the rule count in the pagination total (#4641)
Co-authored-by: Frun1na <[email protected]>
---
web/src/i18n/translations.ts | 1 +
web/src/pages/ops/__tests__/AlertsPage.test.tsx | 14 ++++++++++++++
web/src/pages/ops/alerts.tsx | 2 +-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/web/src/i18n/translations.ts b/web/src/i18n/translations.ts
index 2c695edae..2b8f36e65 100644
--- a/web/src/i18n/translations.ts
+++ b/web/src/i18n/translations.ts
@@ -913,6 +913,7 @@ const translations: Record<string, Record<Lang, string>> = {
en: 'Configure business-flow alert rules for consumer lag, DLQ, and
notification channels',
},
'alerts.totalRules': { zh: '规则总数', en: 'Total Rules' },
+ 'alerts.totalRulesWithCount': { zh: '共 {count} 条规则', en: '{count} rules
total' },
'alerts.enabled': { zh: '已启用', en: 'Enabled' },
'alerts.disabled': { zh: '已禁用', en: 'Disabled' },
'alerts.triggered24h': { zh: '24h 触发', en: 'Triggered (24h)' },
diff --git a/web/src/pages/ops/__tests__/AlertsPage.test.tsx
b/web/src/pages/ops/__tests__/AlertsPage.test.tsx
index 1f83c9af2..c130370e9 100644
--- a/web/src/pages/ops/__tests__/AlertsPage.test.tsx
+++ b/web/src/pages/ops/__tests__/AlertsPage.test.tsx
@@ -357,6 +357,20 @@ describe('AlertsPage', () => {
expect(screen.getByText('21')).toBeInTheDocument();
});
+ it('renders the pagination total with the rule count', async () => {
+ vi.mocked(listAlertRulesPage).mockClear();
+ vi.mocked(listAlertRulesPage).mockResolvedValue({
+ items: [cloneRule(alertRules[0])],
+ total: 21,
+ page: 1,
+ size: 20,
+ });
+ renderPage();
+
+ await screen.findByText('Broker disk usage');
+ expect(await screen.findByText('共 21 条规则')).toBeInTheDocument();
+ });
+
it('resets page, search and status filters when the domain switches', async
() => {
vi.mocked(listAlertRulesPage).mockClear();
vi.mocked(listAlertRulesPage).mockResolvedValue({
diff --git a/web/src/pages/ops/alerts.tsx b/web/src/pages/ops/alerts.tsx
index d9a301831..0a26c7c9a 100644
--- a/web/src/pages/ops/alerts.tsx
+++ b/web/src/pages/ops/alerts.tsx
@@ -1046,7 +1046,7 @@ const AlertsPage = ({ domain = 'CLUSTER' }:
AlertsPageProps) => {
pageSize={pageSize}
total={totalRules}
showSizeChanger
- showTotal={(total) => t('alerts.totalRules', { count: total })}
+ showTotal={(total) => t('alerts.totalRulesWithCount', { count:
total })}
pageSizeOptions={[10, 20, 50, 100]}
onChange={(nextPage, nextPageSize) => {
setPage(nextPage);