tju-yxq opened a new pull request, #5574:
URL: https://github.com/apache/rocketmq-dashboard/pull/5574
### Which Issue(s) This PR Fixes
- Fixes #5573
### Brief Description
Converts the resource CSV import validation to the key-returning contract,
completing the six-member family of analysis utilities (consumer #5564, routes
#5566, ACL #5568, connections #5570, send pre-check #5572):
- **`resourceCsvImport.ts`**: row-level findings become `ImportIssue`
objects (`{ key, params }`) on a new `issues` field of `ResourceImportRow`;
`validateResourceName` returns `{ key, params } | null`; the duplicate-name
builder returns line numbers instead of pre-rendered strings; `parseInteger`
pushes structured issues. The result-phase `message` field (page-set after the
import request) is untouched — the validation and result phases no longer share
one string field. `parseCsvTable`'s thrown structural errors are out of scope.
- **`topic.tsx` / `consumer.tsx`** (import modals): the message column
resolves `issues` through `t(key, params)` joined with the new
`common.listSeparator`, falling back to `message` for result rows.
- **`translations.ts`**: 13 new `csvImport.*` keys plus
`common.listSeparator`; the zh text is byte-identical to what was returned
before.
- **`resourceCsvImport.test.ts`**: the message and name-rule assertions
check `{ key, params }` shapes.
### How Did You Test This Change?
```
cd web && npx vitest run src/utils/resourceCsvImport.test.ts
Test Files 1 passed (1)
Tests 14 passed (14) # message/name-rule assertions now check keys
and params
cd web && npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx -t
"import"
Tests 4 passed # imports valid/duplicate rows, reloads after import,
skips invalid CSV
cd web && npx vitest run src/pages/instance/__tests__/ConsumerPage.test.tsx
-t "CSV import"
Tests 1 passed # per-row state on partial failure
cd web && npx eslint src/utils/resourceCsvImport.ts
src/pages/instance/topic.tsx 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
validation util + its two pages' message column + 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 pages' import suites
pass because the zh render is byte-identical)
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(14 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]