@@ -6,6 +6,7 @@ import { Environment } from '../types/environment.types';
6
6
import { UserGroup , UserGroupsTabStats } from '../types/userGroup.types' ;
7
7
import { getEnvironmentUserGroups } from '../services/environments.service' ;
8
8
import { Spin , Empty } from 'antd' ;
9
+ import { trans } from 'i18n' ;
9
10
10
11
const { Search } = Input ;
11
12
@@ -36,7 +37,7 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
36
37
try {
37
38
// Check for required environment properties
38
39
if ( ! environment . environmentApikey || ! environment . environmentApiServiceUrl ) {
39
- setError ( 'Missing required configuration: API key or API service URL' ) ;
40
+ setError ( trans ( "enterprise.environments.userGroups.missingConfiguration" ) ) ;
40
41
setLoading ( false ) ;
41
42
return ;
42
43
}
@@ -65,7 +66,7 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
65
66
custom
66
67
} ) ;
67
68
} catch ( err ) {
68
- setError ( err instanceof Error ? err . message : "Failed to fetch user groups" ) ;
69
+ setError ( err instanceof Error ? err . message : trans ( "enterprise.environments.userGroups.errorLoadingUserGroups" ) ) ;
69
70
} finally {
70
71
setLoading ( false ) ;
71
72
setRefreshing ( false ) ;
@@ -134,7 +135,7 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
134
135
// Table columns
135
136
const columns = [
136
137
{
137
- title : 'User Group' ,
138
+ title : trans ( "enterprise.environments.userGroups.userGroup" ) ,
138
139
key : 'group' ,
139
140
render : ( group : UserGroup ) => (
140
141
< div style = { { display : 'flex' , alignItems : 'center' } } >
@@ -158,50 +159,50 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
158
159
) ,
159
160
} ,
160
161
{
161
- title : 'Type' ,
162
+ title : trans ( "enterprise.environments.userGroups.type" ) ,
162
163
key : 'type' ,
163
164
render : ( _ : any , group : UserGroup ) => {
164
165
if ( group . allUsersGroup ) return (
165
166
< Tag color = "blue" style = { { borderRadius : '4px' } } >
166
- < UserOutlined style = { { marginRight : 4 } } /> All Users
167
+ < UserOutlined style = { { marginRight : 4 } } /> { trans ( "enterprise.environments.userGroups.allUsers" ) }
167
168
</ Tag >
168
169
) ;
169
170
if ( group . devGroup ) return (
170
171
< Tag color = "purple" style = { { borderRadius : '4px' } } >
171
- < CodeOutlined style = { { marginRight : 4 } } /> Developers
172
+ < CodeOutlined style = { { marginRight : 4 } } /> { trans ( "enterprise.environments.userGroups.developers" ) }
172
173
</ Tag >
173
174
) ;
174
175
return (
175
176
< Tag color = "default" style = { { borderRadius : '4px' } } >
176
- < SettingOutlined style = { { marginRight : 4 } } /> Custom
177
+ < SettingOutlined style = { { marginRight : 4 } } /> { trans ( "enterprise.environments.userGroups.custom" ) }
177
178
</ Tag >
178
179
) ;
179
180
} ,
180
181
} ,
181
182
{
182
- title : 'Members' ,
183
+ title : trans ( "enterprise.environments.userGroups.members" ) ,
183
184
key : 'members' ,
184
185
render : ( _ : any , group : UserGroup ) => (
185
- < Tooltip title = "Total number of members in this group" >
186
+ < Tooltip title = { trans ( "enterprise.environments.userGroups.totalMembersTooltip" ) } >
186
187
< Tag style = { { borderRadius : '4px' , backgroundColor : '#f6f6f6' , color : '#333' } } >
187
188
< UserOutlined style = { { marginRight : 4 } } /> { group . stats ?. userCount || 0 }
188
189
</ Tag >
189
190
</ Tooltip >
190
191
) ,
191
192
} ,
192
193
{
193
- title : 'Admin Members' ,
194
+ title : trans ( "enterprise.environments.userGroups.adminMembers" ) ,
194
195
key : 'adminMembers' ,
195
196
render : ( _ : any , group : UserGroup ) => (
196
- < Tooltip title = "Number of admin users in this group" >
197
+ < Tooltip title = { trans ( "enterprise.environments.userGroups.adminMembersTooltip" ) } >
197
198
< Tag style = { { borderRadius : '4px' , backgroundColor : '#fff1f0' , color : '#cf1322' } } >
198
199
< UserOutlined style = { { marginRight : 4 } } /> { group . stats ?. adminUserCount || 0 }
199
200
</ Tag >
200
201
</ Tooltip >
201
202
) ,
202
203
} ,
203
204
{
204
- title : 'Created' ,
205
+ title : trans ( "enterprise.environments.userGroups.created" ) ,
205
206
dataIndex : 'createTime' ,
206
207
key : 'createTime' ,
207
208
render : ( createTime : number ) => (
@@ -223,25 +224,25 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
223
224
} } >
224
225
< div >
225
226
< Title level = { 4 } style = { { margin : 0 , marginBottom : '4px' } } >
226
- < UsergroupAddOutlined style = { { marginRight : 8 } } /> User Groups
227
+ < UsergroupAddOutlined style = { { marginRight : 8 } } /> { trans ( "enterprise.environments.userGroups.title" ) }
227
228
</ Title >
228
229
< p style = { { marginBottom : 0 , color : '#8c8c8c' , fontSize : '14px' } } >
229
- Manage user groups in this environment
230
+ { trans ( "enterprise.environments.userGroups.subtitle" ) }
230
231
</ p >
231
232
</ div >
232
233
< Button
233
234
icon = { < SyncOutlined spin = { refreshing } /> }
234
235
onClick = { handleRefresh }
235
236
loading = { loading }
236
237
>
237
- Refresh
238
+ { trans ( "enterprise.environments.userGroups.refresh" ) }
238
239
</ Button >
239
240
</ div >
240
241
241
242
{ /* Error display */ }
242
243
{ error && (
243
244
< Alert
244
- message = "Error loading user groups"
245
+ message = { trans ( "enterprise.environments.userGroups.errorLoadingUserGroups" ) }
245
246
description = { error }
246
247
type = "error"
247
248
showIcon
@@ -252,8 +253,8 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
252
253
{ /* Configuration warnings */ }
253
254
{ ( ! environment . environmentApikey || ! environment . environmentApiServiceUrl ) && ! error && (
254
255
< Alert
255
- message = "Configuration Issue"
256
- description = "Missing required configuration: API key or API service URL"
256
+ message = { trans ( "enterprise.environments.userGroups.configurationIssue" ) }
257
+ description = { trans ( "enterprise.environments.userGroups.missingConfiguration" ) }
257
258
type = "warning"
258
259
showIcon
259
260
style = { { marginBottom : "16px" } }
@@ -264,28 +265,28 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
264
265
< Row gutter = { [ 16 , 16 ] } style = { { marginBottom : '20px' } } >
265
266
< Col xs = { 24 } sm = { 12 } md = { 6 } >
266
267
< StatCard
267
- title = "Total Groups"
268
+ title = { trans ( "enterprise.environments.userGroups.totalGroups" ) }
268
269
value = { stats . total }
269
270
icon = { < TeamOutlined /> }
270
271
/>
271
272
</ Col >
272
273
< Col xs = { 24 } sm = { 12 } md = { 6 } >
273
274
< StatCard
274
- title = "All Users Groups"
275
+ title = { trans ( "enterprise.environments.userGroups.allUsersGroups" ) }
275
276
value = { stats . allUsers }
276
277
icon = { < UserOutlined /> }
277
278
/>
278
279
</ Col >
279
280
< Col xs = { 24 } sm = { 12 } md = { 6 } >
280
281
< StatCard
281
- title = "Developer Groups"
282
+ title = { trans ( "enterprise.environments.userGroups.developerGroups" ) }
282
283
value = { stats . developers }
283
284
icon = { < CodeOutlined /> }
284
285
/>
285
286
</ Col >
286
287
< Col xs = { 24 } sm = { 12 } md = { 6 } >
287
288
< StatCard
288
- title = "Custom Groups"
289
+ title = { trans ( "enterprise.environments.userGroups.customGroups" ) }
289
290
value = { stats . custom }
290
291
icon = { < SettingOutlined /> }
291
292
/>
@@ -305,23 +306,23 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
305
306
</ div >
306
307
) : userGroups . length === 0 ? (
307
308
< Empty
308
- description = { error || "No user groups found in this environment" }
309
+ description = { error || trans ( "enterprise.environments.userGroups.noUserGroupsFound" ) }
309
310
image = { Empty . PRESENTED_IMAGE_SIMPLE }
310
311
/>
311
312
) : (
312
313
< >
313
314
{ /* Search Bar */ }
314
315
< div style = { { marginBottom : 16 } } >
315
316
< Search
316
- placeholder = "Search user groups by name or ID"
317
+ placeholder = { trans ( "enterprise.environments.userGroups.searchUserGroups" ) }
317
318
allowClear
318
319
onSearch = { value => setSearchText ( value ) }
319
320
onChange = { e => setSearchText ( e . target . value ) }
320
321
style = { { width : 300 } }
321
322
/>
322
323
{ searchText && filteredUserGroups . length !== userGroups . length && (
323
324
< div style = { { marginTop : 8 , color : '#8c8c8c' , fontSize : '13px' } } >
324
- Showing { filteredUserGroups . length } of { userGroups . length } user groups
325
+ { trans ( "enterprise.environments.userGroups.showingResults" , { count : filteredUserGroups . length , total : userGroups . length } ) }
325
326
</ div >
326
327
) }
327
328
</ div >
@@ -332,7 +333,7 @@ const UserGroupsTab: React.FC<UserGroupsTabProps> = ({ environment }) => {
332
333
rowKey = "groupId"
333
334
pagination = { {
334
335
pageSize : 10 ,
335
- showTotal : ( total , range ) => ` ${ range [ 0 ] } - ${ range [ 1 ] } of ${ total } user groups` ,
336
+ showTotal : ( total , range ) => trans ( "enterprise.environments.userGroups.paginationTotal" , { start : range [ 0 ] , end : range [ 1 ] , total } ) ,
336
337
size : 'small'
337
338
} }
338
339
size = "middle"
0 commit comments