From 4d0d20348dfe094c61c2c8267397945003c40728 Mon Sep 17 00:00:00 2001 From: FARAN Date: Fri, 25 Jul 2025 18:16:50 +0500 Subject: [PATCH] [Fix]: #1900 workspace create / all orgs --- .../pages/setting/organization/orgList.tsx | 41 ++++++++++++------- .../lowcoder/src/redux/sagas/orgSagas.ts | 9 ++-- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx b/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx index 0e9c8a01c..78b48b185 100644 --- a/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx +++ b/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx @@ -173,6 +173,9 @@ type DataItemInfo = { logoUrl: string; createdAt?: number; updatedAt?: number; + isCurrentOrg?: boolean; + isAdmin: boolean; + userRole: string; }; function OrganizationSetting() { @@ -198,21 +201,29 @@ function OrganizationSetting() { - // Filter to only show orgs where user has admin permissions - const adminOrgs = displayWorkspaces.filter((org: Org) => { + // Show all organizations with role information + const allOrgs = displayWorkspaces; + const adminOrgCount = displayWorkspaces.filter((org: Org) => { const role = user.orgRoleMap.get(org.id); return role === ADMIN_ROLE || role === SUPER_ADMIN_ROLE; - }); + }).length; - const dataSource = adminOrgs.map((org: Org) => ({ - id: org.id, - del: adminOrgs.length > 1, - orgName: org.name, - logoUrl: org.logoUrl || "", - createdAt: org.createdAt, - updatedAt: org.updatedAt, - isCurrentOrg: org.isCurrentOrg, - })); + const dataSource = allOrgs.map((org: Org) => { + const userRole = user.orgRoleMap.get(org.id); + const isAdmin = userRole === ADMIN_ROLE || userRole === SUPER_ADMIN_ROLE; + + return { + id: org.id, + del: isAdmin && adminOrgCount > 1, + orgName: org.name, + logoUrl: org.logoUrl || "", + createdAt: org.createdAt, + updatedAt: org.updatedAt, + isCurrentOrg: org.isCurrentOrg, + isAdmin, + userRole, + }; + }); @@ -321,13 +332,15 @@ function OrganizationSetting() { {trans("profile.switchWorkspace")} )} + {item.isAdmin && ( history.push(buildOrgId(item.id))} > - {trans("edit")} - + {trans("edit")} + + )} {item.del && ( { diff --git a/client/packages/lowcoder/src/redux/sagas/orgSagas.ts b/client/packages/lowcoder/src/redux/sagas/orgSagas.ts index e4157abde..9ac80186f 100644 --- a/client/packages/lowcoder/src/redux/sagas/orgSagas.ts +++ b/client/packages/lowcoder/src/redux/sagas/orgSagas.ts @@ -266,9 +266,12 @@ export function* createOrgSaga(action: ReduxAction<{ orgName: string }>) { if (isValidResponse) { // update org list yield call(getUserSaga); - yield put({ - type: ReduxActionTypes.CREATE_ORG_SUCCESS, - }); + // Refetch workspaces to update the profile dropdown + yield put(fetchWorkspacesAction(1, 10)); + yield put({ + type: ReduxActionTypes.CREATE_ORG_SUCCESS, + }); + } } catch (error: any) { yield put({ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy