Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix workspaces updated myorg endpoint
  • Loading branch information
iamfaran committed Jul 11, 2025
commit 1a587df9a2400f5ec9737c54cff1744da5b6fcc4
11 changes: 7 additions & 4 deletions client/packages/lowcoder/src/api/userApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ export type GetCurrentUserResponse = GenericApiResponse<CurrentUser>;
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;
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/constants/orgConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export type Org = {
createTime?: string;
createdAt?: number;
updatedAt?: number;
isCurrentOrg?: boolean;
};

export type OrgAndRole = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ export default function WorkspaceSectionComponent({
displayWorkspaces.map((org: Org) => (
<WorkspaceItem
key={org.id}
$isActive={user.currentOrgId === org.id}
$isActive={org.isCurrentOrg}
onClick={() => handleOrgSwitch(org.id)}
>
<WorkspaceName title={org.name}>{org.name}</WorkspaceName>
{user.currentOrgId === org.id && <ActiveIcon />}
{org.isCurrentOrg && <ActiveIcon />}
</WorkspaceItem>
))
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function OrganizationSetting() {
dataIndex: "orgName",
ellipsis: true,
render: (_, record: any) => {
const isActiveOrg = record.id === user.currentOrgId;
const isActiveOrg = record.isCurrentOrg;
return (
<OrgName>
<StyledOrgLogo source={record.logoUrl} orgName={record.orgName} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const initialState: UsersReduxState = {
workspaces: {
items: [],
totalCount: 0,
currentOrg: null

}
};

Expand Down Expand Up @@ -231,6 +233,7 @@ export interface UsersReduxState {
workspaces: {
items: Org[]; // Current page of workspaces
totalCount: number; // Total workspaces available
currentOrg: Org | null;
};
}

Expand Down
9 changes: 5 additions & 4 deletions client/packages/lowcoder/src/redux/sagas/orgSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,11 @@ export function* fetchWorkspacesSaga(action: ReduxAction<{page: number, pageSize

// Transform orgId/orgName to match Org interface
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,
}));

yield put({
Expand Down
9 changes: 5 additions & 4 deletions client/packages/lowcoder/src/util/useWorkspaceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down