yyqdbngt opened a new pull request, #4706:
URL: https://github.com/apache/rocketmq-dashboard/pull/4706
<!-- Base branch: `rocketmq-studio`, the RocketMQ Studio trunk. -->
### Which Issue(s) This PR Fixes
- No open issue tracks this exact defect. #4630 describes hardcoded Chinese
text in the English UI
and is a different class; this is the punctuation the panel joins its
findings with.
### Brief Description
The traffic insights panel built its findings line with a hardcoded
full-width colon and an
ideographic comma:
```tsx
message={`${t('dashboardTraffic.findings')}:${visibleIssues.map(issueText).join('、')}`}
```
(`web/src/pages/home/DashboardTrafficInsights.tsx:159`). Both are
Chinese-only punctuation, and the
panel renders in English as well, so an English reader saw
`Traffic signals to review:prod carries 88.6% of the traffic、canary ...`.
The separators are now
taken from the active language, which is what
`web/src/pages/instance/index.tsx:408,491,507`
already does for the messages it joins.
### How Did You Test This Change?
New case in
`web/src/pages/home/__tests__/DashboardTrafficInsights.test.tsx`: it stores
`en` as the
language preference, renders the default three-cluster fixture, and asserts
the findings line
carries neither `:` nor `、` and starts with the ASCII `: ` label separator.
Both runs below use the project's own test runner through the
workspace-local binary
(`web/node_modules/.bin/vitest.cmd`, vitest 4.1.10 as pinned by
`web/package.json`), not a
downloaded one.
Red - on the unmodified base (new test copied in, the panel untouched):
```
$ cd web && .\node_modules\.bin\vitest.cmd run
src/pages/home/__tests__/DashboardTrafficInsights.test.tsx
❯ src/pages/home/__tests__/DashboardTrafficInsights.test.tsx (3 tests | 1
failed) 67ms
× separates the traffic findings with the viewer language punctuation
67ms
FAIL src/pages/home/__tests__/DashboardTrafficInsights.test.tsx >
DashboardTrafficInsights > separates the traffic findings with the viewer
language punctuation
AssertionError: expected 'Traffic signals to review:prod carrie…' not to
match /[:、]/u
Test Files 1 failed (1)
Tests 1 failed | 2 passed (3)
```
Green - with the fix:
```
$ cd web && .\node_modules\.bin\vitest.cmd run
src/pages/home/__tests__/DashboardTrafficInsights.test.tsx
Test Files 1 passed (1)
Tests 3 passed (3)
Duration 10.41s
```
```
$ cd web && npx tsc -b # exit 0, no output
$ cd web && .\node_modules\.bin\eslint.cmd
src/pages/home/DashboardTrafficInsights.tsx
src/pages/home/__tests__/DashboardTrafficInsights.test.tsx
# exit 0, no output
```
The two pre-existing cases of the file (the Chinese findings line and the
empty state) are
unchanged: the first asserts on `、`-joined Chinese text only through a
substring match and still
passes, since the Chinese branch keeps the original separators.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(no UI text is added; only the separator between already-localized strings
changes)
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks); no server file is touched, so the Java suite is not affected
- [x] New source files carry the ASF license header (no new source file)
- [x] Documentation touched where behaviour changed (no README / `docs/`
page documents this line)
--
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]