Frun1na opened a new pull request, #6078:
URL: https://github.com/apache/rocketmq-dashboard/pull/6078

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6077
   
   ### Brief Description
   
   Four console pages loaded the instance list with `listInstances().catch(() 
=> setInstances([]))`, so a failed
   `GET /api/instances` rendered exactly like a deployment that has no 
instances: an empty Select, no message and
   no way to retry. This is the leftover of #4700 (`71ffb696`), which fixed the 
same shape for the
   notification-deliveries filter and named the first two files as still 
silently clearing their lists, and of
   #4953 (`79962a4f`), which did it for the instance pages through the shared 
`InstanceSelect`.
   
   - `web/src/pages/home/dashboard.tsx:110` — the dashboard's instance filter 
emptied while the page kept
     showing all-instance data.
   - `web/src/pages/settings/DataSourceTab.tsx:201` — the data-source dialog's 
instance picker emptied.
   - `web/src/pages/studio/Producer.tsx:114` — the instance filter emptied and 
`Search` stayed disabled.
   - `web/src/pages/studio/LiteTopic.tsx:333` — the extend-TTL dialog opened 
with an empty picker, and
     confirming it returned early (`handleExtendTTL`) without a word.
   
   A failure is now a state on each page: the Select goes into its error 
status, the message says the instance
   list could not be loaded, and a retry re-runs the load. The three page-level 
filters also lost the
   "clear the options" write that made the failure indistinguishable from an 
empty list.
   
   User-visible change: on these four pages a failed instance-list request now 
shows
   "实例列表加载失败,请稍后重试" / "Failed to load instances. Please try again later." next 
to the select, with a
   retry (the extend-TTL dialog shows it as a message, since its load is 
one-shot). No new user-facing copy was
   introduced — the existing `instance.listLoadFailed` and `common.retry` 
entries are reused, and both already
   have Chinese and English entries.
   
   ### How Did You Test This Change?
   
   ```
   $ cd web && npx eslint src/pages/home/dashboard.tsx 
src/pages/settings/DataSourceTab.tsx \
       src/pages/studio/Producer.tsx src/pages/studio/LiteTopic.tsx
   # clean
   
   $ cd web && npx prettier --check src/pages/home/dashboard.tsx 
src/pages/settings/DataSourceTab.tsx \
       src/pages/studio/Producer.tsx src/pages/studio/LiteTopic.tsx
   # clean
   
   $ cd web && npx vitest related --run src/pages/home/dashboard.tsx 
src/pages/settings/DataSourceTab.tsx \
       src/pages/studio/Producer.tsx src/pages/studio/LiteTopic.tsx 
--maxWorkers=1 --fileParallelism=false
    ✓ src/pages/settings/__tests__/DataSourceTab.test.tsx (14 tests) 9561ms
    ✓ src/pages/studio/__tests__/Producer.test.tsx (17 tests) 8472ms
    ✓ src/pages/studio/__tests__/LiteTopic.test.tsx (17 tests) 8867ms
    ✓ src/pages/home/__tests__/DashboardPage.test.tsx (7 tests) 3270ms
    ✓ src/App.test.tsx (10 tests) 440ms
    ✓ src/pages/settings/__tests__/SettingsPage.test.tsx (1 test) 305ms
    Test Files  6 passed (6)
         Tests  66 passed (66)
   
   $ cd web && npx tsc -b
   # clean
   ```
   
   The new test fails without the fix:
   
   ```
   $ cd web && npx vitest related --run 
src/pages/home/__tests__/DashboardPage.test.tsx \
       src/pages/settings/__tests__/DataSourceTab.test.tsx 
src/pages/studio/__tests__/Producer.test.tsx \
       src/pages/studio/__tests__/LiteTopic.test.tsx --maxWorkers=1 
--fileParallelism=false
    Test Files  4 failed (4)
         Tests  4 failed | 51 passed (55)
   FAIL src/pages/home/__tests__/DashboardPage.test.tsx > DashboardPage > says 
the instance filter failed to load instead of showing it as empty
   TestingLibraryElementError: Unable to find an element with the text: 
实例列表加载失败,请稍后重试.
   FAIL src/pages/settings/__tests__/DataSourceTab.test.tsx > DataSourceTab > 
tells the data source form that the instance list could not be loaded
   FAIL src/pages/studio/__tests__/Producer.test.tsx > ProducerPage > announces 
a failed instance-list load instead of an empty instance filter
   FAIL src/pages/studio/__tests__/LiteTopic.test.tsx > LiteTopic Page > says 
the extend-TTL instance picker could not load instead of leaving it empty
   ```
   
   (That run is the product change reverted and the new tests kept, which is 
also the mutation check; the same
   four files are green again once the fix is restored.)
   
   The other `listInstances()` call sites already report or retry, so they are 
untouched: `pages/ops/alerts.tsx`,
   `pages/studio/BrokerCluster.tsx`, `pages/cluster/index.tsx` and 
`pages/instance/index.tsx` show a failure
   message, `web/src/hooks/useInstanceFilter.ts` exposes `instancesFailed` + 
`reloadInstances`.
   
   ### 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]

Reply via email to