@@ -19,22 +19,31 @@ const SectionTitle = styled.div`
19
19
}
20
20
` ;
21
21
22
+ // Define interface for user group data
23
+ interface UserGroup {
24
+ id : string ;
25
+ name : string ;
26
+ users : number ;
27
+ managed : boolean ;
28
+ deployed : string [ ] ;
29
+ }
30
+
22
31
interface UserGroupListProps {
23
32
environmentId : string ;
24
33
expanded ?: boolean ;
25
34
}
26
35
27
36
const UserGroupList : React . FC < UserGroupListProps > = ( { environmentId, expanded = false } ) => {
28
- const [ loading , setLoading ] = useState ( false ) ;
29
- const [ userGroups , setUserGroups ] = useState ( [ ] ) ;
30
- const [ activeTab , setActiveTab ] = useState ( "overview" ) ; // This would typically come from parent component
37
+ const [ loading , setLoading ] = useState < boolean > ( false ) ;
38
+ const [ userGroups , setUserGroups ] = useState < UserGroup [ ] > ( [ ] ) ;
39
+ const [ activeTab , setActiveTab ] = useState < string > ( "overview" ) ; // This would typically come from parent component
31
40
32
41
useEffect ( ( ) => {
33
42
// Mock API call to fetch user groups
34
43
setLoading ( true ) ;
35
44
setTimeout ( ( ) => {
36
45
// Mock data
37
- const mockUserGroups = [
46
+ const mockUserGroups : UserGroup [ ] = [
38
47
{
39
48
id : "ug1" ,
40
49
name : "Marketing Team" ,
@@ -69,7 +78,7 @@ const UserGroupList: React.FC<UserGroupListProps> = ({ environmentId, expanded =
69
78
} , 1000 ) ;
70
79
} , [ environmentId ] ) ;
71
80
72
- const toggleUserGroupManaged = ( userGroupId , currentState ) => {
81
+ const toggleUserGroupManaged = ( userGroupId : string , currentState : boolean ) => {
73
82
// Mock API call to toggle user group managed state
74
83
console . log ( `Toggle user group ${ userGroupId } managed state to ${ ! currentState } ` ) ;
75
84
@@ -84,7 +93,7 @@ const UserGroupList: React.FC<UserGroupListProps> = ({ environmentId, expanded =
84
93
title : trans ( "environmentSettings.userGroupName" ) ,
85
94
dataIndex : "name" ,
86
95
key : "name" ,
87
- render : ( text , record ) => (
96
+ render : ( text : string , record : UserGroup ) => (
88
97
< span >
89
98
{ text }
90
99
{ record . managed && (
@@ -103,7 +112,7 @@ const UserGroupList: React.FC<UserGroupListProps> = ({ environmentId, expanded =
103
112
{
104
113
title : trans ( "environmentSettings.manage" ) ,
105
114
key : "manage" ,
106
- render : ( _ , record ) => (
115
+ render : ( _ : any , record : UserGroup ) => (
107
116
< StyledSwitch
108
117
checked = { record . managed }
109
118
onChange = { ( ) => toggleUserGroupManaged ( record . id , record . managed ) }
@@ -113,7 +122,7 @@ const UserGroupList: React.FC<UserGroupListProps> = ({ environmentId, expanded =
113
122
{
114
123
title : trans ( "environmentSettings.actions" ) ,
115
124
key : "actions" ,
116
- render : ( _ , record ) => (
125
+ render : ( _ : any , record : UserGroup ) => (
117
126
< Button
118
127
type = "primary"
119
128
size = "small"
@@ -148,7 +157,7 @@ const UserGroupList: React.FC<UserGroupListProps> = ({ environmentId, expanded =
148
157
dataSource = { expanded ? userGroups : userGroups . slice ( 0 , 3 ) }
149
158
columns = { columns }
150
159
rowKey = "id"
151
- pagination = { expanded }
160
+ pagination = { expanded ? { } : false }
152
161
/>
153
162
</ Spin >
154
163
</ div >
0 commit comments