RockteMQ-AI commented on code in PR #2581:
URL:
https://github.com/apache/rocketmq-dashboard/pull/2581#discussion_r3853502309
##########
server/src/main/java/org/apache/rocketmq/studio/ops/alert/AlertService.java:
##########
@@ -224,16 +226,21 @@ public List<SystemAlertVO> listAlerts(String level) {
return alertRepository.findAlerts(level);
}
+ public PageResult<SystemAlertVO> listAlerts(String level, int page, int
pageSize) {
+ validateAlertPagination(page, pageSize);
+ String normalizedLevel = StringUtils.hasText(level) ? level.trim() :
level;
+ log.info("Listing system alerts, level={}, page={}, pageSize={}",
Review Comment:
**[Info]** The `findAlertById` optimization for `acknowledgeAlert` is
excellent — O(1) lookup instead of O(n) full-table scan. This also fixes a
subtle correctness issue: the old code loaded *all* alerts (including
acknowledged ones) just to find one by ID.
##########
web/src/pages/ops/systemAlerts.tsx:
##########
@@ -41,34 +41,43 @@ const SystemAlertsPage = () => {
};
const [alerts, setAlerts] = useState<SystemAlert[]>([]);
- const [levelFilter, setLevelFilter] = useState<string>('all');
+ const [total, setTotal] = useState(0);
+ const [page, setPage] = useState(1);
Review Comment:
**[Info]** Good use of `requestIdRef` for stale-response protection. The
pattern of incrementing a request counter and ignoring responses that don't
match the latest request is the correct approach for React concurrent
rendering. The `useCallback` memoization of `loadPage` also prevents
unnecessary re-renders.
--
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]