Skip to content

[Fix]: #1900 workspace create / all orgs #1901

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 1 commit into from
Jul 29, 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
41 changes: 27 additions & 14 deletions client/packages/lowcoder/src/pages/setting/organization/orgList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ type DataItemInfo = {
logoUrl: string;
createdAt?: number;
updatedAt?: number;
isCurrentOrg?: boolean;
isAdmin: boolean;
userRole: string;
};

function OrganizationSetting() {
Expand All @@ -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,
};
});



Expand Down Expand Up @@ -321,13 +332,15 @@ function OrganizationSetting() {
{trans("profile.switchWorkspace")}
</SwitchBtn>
)}
{item.isAdmin && (
<EditBtn
className={"home-datasource-edit-button"}
buttonType={"primary"}
onClick={() => history.push(buildOrgId(item.id))}
>
{trans("edit")}
</EditBtn>
{trans("edit")}
</EditBtn>
)}
{item.del && (
<EditPopover
del={() => {
Expand Down
9 changes: 6 additions & 3 deletions client/packages/lowcoder/src/redux/sagas/orgSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading