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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6124
   
   ### Brief Description
   
   Opening the maintenance-window dialog presented a failed read as "there are 
no maintenance windows".
   `loadSilences` (`web/src/pages/ops/systemAlerts.tsx:373-387`) only toasted 
and collected no failure state, and
   the dialog body rendered its empty list as `sysAlerts.noMaintenanceWindows` 
(`:993-995`). The dialog is also
   where a maintenance window is created, so an operator who opens it while the 
read fails concludes there are
   none in place — and can create a duplicate of one that already exists. There 
is no retry and the toast fades,
   so the failed read and a genuinely empty result were indistinguishable.
   
   The failure is now a state: the dialog shows the failure with a retry that 
re-reads the current page, and the
   empty text is reserved for a read that actually returned nothing. 
User-visible change: a failed silence read
   now says so inside the dialog and can be retried. The message and the retry 
reuse the existing
   `sysAlerts.silenceLoadFailed` and `common.retry` copy, so no new UI text is 
introduced.
   
   ### How Did You Test This Change?
   
   ```
   $ cd web && npx eslint src/pages/ops/systemAlerts.tsx
   # clean
   
   $ cd web && npx prettier --check src/pages/ops/systemAlerts.tsx
   # clean
   
   $ cd web && npx vitest related --run src/pages/ops/systemAlerts.tsx 
--maxWorkers=1 --fileParallelism=false
    ✓ src/pages/ops/__tests__/SystemAlertsPage.test.tsx (22 tests) 12232ms
    Test Files  2 passed (2)
         Tests  32 passed (32)
   
   $ cd web && npx tsc -b
   # clean
   ```
   
   The new test fails without the fix:
   
   ```
   $ cd web && npx vitest run src/pages/ops/__tests__/SystemAlertsPage.test.tsx
    FAIL src/pages/ops/__tests__/SystemAlertsPage.test.tsx > SystemAlertsPage > 
does not report a failed maintenance-window read as no maintenance windows
    Error: expect(element).not.toBeInTheDocument()
    expected document not to contain element, found <span class="ant-typography 
ant-typography-secondary …"> 当前没有维护窗口 </span> instead
    Test Files  1 failed (1)
         Tests  1 failed | 21 passed (22)
   ```
   
   (That run is `pages/ops/systemAlerts.tsx` reverted and the test kept, which 
is also the mutation check; the
   case is green again once the fix is restored. The test also pins the retry, 
after which the empty text is
   shown for the genuinely empty result.)
   
   ### 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