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 fb06d98f9 fix(web): repair the user management page after the account 
lifecycle merge (#7356)
fb06d98f9 is described below

commit fb06d98f9ba36d8ae3f4258483b818dd2556fec3
Author: lizhimins <[email protected]>
AuthorDate: Mon Oct 26 19:03:41 2026 +0800

    fix(web): repair the user management page after the account lifecycle merge 
(#7356)
    
    A full-suite run on the merged trunk surfaced two breakages that neither 
side of
    the merge showed on its own:
    
    - UserManagement still called setSessionDrawerUser in the delete and 
revoke-all
      paths, a name the drawer-to-modal round replaced with 
setSessionModalUser, so
      tsc -b failed the frontend build gate.
    - UserManagementModalValidation mocked api/studioUsers before the account 
lifecycle
      added five functions to it. The page awaits listStudioLoginLockouts inside
      Promise.all, so the missing mock made the whole load reject and the table
      rendered no rows — the "Password" action the case clicks never appeared. 
Mock the
      five, and give the lockouts call a resolved promise rather than undefined.
---
 web/src/pages/studio/UserManagement.tsx             |  4 ++--
 .../UserManagementModalValidation.test.tsx          | 21 +++++++++++++++------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/web/src/pages/studio/UserManagement.tsx 
b/web/src/pages/studio/UserManagement.tsx
index ee52845e9..334a320db 100644
--- a/web/src/pages/studio/UserManagement.tsx
+++ b/web/src/pages/studio/UserManagement.tsx
@@ -411,7 +411,7 @@ const UserManagementPage = () => {
         await deleteStudioUser(record.id);
         message.success(t('userMgmt.deleted', { username: record.username }));
         if (sessionModalUser?.id === record.id) {
-          setSessionDrawerUser(null);
+          setSessionModalUser(null);
         }
         await loadUsers();
       },
@@ -442,7 +442,7 @@ const UserManagementPage = () => {
       const revokedCount = await revokeAllStudioUserSessions();
       message.success(t('userMgmt.revokedAllCount', { count: revokedCount }));
       if (sessionModalUser) {
-        setSessionDrawerUser(null);
+        setSessionModalUser(null);
       }
       await loadUsers();
     } catch {
diff --git 
a/web/src/pages/studio/__tests__/UserManagementModalValidation.test.tsx 
b/web/src/pages/studio/__tests__/UserManagementModalValidation.test.tsx
index f1efc59eb..b21ce87e6 100644
--- a/web/src/pages/studio/__tests__/UserManagementModalValidation.test.tsx
+++ b/web/src/pages/studio/__tests__/UserManagementModalValidation.test.tsx
@@ -34,13 +34,20 @@ import UserManagementPage from '../UserManagement';
 type MockAuthState = { admin: boolean; userId: number; logout: () => void };
 vi.mock('../../../api/studioUsers', () => ({
   createStudioUser: vi.fn(),
+  deleteStudioUser: vi.fn(),
   getStudioUserSessionOverview: vi.fn(),
   listAllStudioUsers: vi.fn(),
+  // The page awaits this inside Promise.all, so the mock has to hand back a 
promise:
+  // a bare vi.fn() returns undefined and the whole load rejects before the 
table renders.
+  listStudioLoginLockouts: vi.fn().mockResolvedValue([]),
   listStudioUserSessions: vi.fn(),
   listStudioUsers: vi.fn(),
   resetStudioUserPassword: vi.fn(),
+  revokeAllStudioUserSessions: vi.fn(),
+  revokeStudioSession: vi.fn(),
   revokeStudioUserSessions: vi.fn(),
   setStudioUserEnabled: vi.fn(),
+  setStudioUserRole: vi.fn(),
 }));
 
 vi.mock('../../../stores/authStore', () => ({
@@ -109,12 +116,14 @@ const collectUnhandledRejections = () => {
   const handler = (reason: unknown) => {
     reasons.push(reason);
   };
-  const nodeProcess = (globalThis as typeof globalThis & {
-    process: {
-      on: (event: 'unhandledRejection', listener: (reason: unknown) => void) 
=> void;
-      off: (event: 'unhandledRejection', listener: (reason: unknown) => void) 
=> void;
-    };
-  }).process;
+  const nodeProcess = (
+    globalThis as typeof globalThis & {
+      process: {
+        on: (event: 'unhandledRejection', listener: (reason: unknown) => void) 
=> void;
+        off: (event: 'unhandledRejection', listener: (reason: unknown) => 
void) => void;
+      };
+    }
+  ).process;
   nodeProcess.on('unhandledRejection', handler);
   return {
     reasons,

Reply via email to