Frun1na opened a new pull request, #6090:
URL: https://github.com/apache/rocketmq-dashboard/pull/6090
### Which Issue(s) This PR Fixes
- Fixes #6089
### Brief Description
Three registry loads on the cluster page cleared their state on failure,
which the page renders as an empty
list, so a failed `GET /api/clusters/registry` (or the NameServer registry /
certificate list) was presented
as "this deployment has registered nothing":
- `loadRegistryClusters` (`web/src/pages/cluster/index.tsx:222`) also feeds
the Broker and Proxy tabs
(`:1218`, `:1681`), so one failed read emptied three tabs.
- `loadNsRegistry` (`:242`) left the NameServer registry table empty.
- the certificate load (`:259`) left the registry dialog's K8s ID field with
no options; that Select does not
accept free text, so the field could not be filled at all.
None of them had an error or retry affordance, while the same page already
treats a failed instance-list load
properly (three retries, then an `instanceLoadError` banner with a retry —
`:158`, `:1898`). A failure is now
a state here too: each loader records its own failure (cleared on its own
success) and the page shows a
warning above the tabs with a retry that re-runs all three loads.
User-visible change: when the registry data cannot be read the cluster page
now says so and offers a retry
instead of showing empty registry, Broker, Proxy and NameServer tables. The
message reuses the existing
`common.fetchDataFailed` copy (Chinese and English already exist), so no new
UI text is introduced and
`web/src/i18n/translations.ts` is not touched.
### How Did You Test This Change?
```
$ cd web && npx eslint src/pages/cluster/index.tsx
# clean
$ cd web && npx prettier --check src/pages/cluster/index.tsx
# clean
$ cd web && npx vitest related --run src/pages/cluster/index.tsx
--maxWorkers=1 --fileParallelism=false
✓ src/pages/cluster/__tests__/ClusterPage.test.tsx (37 tests) 42804ms
✓ src/App.test.tsx (10 tests) 448ms
Test Files 2 passed (2)
Tests 47 passed (47)
$ cd web && npx tsc -b
# clean
```
The new test fails without the fix:
```
$ cd web && npx vitest related --run
src/pages/cluster/__tests__/ClusterPage.test.tsx \
--maxWorkers=1 --fileParallelism=false
FAIL src/pages/cluster/__tests__/ClusterPage.test.tsx > Cluster page >
reports registry data that could not be loaded instead of showing empty tabs
TestingLibraryElementError: Unable to find an element with the text: 获取数据失败.
Test Files 1 failed (1)
Tests 1 failed | 36 passed (37)
```
(That run is `pages/cluster/index.tsx` reverted and the new test kept, which
is also the mutation check; the
case is green again once the fix is restored. The test also pins the retry:
the registry list is re-requested
and the warning clears once it succeeds.)
### 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`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]