diff --git a/client/packages/lowcoder/src/api/userApi.ts b/client/packages/lowcoder/src/api/userApi.ts index 5955071a8..a65a72338 100644 --- a/client/packages/lowcoder/src/api/userApi.ts +++ b/client/packages/lowcoder/src/api/userApi.ts @@ -63,10 +63,13 @@ export type GetCurrentUserResponse = GenericApiResponse; export interface GetMyOrgsResponse extends ApiResponse { data: { data: Array<{ - orgId: string; - orgName: string; - createdAt?: number; - updatedAt?: number; + isCurrentOrg: boolean; + orgView: { + orgId: string; + orgName: string; + createdAt?: number; + updatedAt?: number; + }; }>; pageNum: number; pageSize: number; diff --git a/client/packages/lowcoder/src/constants/orgConstants.ts b/client/packages/lowcoder/src/constants/orgConstants.ts index d46d9957b..e2afb5c5f 100644 --- a/client/packages/lowcoder/src/constants/orgConstants.ts +++ b/client/packages/lowcoder/src/constants/orgConstants.ts @@ -56,6 +56,7 @@ export type Org = { createTime?: string; createdAt?: number; updatedAt?: number; + isCurrentOrg?: boolean; }; export type OrgAndRole = { diff --git a/client/packages/lowcoder/src/pages/common/WorkspaceSection.tsx b/client/packages/lowcoder/src/pages/common/WorkspaceSection.tsx index f1cb0709f..0bd8a4c54 100644 --- a/client/packages/lowcoder/src/pages/common/WorkspaceSection.tsx +++ b/client/packages/lowcoder/src/pages/common/WorkspaceSection.tsx @@ -242,11 +242,11 @@ export default function WorkspaceSectionComponent({ displayWorkspaces.map((org: Org) => ( handleOrgSwitch(org.id)} > {org.name} - {user.currentOrgId === org.id && } + {org.isCurrentOrg && } )) ) : ( diff --git a/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx b/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx index c60f492ea..0e9c8a01c 100644 --- a/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx +++ b/client/packages/lowcoder/src/pages/setting/organization/orgList.tsx @@ -211,6 +211,7 @@ function OrganizationSetting() { logoUrl: org.logoUrl || "", createdAt: org.createdAt, updatedAt: org.updatedAt, + isCurrentOrg: org.isCurrentOrg, })); @@ -262,7 +263,7 @@ function OrganizationSetting() { dataIndex: "orgName", ellipsis: true, render: (_, record: any) => { - const isActiveOrg = record.id === user.currentOrgId; + const isActiveOrg = record.isCurrentOrg; return ( @@ -307,7 +308,7 @@ function OrganizationSetting() { key: i, operation: ( - {item.id !== user.currentOrgId && ( + {!item.isCurrentOrg && ( ({ - id: item.orgId, - name: item.orgName, - createdAt: item.createdAt, - updatedAt: item.updatedAt, + id: item.orgView.orgId, + name: item.orgView.orgName, + createdAt: item.orgView.createdAt, + updatedAt: item.orgView.updatedAt, + isCurrentOrg: item.isCurrentOrg, })); yield put({ diff --git a/client/packages/lowcoder/src/util/useWorkspaceManager.ts b/client/packages/lowcoder/src/util/useWorkspaceManager.ts index 59732ac53..5c5cafee0 100644 --- a/client/packages/lowcoder/src/util/useWorkspaceManager.ts +++ b/client/packages/lowcoder/src/util/useWorkspaceManager.ts @@ -91,10 +91,11 @@ export function useWorkspaceManager({ if (response.data.success) { const apiData = response.data.data; const transformedItems = apiData.data.map(item => ({ - id: item.orgId, - name: item.orgName, - createdAt: item.createdAt, - updatedAt: item.updatedAt, + id: item.orgView.orgId, + name: item.orgView.orgName, + createdAt: item.orgView.createdAt, + updatedAt: item.orgView.updatedAt, + isCurrentOrg: item.isCurrentOrg, })); dispatch({