yyqdbngt opened a new pull request, #2859: URL: https://github.com/apache/rocketmq-dashboard/pull/2859
## Summary - Extract an exported `wasTriggeredWithin()` helper in the alert rules page: a rule only counts toward the "triggered in last 24h" badge when `lastTriggered` parses to a timestamp after the cutoff - Guard the mock-mode time filter in `listSystemAlertsPage()`: alerts whose `time` cannot be parsed are excluded when a `from`/`to` range is active, and unparseable range bounds are treated as absent - Add regression tests for both (helper unit tests plus a service-level filter test) ## Why `new Date(r.lastTriggered).getTime()` yields `NaN` for unparseable values, and `NaN > dayAgo` is always `false` — a rule with a malformed `lastTriggered` was silently dropped from the 24h trigger badge with no way to tell that its value was bad. The same pattern in `listSystemAlertsPage()` made time-range comparisons against `NaN` always evaluate to `false`, so alerts with unparseable `time` values slipped through `from`/`to` filters (the mock data's time-of-day-only `time` values are exactly such values), returning rows that do not match the requested window. ## Testing - `./node_modules/.bin/vitest run src/pages/ops/__tests__/AlertsPage.test.tsx src/services/opsService.test.ts` → 34 passed - `./node_modules/.bin/tsc --noEmit` → clean - `./node_modules/.bin/eslint src/pages/ops/alerts.tsx src/services/opsService.ts src/pages/ops/__tests__/AlertsPage.test.tsx src/services/opsService.test.ts` → 0 errors (pre-existing-style warnings 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]
