Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2135ab8

Browse files
Merge pull request #1901 from iamfaran/fix/1900-workspace-issue
[Fix]: #1900 workspace create / all orgs
2 parents 7aa04be + 4d0d203 commit 2135ab8

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

‎client/packages/lowcoder/src/pages/setting/organization/orgList.tsx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ type DataItemInfo = {
173173
logoUrl: string;
174174
createdAt?: number;
175175
updatedAt?: number;
176+
isCurrentOrg?: boolean;
177+
isAdmin: boolean;
178+
userRole: string;
176179
};
177180

178181
function OrganizationSetting() {
@@ -198,21 +201,29 @@ function OrganizationSetting() {
198201

199202

200203

201-
// Filter to only show orgs where user has admin permissions
202-
const adminOrgs = displayWorkspaces.filter((org: Org) => {
204+
// Show all organizations with role information
205+
const allOrgs = displayWorkspaces;
206+
const adminOrgCount = displayWorkspaces.filter((org: Org) => {
203207
const role = user.orgRoleMap.get(org.id);
204208
return role === ADMIN_ROLE || role === SUPER_ADMIN_ROLE;
205-
});
209+
}).length;
206210

207-
const dataSource = adminOrgs.map((org: Org) => ({
208-
id: org.id,
209-
del: adminOrgs.length > 1,
210-
orgName: org.name,
211-
logoUrl: org.logoUrl || "",
212-
createdAt: org.createdAt,
213-
updatedAt: org.updatedAt,
214-
isCurrentOrg: org.isCurrentOrg,
215-
}));
211+
const dataSource = allOrgs.map((org: Org) => {
212+
const userRole = user.orgRoleMap.get(org.id);
213+
const isAdmin = userRole === ADMIN_ROLE || userRole === SUPER_ADMIN_ROLE;
214+
215+
return {
216+
id: org.id,
217+
del: isAdmin && adminOrgCount > 1,
218+
orgName: org.name,
219+
logoUrl: org.logoUrl || "",
220+
createdAt: org.createdAt,
221+
updatedAt: org.updatedAt,
222+
isCurrentOrg: org.isCurrentOrg,
223+
isAdmin,
224+
userRole,
225+
};
226+
});
216227

217228

218229

@@ -321,13 +332,15 @@ function OrganizationSetting() {
321332
{trans("profile.switchWorkspace")}
322333
</SwitchBtn>
323334
)}
335+
{item.isAdmin && (
324336
<EditBtn
325337
className={"home-datasource-edit-button"}
326338
buttonType={"primary"}
327339
onClick={() => history.push(buildOrgId(item.id))}
328340
>
329-
{trans("edit")}
330-
</EditBtn>
341+
{trans("edit")}
342+
</EditBtn>
343+
)}
331344
{item.del && (
332345
<EditPopover
333346
del={() => {

‎client/packages/lowcoder/src/redux/sagas/orgSagas.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,12 @@ export function* createOrgSaga(action: ReduxAction<{ orgName: string }>) {
266266
if (isValidResponse) {
267267
// update org list
268268
yield call(getUserSaga);
269-
yield put({
270-
type: ReduxActionTypes.CREATE_ORG_SUCCESS,
271-
});
269+
// Refetch workspaces to update the profile dropdown
270+
yield put(fetchWorkspacesAction(1, 10));
271+
yield put({
272+
type: ReduxActionTypes.CREATE_ORG_SUCCESS,
273+
});
274+
272275
}
273276
} catch (error: any) {
274277
yield put({

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /