tju-yxq opened a new pull request, #5483:
URL: https://github.com/apache/rocketmq-dashboard/pull/5483
### Which Issue(s) This PR Fixes
- Fixes #4554
- Fixes #4556
### Brief Description
Consolidates the two result-set-wide alert counter PRs into one cohesive
change, following the grouping guideline in #2107 (both serve one purpose — the
alert pages' summary counters must describe the whole filtered result set, not
the current page):
1. **System alert feed** (#4554): the page header reported an unacknowledged
count computed from the loaded page only, so with 45 unacknowledged alerts it
said "20" and the number changed with the filter/pagination. The feed now
exposes a server-side summary (GET /api/system-alerts/summary) computing total
and unacknowledged over the same filters the table queries, and the header
renders those.
2. **Alert rules** (#4556): the rules page's counters
(total/enabled/triggered-since) were likewise computed from the current page.
The rule list endpoints now return result-set-wide counters over the active
filters, and the page renders them.
Both summaries reuse the repository's existing filter conditions, so a
counter can never disagree with the rows its filter describes.
### How Did You Test This Change?
All affected suites together on the consolidated branch:
```
cd server && mvn
'-Dtest=AlertServiceTest,MybatisPlusAlertRepositoryTest,SystemAlertControllerTest,AlertRuleControllerTest,ClusterAlertRuleControllerTest'
test
[INFO] Tests run: 85, Failures: 0 ... -- in ...AlertServiceTest
[INFO] Tests run: 20, Failures: 0 ... -- in ...MybatisPlusAlertRepositoryTest
[INFO] Tests run: 13, Failures: 0 ... -- in ...SystemAlertControllerTest
[INFO] Tests run: 23, Failures: 0 ... -- in ...AlertRuleControllerTest
[INFO] Tests run: 7, Failures: 0 ... -- in ...ClusterAlertRuleControllerTest
[INFO] Tests run: 148, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
```
```
cd web && npm test -- SystemAlertsPage.test.tsx AlertsPage.test.tsx --run
Test Files 2 passed (2)
Tests 49 passed (49)
```
The regression tests pin the counters to the server summary (page-scoped
counting removed) and the summary endpoints' filter round-trips.
```
cd web && npm run lint
✖ 10 problems (0 errors, 10 warnings) # the trunk baseline
```
```
cd web && npx tsc -b --force
(no output — exit 0)
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in (one
purpose — result-set-wide alert counters, per the grouping guideline #2107)
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (counter semantics only)
--
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]