tju-yxq opened a new pull request, #5577:
URL: https://github.com/apache/rocketmq-dashboard/pull/5577
### Which Issue(s) This PR Fixes
- Fixes #5576
### Brief Description
Migrates the metrics explorer's inline zh/en copy table (~110 lines, 50
entries) and its `queryErrorFallback` ternary into `metrics.*` keys in
`translations.ts`, retiring the component's parallel i18n system:
- **`MetricsExplorer.tsx`**: the `copy` object keeps its shape (all 88 usage
sites untouched) but each entry resolves through `t('metrics.…')`;
`hiddenSeries` moves from a closure to the standard `{count}` / `{kept}`
placeholder style; `const { lang } = useLang()` becomes `const { lang, t } =
useLang()`. The language-change discipline (query callbacks read labels through
`queryLabelsRef`) is unchanged.
- **`translations.ts`**: 52 new `metrics.*` entries; the zh and en text is
byte-identical to the inline table, so neither locale sees any change.
### How Did You Test This Change?
```
cd web && npx vitest run src/components/__tests__/MetricsExplorer.test.tsx
Test Files 1 passed (1)
Tests 35 passed (35) # includes 'caps the plotted series and
reports the hidden count'
# (the migrated hiddenSeries interpolation)
and
# 'keeps the pending custom query when the
display language changes'
cd web && npx eslint src/components/MetricsExplorer.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
component's copy table migration)
- [x] Commit subject follows Conventional Commits
- [ ] Tests added or updated for non-trivial changes, test methods named
`...Test` (no behavior change — the render is byte-identical in both locales;
the existing 35-test suite covers the component)
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(this PR is exactly that — 52 `metrics.*` 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 (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]