This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new 1d619ee56 fix(web): drop the node_modules symlink from #5895 and 
surface refused credential exports (#7357)
1d619ee56 is described below

commit 1d619ee56ef95c4122c1350db241b7d8afa69b03
Author: lizhimins <[email protected]>
AuthorDate: Mon Oct 26 19:53:54 2026 +0800

    fix(web): drop the node_modules symlink from #5895 and surface refused 
credential exports (#7357)
    
    * fix(web): drop the node_modules symlink that rode in with #5895
    
    The audit export fix carried a committed symlink at web/node_modules 
pointing at
    the author's own worktree 
(/home/xiaoyang/rmq-worktrees/pr5926/web/node_modules).
    A checkout on any other machine gets a dangling link where the package tree 
must
    be, and the directory is gitignored precisely so it never ships. Remove it 
from
    the index; the real directory stays untracked.
    
    * fix(settings): surface the server reason on a refused credential export 
too
    
    The audit export got the describeApiError treatment in the previous commit; 
the
    cloud credential export still swallowed the error object and advised a 
retry that
    a refused export can never survive. Same extractor, same fallback string, 
plus a
    case that pins the server message reaching the toast instead of the generic 
retry
    advice.
---
 web/node_modules                                     |  1 -
 web/src/pages/settings/CloudCredentialTab.tsx        |  7 +++++--
 .../settings/__tests__/CloudCredentialTab.test.tsx   | 20 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/web/node_modules b/web/node_modules
deleted file mode 120000
index 483d31606..000000000
--- a/web/node_modules
+++ /dev/null
@@ -1 +0,0 @@
-/home/xiaoyang/rmq-worktrees/pr5926/web/node_modules
\ No newline at end of file
diff --git a/web/src/pages/settings/CloudCredentialTab.tsx 
b/web/src/pages/settings/CloudCredentialTab.tsx
index 83e2bdd34..a404bbe67 100644
--- a/web/src/pages/settings/CloudCredentialTab.tsx
+++ b/web/src/pages/settings/CloudCredentialTab.tsx
@@ -45,6 +45,7 @@ import {
 } from '../../api/cloudCredential';
 import type { CloudCredential } from '../../api/cloudCredential';
 import type { InstanceVendor } from '../../api/instance';
+import { describeApiError } from '../../utils/apiError';
 import { downloadBlob, localExportDateStamp } from '../../utils/download';
 
 const vendorTagColor: Record<string, string> = {
@@ -155,8 +156,10 @@ export const CloudCredentialTab = () => {
         new Blob([csv], { type: 'text/csv;charset=utf-8' }),
         `rocketmq-cloud-credentials-${localExportDateStamp()}.csv`,
       );
-    } catch {
-      message.error(t('settings.credentialExportFailed'));
+    } catch (error) {
+      // A refused export (for example above the server's record cap) names 
the reason and the
+      // only actionable step; the generic retry advice can never succeed for 
the same filters.
+      message.error(describeApiError(error, 
t('settings.credentialExportFailed')));
     } finally {
       setExporting(false);
     }
diff --git a/web/src/pages/settings/__tests__/CloudCredentialTab.test.tsx 
b/web/src/pages/settings/__tests__/CloudCredentialTab.test.tsx
index 10d1c6f30..5095626ec 100644
--- a/web/src/pages/settings/__tests__/CloudCredentialTab.test.tsx
+++ b/web/src/pages/settings/__tests__/CloudCredentialTab.test.tsx
@@ -536,4 +536,24 @@ describe('CloudCredentialTab', () => {
     expect(await screen.findByText('导出云凭据失败,请稍后重试')).toBeInTheDocument();
     expect(downloadBlob).not.toHaveBeenCalled();
   });
+
+  it('surfaces the server reason when a credential export is refused', async 
() => {
+    vi.mocked(exportCloudCredentials).mockRejectedValueOnce({
+      response: {
+        data: {
+          code: 400,
+          message: 'Cloud credential export exceeds the maximum of 500 
records; narrow the filters',
+        },
+      },
+    });
+    const user = userEvent.setup({ pointerEventsCheck: 0 });
+    renderTab();
+    await waitFor(() => expect(listCloudCredentials).toHaveBeenCalled());
+
+    await user.click(screen.getByRole('button', { name: /导出/ }));
+
+    expect(await screen.findByText(/narrow the filters/)).toBeInTheDocument();
+    expect(screen.queryByText('导出云凭据失败,请稍后重试')).not.toBeInTheDocument();
+    expect(downloadBlob).not.toHaveBeenCalled();
+  });
 });

Reply via email to