@@ -173,6 +173,9 @@ type DataItemInfo = {
173
173
logoUrl : string ;
174
174
createdAt ?: number ;
175
175
updatedAt ?: number ;
176
+ isCurrentOrg ?: boolean ;
177
+ isAdmin : boolean ;
178
+ userRole : string ;
176
179
} ;
177
180
178
181
function OrganizationSetting ( ) {
@@ -198,21 +201,29 @@ function OrganizationSetting() {
198
201
199
202
200
203
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 ) => {
203
207
const role = user . orgRoleMap . get ( org . id ) ;
204
208
return role === ADMIN_ROLE || role === SUPER_ADMIN_ROLE ;
205
- } ) ;
209
+ } ) . length ;
206
210
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
+ } ) ;
216
227
217
228
218
229
@@ -321,13 +332,15 @@ function OrganizationSetting() {
321
332
{ trans ( "profile.switchWorkspace" ) }
322
333
</ SwitchBtn >
323
334
) }
335
+ { item . isAdmin && (
324
336
< EditBtn
325
337
className = { "home-datasource-edit-button" }
326
338
buttonType = { "primary" }
327
339
onClick = { ( ) => history . push ( buildOrgId ( item . id ) ) }
328
340
>
329
- { trans ( "edit" ) }
330
- </ EditBtn >
341
+ { trans ( "edit" ) }
342
+ </ EditBtn >
343
+ ) }
331
344
{ item . del && (
332
345
< EditPopover
333
346
del = { ( ) => {
0 commit comments