tju-yxq opened a new pull request, #5572:
URL: https://github.com/apache/rocketmq-dashboard/pull/5572
### Which Issue(s) This PR Fixes
- Fixes #5571
### Brief Description
Converts the send pre-check family to the key-returning contract that
`messageTraceDiagnostics` established (and #5564/#5566/#5568/#5570 applied to
the four diagnostics utils), so the send modal's pre-check follows the display
language:
- **`messagePayloadPreview.ts`**: issues carry `titleKey` / `descriptionKey`
plus optional `params` (value, names, bytes, max, count) instead of `title` /
`description`; `names` stays raw data. Codes, severities, limits, and
normalization are untouched.
- **`messageProperties.ts`**: `parseMessageProperties` returns structured
errors (`{ key, params }`) instead of interpolated Chinese strings; the
pre-check maps them straight into the `INVALID_PROPERTY_FORMAT` issue's
`descriptionKey` / `params`.
- **`topic.tsx`** (send modal): the pre-check panel's issue rows and the
blocking toast resolve through `t(key, params)`; the toast becomes
`发送前预检未通过:{issues}` / `Pre-send check failed: {issues}` with a locale-aware
separator.
- **`translations.ts`**: ~35 new keys (`sendCheck.*`, `propErr.*`,
`topic.precheckBlockedToast`, `topic.listSeparator`); the zh text is
byte-identical to what was returned before.
- **Tests**: the payload-preview and properties util tests and the TopicPage
parse assertion are updated to the new return shape.
Note: the send-modal changes overlap #5533 (the topic page localization) on
the toast line and the pre-check panel header; whichever lands second needs a
trivial rebase.
### How Did You Test This Change?
```
cd web && npx vitest run src/utils/messagePayloadPreview.test.ts
src/utils/messageProperties.test.ts
Test Files 2 passed (2)
Tests 17 passed (17) # assertions updated to keys/params
cd web && npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx -t
"send payload"
Tests 2 passed # 'previews the send payload and submits the normalized
properties',
# 'blocks duplicate form properties in the send payload
preflight'
cd web && npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx -t
"batch message properties"
Tests 1 passed # the parseMessageProperties shape assertion
cd web && npx eslint src/utils/messagePayloadPreview.ts
src/utils/messageProperties.ts src/pages/instance/topic.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 (the
send pre-check family — two utils + their page render sites + tests, 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 tests updated to the new return shape; the page's pre-check
tests pass because the zh render is byte-identical)
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(~35 new 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]