yyqdbngt opened a new pull request, #5356:
URL: https://github.com/apache/rocketmq-dashboard/pull/5356
### Which Issue(s) This PR Fixes
- Refs #5263
### Brief Description
This PR fixes another specific divergence of #5263: the mock system alerts
carried a `time` value
the alert API never sends. (`#5349` carries `Fixes #5263` for the consumer
filter-mode part and
`#5350` covers the DLQ status codes; this PR does not close the issue
because the api-layer fixtures
listed there live in `web/src/api/**`.)
`SystemAlertVO.time` is a UTC `LocalDateTime`
(`server/src/main/java/org/apache/rocketmq/studio/ops/alert/SystemAlertVO.java:37`),
and the API
serializes it as an ISO-8601 date-time without a zone offset —
`LegacyJackson2Config` registers the
JavaTime module (`LegacyJackson2Config.java:31`) and disables
`WRITE_DATES_AS_TIMESTAMPS`
(`:33`) — so a real response looks like `2026-07-02T18:15:00`.
`web/src/mock/dashboard.ts` pinned bare wall-clock fragments instead
(`'18:15'`, `'17:42'`,
`'16:30'` on lines 136, 144 and 152). Those rows are served by
`opsService.listSystemAlerts` / `listSystemAlertsPage` in mock mode, and the
alert page renders the
field through `formatUtcDateTime`
(`web/src/pages/ops/systemAlerts.tsx:794`), which returns `'-'`
for a value it cannot parse — `Date.parse('18:15')` is `NaN`. So in mock
mode the system alert list
had an empty *Time* column for every row, and its CSV export
(`systemAlerts.tsx:116`, header
`Time (UTC)`) wrote a bare clock fragment under a UTC header. Against a real
backend both work,
because the value is a full UTC date-time.
The three mock rows now carry the date-times the API serializes, keeping the
same wall-clock times
and the same date as the other fixtures for that day.
`web/src/mock/dashboard.test.ts` pins the wire
format and the page-renderability of every row, plus the `AlertLevel`
vocabulary of the `level`
field, so a future fixture edit that drifts from the backend turns the suite
red.
### How Did You Test This Change?
```sh
$ cd web && npx vitest run src/mock/dashboard.test.ts # before the fix
FAIL src/mock/dashboard.test.ts > system alert mock contract > pins the
alert time to the UTC date-time the alert API serializes
AssertionError: expected [ '18:15', '17:42', '16:30' ] to deeply equal []
FAIL src/mock/dashboard.test.ts > system alert mock contract > keeps every
alert time renderable by the page formatter
AssertionError: expected [ '-', '-', '-' ] to deeply equal []
Test Files 1 failed (1)
Tests 2 failed | 1 passed (3)
```
```sh
$ cd web && npx vitest run src/mock/dashboard.test.ts
src/services/opsService.test.ts \
src/pages/ops/__tests__/SystemAlertsPage.test.tsx
src/pages/home/__tests__/DashboardPage.test.tsx
✓ src/mock/dashboard.test.ts (3 tests) 123ms
✓ src/services/opsService.test.ts (14 tests) 67ms
✓ src/pages/home/__tests__/DashboardPage.test.tsx (6 tests) 8707ms
✓ src/pages/ops/__tests__/SystemAlertsPage.test.tsx (18 tests) 28545ms
Test Files 4 passed (4)
Tests 41 passed (41)
```
`npx tsc -b` and `npx eslint src/mock/dashboard.ts
src/mock/dashboard.test.ts` both exit 0.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
— not applicable, no UI
text is added or changed; the mock now carries the value the backend sends
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks) — not applicable, no
Java source is touched
- [x] New source files carry the ASF license header
- [x] Documentation touched where behaviour changed (README / `docs/` /
in-app help) — not
applicable, no API or user-visible contract changes; the mock data now
matches the backend
--
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]