Skip to content

[Fix]: For the new structure /myorg endpoint #1859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
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 @@ -211,6 +211,7 @@ function OrganizationSetting() {
logoUrl: org.logoUrl || "",
createdAt: org.createdAt,
updatedAt: org.updatedAt,
isCurrentOrg: org.isCurrentOrg,
}));


Expand Down Expand Up @@ -262,7 +263,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 Expand Up @@ -307,7 +308,7 @@ function OrganizationSetting() {
key: i,
operation: (
<OperationWrapper>
{item.id !== user.currentOrgId && (
{!item.isCurrentOrg && (
<SwitchBtn
className={"home-datasource-edit-button"}
buttonType={"blue"}
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
Loading