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

   ### Which Issue(s) This PR Fixes
   
   Fixes: none - no issue filed for this defect
   
   ### What This PR Does
   
   Restarting a proxy from the cluster page's Proxy tab failed silently. The 
row action's
   `Modal.confirm` `onOk` ran its body without any `catch`:
   
   ```ts
   onOk: async () => {
     await restartProxy({ clusterId: record.clusterId, addr: record.addr });
     await requestRefresh('operation');
     message.success(t('cluster.restartProxySubmitted', { addr: record.addr }));
   },
   ```
   
   antd's confirm wrapper only closes the dialog on the fulfilled path — a 
rejected `onOk`
   is silently dropped — so when the restart request failed without a business 
envelope
   (network error, timeout, gateway 5xx) the dialog just stayed open with no 
outcome at
   all: no toast, no feedback, and the OK button's spinner reset as if nothing 
had been
   requested. The shared axios client only toasts errors that carry the 
business envelope;
   transport-level failures such as timeouts reject with no message anywhere.
   
   The sibling mutations on this page all report their failures: the NameServer 
registry
   delete surfaces `cluster.nsOperationFailed`, the broker config update 
surfaces
   `cluster.configUpdateFailed` (both on the request-failure path and per 
failed broker),
   and the NameServer create/update modal surfaces `cluster.nsOperationFailed` 
too. The
   proxy restart was the only silent one, and its success path
   (`cluster.restartProxySubmitted`) was already handled.
   
   The fix wraps the body in `try/catch` and surfaces a new 
`cluster.restartProxyFailed`
   message (zh: `重启 Proxy "{addr}" 失败,请稍后重试`, en: `Failed to restart Proxy 
"{addr}".
   Please try again later.`), matching the failure wording of the page's other 
operations.
   
   ### Verification
   
   Red/green in `src/pages/cluster/__tests__/ClusterPage.test.tsx`:
   
   - new test "reports a failed proxy restart instead of staying silent" — 
rejects
     `restartProxy`, switches to the Proxy 管理 tab, clicks the row 重启 action, 
then
     clicks 确认 and asserts the failure toast and the absence of the submitted 
toast. It
     **fails on unpatched trunk** with `Unable to find an element with the text:
     /重启 Proxy "10\.101\.2\.21:8081" 失败/` (plus an unhandled `proxy unreachable`
     rejection from the dropped `onOk`) and passes with this patch.
   - `npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx` — 
**39/39**
     (38 pre-existing + 1 new).
   - `npx vitest run src/i18n/__tests__/translations.test.ts` — **2/2**.
   - `npx tsc -b` clean; eslint and Prettier clean on the changed files.
   
   Assisted-by: ZCode
   
   Signed-off-by: messere1 <[email protected]>
   


-- 
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