Frun1na opened a new pull request, #4698:
URL: https://github.com/apache/rocketmq-dashboard/pull/4698
### Brief Description
The Ops page had two states derived from one boolean:
`configurationAvailable` false meant both "the cluster does not support reading
or updating the Ops configuration" and "we have not managed to find out yet". A
failed `queryOpsHomePage` only raised a toast and left the boolean false, so
the page settled into the first state — rendering "当前集群不支持读取或更新 Ops 配置" for a
network or server failure, hiding every write control behind that reason, and
offering no retry.
`loadState` ('loading' | 'ready' | 'failed') now separates the two:
- while loading, neither banner is rendered — the page makes no claim it
cannot support;
- a failed load renders a warning with a retry that re-runs the request;
- the "configuration unavailable" banner renders only once the load has
answered and does not support configuration.
This also removes the flash of the unsupported banner on first paint, which
was the same mistake with a shorter lifetime.
### How Did You Test This Change?
`cd web && npm test` — `Test Files 134 passed (134)`, `Tests 1236 passed
(1236)`. `npx tsc --noEmit` and `npx eslint` on the touched files are clean.
New test, verified to fail against the unfixed code: `Ops.test.tsx › offers
a retry instead of claiming the cluster does not support Ops config` — rejects
the first `queryOpsHomePage`, asserts the retry is present and the
"unsupported" description is absent, clicks it, and asserts the second request
ran and the write controls appeared. Against the unfixed code the query for the
retry button times out.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`fix:`)
- [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/`
(the alert reuses the existing `ops.fetchFailed`, the button `common.retry`; no
new keys)
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header (no new files)
- [x] Documentation touched where behaviour changed (not applicable: no
documented behaviour changes)
--
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]