tju-yxq opened a new pull request, #5564:
URL: https://github.com/apache/rocketmq-dashboard/pull/5564
### Which Issue(s) This PR Fixes
- Fixes #5563
### Brief Description
Converts the consumer group health diagnostics utility to the key-returning
contract that `messageTraceDiagnostics` established, so the health tab follows
the display language:
- **`consumerGroupDiagnostics.ts`**: `statusText` → `statusKey`; issues
carry `titleKey` / `descriptionKey` / `params` instead of `title` /
`description`; `recommendations` → `recommendationKeys`. Interpolated values
(topic, queue count, skew ratio, delay seconds, client id, heartbeat threshold)
move into `params` so each locale gets a grammatical sentence.
- **`consumer.tsx`** (health tab): the status tag, the issue table's
title/description columns, and the recommendations list all resolve through
`t(key, params)`.
- **`translations.ts`**: 34 new `consumerHealth.*` entries (3 status keys,
13 title/description pairs, 5 recommendations); the zh text is byte-identical
to what the utility returned before.
- **`consumerGroupDiagnostics.test.ts`**: the recommendation assertions now
check keys; the status assertion checks `statusKey`.
The utility's public behavior is otherwise unchanged (codes, severities,
thresholds, summary math untouched).
### How Did You Test This Change?
```
cd web && npx vitest run src/utils/consumerGroupDiagnostics.test.ts
Test Files 1 passed (1)
Tests 4 passed (4) # recommendation/status assertions now check keys
cd web && npx vitest run src/pages/instance/__tests__/ConsumerPage.test.tsx
Tests 37 passed | 2 failed (39)
```
The two failures are unrelated to this change and reproduce identically on
the unmodified upstream baseline (same worktree base, same assertions): `keeps
the latest client stack when an older request resolves last` fails its
`LatestClientThread` assertion standalone on pristine trunk too (this machine
is heavily loaded — a single test-file import takes 60-124s), and `highlights
inconsistent subscriptions` fails on the page-level consistency banner, which
this change does not touch. All health-tab tests — `shows group health
diagnostics from subscriptions, progress and clients`, `keeps unknown
consistency values separate from mismatches`, `reports a failed consistency
check without presenting stale data as current`, `keeps metrics from the most
recently selected instance` — pass in the full run, confirming the key-resolved
zh render is byte-identical to the previous hardcoded text.
```
cd web && npx eslint src/utils/consumerGroupDiagnostics.ts
src/pages/instance/consumer.tsx src/i18n/translations.ts
(no output — 0 errors, 0 warnings)
cd web && npx tsc --noEmit
(no output — exit 0)
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in (one
diagnostics util + its page render sites + its test, per the key-returning
theme)
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test` (util test updated to the new return shape; the page suite passes
unchanged because the zh render is byte-identical)
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(34 new `consumerHealth.*` keys)
- [x] Architecture constraints stay green (no Java changes)
- [x] New source files carry the ASF license header (no new source files)
- [ ] Documentation touched where behaviour changed (internal contract +
display strings 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]