@@ -24,6 +24,7 @@ import {
24
24
} from "@ant-design/icons" ;
25
25
import { useEnvironmentDetail } from "./hooks/useEnvironmentDetail" ;
26
26
import WorkspacesList from "./components/WorkspacesList" ;
27
+ import UserGroupsList from "./components/UserGroupsList" ;
27
28
28
29
const { Title, Text } = Typography ;
29
30
const { TabPane } = Tabs ;
@@ -48,6 +49,12 @@ const EnvironmentDetail: React.FC = () => {
48
49
workspacesError,
49
50
refreshWorkspaces,
50
51
workspaceStats,
52
+ userGroups,
53
+ userGroupsLoading,
54
+ userGroupsError,
55
+ refreshUserGroups,
56
+ userGroupStats
57
+
51
58
} = useEnvironmentDetail ( id ) ;
52
59
// If loading, show spinner
53
60
if ( loading ) {
@@ -277,7 +284,6 @@ const EnvironmentDetail: React.FC = () => {
277
284
/>
278
285
</ Card >
279
286
</ TabPane >
280
-
281
287
< TabPane
282
288
tab = {
283
289
< span >
@@ -287,30 +293,102 @@ const EnvironmentDetail: React.FC = () => {
287
293
key = "userGroups"
288
294
>
289
295
< Card >
290
- { /* Placeholder for user group statistics */ }
296
+ { /* Header with refresh button */ }
297
+ < div
298
+ style = { {
299
+ display : "flex" ,
300
+ justifyContent : "space-between" ,
301
+ alignItems : "center" ,
302
+ marginBottom : "16px" ,
303
+ } }
304
+ >
305
+ < Title level = { 5 } > User Groups in this Environment</ Title >
306
+ < Button
307
+ icon = { < SyncOutlined /> }
308
+ onClick = { refreshUserGroups }
309
+ size = "small"
310
+ loading = { userGroupsLoading }
311
+ >
312
+ Refresh User Groups
313
+ </ Button >
314
+ </ div >
315
+
316
+ { /* User Group Statistics */ }
291
317
< Row gutter = { 16 } style = { { marginBottom : "24px" } } >
292
318
< Col span = { 8 } >
293
319
< Statistic
294
320
title = "Total User Groups"
295
- value = { 0 }
321
+ value = { userGroupStats . total }
296
322
prefix = { < TeamOutlined /> }
297
323
/>
298
324
</ Col >
299
325
< Col span = { 8 } >
300
326
< Statistic
301
327
title = "Total Users"
302
- value = { 0 }
328
+ value = { userGroupStats . totalUsers }
329
+ prefix = { < UserOutlined /> }
330
+ />
331
+ </ Col >
332
+ < Col span = { 8 } >
333
+ < Statistic
334
+ title = "Admin Users"
335
+ value = { userGroupStats . adminUsers }
303
336
prefix = { < UserOutlined /> }
304
337
/>
305
338
</ Col >
306
339
</ Row >
307
340
308
- { /* Placeholder for user group list */ }
309
- < Alert
310
- message = "User Group Information"
311
- description = "User group data will be implemented in the next phase. This section will display user group details and membership information."
312
- type = "info"
313
- showIcon
341
+ < Divider style = { { margin : "16px 0" } } />
342
+
343
+ { /* Show error if user group loading failed */ }
344
+ { userGroupsError && (
345
+ < Alert
346
+ message = "Error loading user groups"
347
+ description = { userGroupsError }
348
+ type = "error"
349
+ showIcon
350
+ style = { { marginBottom : "16px" } }
351
+ action = {
352
+ userGroupsError . includes ( "No API key configured" ) ||
353
+ userGroupsError . includes ( "No API service URL configured" ) ? (
354
+ < Button size = "small" type = "primary" disabled >
355
+ Configuration Required
356
+ </ Button >
357
+ ) : (
358
+ < Button
359
+ size = "small"
360
+ type = "primary"
361
+ onClick = { refreshUserGroups }
362
+ >
363
+ Try Again
364
+ </ Button >
365
+ )
366
+ }
367
+ />
368
+ ) }
369
+
370
+ { /* Show warning if no API key or API service URL is configured */ }
371
+ { ( ! environment . environmentApikey ||
372
+ ! environment . environmentApiServiceUrl ) &&
373
+ ! userGroupsError && (
374
+ < Alert
375
+ message = "Configuration Issue"
376
+ description = {
377
+ ! environment . environmentApikey
378
+ ? "An API key is required to fetch user groups for this environment."
379
+ : "An API service URL is required to fetch user groups for this environment."
380
+ }
381
+ type = "warning"
382
+ showIcon
383
+ style = { { marginBottom : "16px" } }
384
+ />
385
+ ) }
386
+
387
+ { /* User Groups List */ }
388
+ < UserGroupsList
389
+ userGroups = { userGroups }
390
+ loading = { userGroupsLoading && ! userGroupsError }
391
+ error = { userGroupsError }
314
392
/>
315
393
</ Card >
316
394
</ TabPane >
@@ -319,4 +397,4 @@ const EnvironmentDetail: React.FC = () => {
319
397
) ;
320
398
} ;
321
399
322
- export default EnvironmentDetail ;
400
+ export default EnvironmentDetail ;
0 commit comments