@@ -61,15 +61,7 @@ export const ClusterIconWithStatus = ({
61
61
)
62
62
}
63
63
64
- export const ClusterListCellComponent : FunctionComponent <
65
- TableCellComponentProps < ClusterRowData , FiltersTypeEnum . STATE , { } >
66
- > = ( {
67
- field,
68
- row : {
69
- data : { clusterId, clusterName, clusterType, envCount, serverUrl, clusterCategory, isVirtualCluster, status } ,
70
- } ,
71
- isRowActive,
72
- } : TableCellComponentProps < ClusterRowData , FiltersTypeEnum . STATE , { } > ) => {
64
+ export const ClusterActions = ( { clusterId, isVirtualCluster } : { clusterId : number ; isVirtualCluster : boolean } ) => {
73
65
const { push } = useHistory ( )
74
66
const { search } = useLocation ( )
75
67
@@ -120,6 +112,94 @@ export const ClusterListCellComponent: FunctionComponent<
120
112
}
121
113
}
122
114
115
+ return (
116
+ < div className = "flex dc__gap-8" >
117
+ < Button
118
+ dataTestId = { `add-env-${ clusterId } ` }
119
+ ariaLabel = { `add-env-${ clusterId } ` }
120
+ icon = { < Icon name = "ic-add" color = { null } /> }
121
+ showAriaLabelInTippy = { false }
122
+ variant = { ButtonVariantType . borderLess }
123
+ size = { ComponentSizeType . xs }
124
+ onClick = { handleAddEnv }
125
+ showTooltip
126
+ tooltipProps = { {
127
+ content : 'Add Environment' ,
128
+ } }
129
+ />
130
+ < Button
131
+ dataTestId = { `edit-cluster-${ clusterId } ` }
132
+ ariaLabel = { `edit-cluster-${ clusterId } ` }
133
+ icon = { < Icon name = "ic-pencil" color = { null } /> }
134
+ variant = { ButtonVariantType . borderLess }
135
+ showAriaLabelInTippy = { false }
136
+ style = { ButtonStyleType . neutral }
137
+ size = { ComponentSizeType . xs }
138
+ onClick = { handleEditCluster }
139
+ showTooltip
140
+ tooltipProps = { {
141
+ content : 'Edit Cluster' ,
142
+ } }
143
+ />
144
+ < ActionMenu
145
+ id = "cluster-actions-action-menu"
146
+ onClick = { handleActionMenuClick }
147
+ options = { [
148
+ ...( ! isVirtualCluster && HibernationRulesModal
149
+ ? [
150
+ {
151
+ items : [
152
+ {
153
+ id : 'edit-pod-spread' ,
154
+ label : 'Edit Pod Spread' ,
155
+ startIcon : { name : 'ic-two-cubes' as IconName } ,
156
+ } ,
157
+ {
158
+ id : 'hibernation-rules' ,
159
+ label : 'Hibernation Rules' ,
160
+ startIcon : {
161
+ name : 'ic-hibernate-circle' as IconName ,
162
+ } ,
163
+ } ,
164
+ ] ,
165
+ } ,
166
+ ]
167
+ : [ ] ) ,
168
+ {
169
+ items : [
170
+ {
171
+ id : 'delete-cluster' ,
172
+ label : 'Delete cluster' ,
173
+ startIcon : { name : 'ic-delete' } ,
174
+ isDisabled : clusterId === DEFAULT_CLUSTER_ID ,
175
+ type : 'negative' ,
176
+ } ,
177
+ ] ,
178
+ } ,
179
+ ] }
180
+ buttonProps = { {
181
+ ariaLabel : 'cluster-actions' ,
182
+ dataTestId : `cluster-actions-${ clusterId } ` ,
183
+ icon : < Icon name = "ic-more-vertical" color = { null } /> ,
184
+ size : ComponentSizeType . xs ,
185
+ variant : ButtonVariantType . borderLess ,
186
+ style : ButtonStyleType . neutral ,
187
+ showAriaLabelInTippy : false ,
188
+ } }
189
+ />
190
+ </ div >
191
+ )
192
+ }
193
+
194
+ export const ClusterListCellComponent : FunctionComponent <
195
+ TableCellComponentProps < ClusterRowData , FiltersTypeEnum . STATE , { } >
196
+ > = ( {
197
+ field,
198
+ row : {
199
+ data : { clusterId, clusterName, clusterType, envCount, serverUrl, clusterCategory, isVirtualCluster, status } ,
200
+ } ,
201
+ isRowActive,
202
+ } : TableCellComponentProps < ClusterRowData , FiltersTypeEnum . STATE , { } > ) => {
123
203
switch ( field ) {
124
204
case ClusterListFields . ICON :
125
205
return (
@@ -163,82 +243,8 @@ export const ClusterListCellComponent: FunctionComponent<
163
243
)
164
244
case ClusterListFields . ACTIONS :
165
245
return (
166
- < div className = { isRowActive ? '' : 'dc__opacity-hover--child' } >
167
- < div className = "flex dc__gap-8 py-10" >
168
- < Button
169
- dataTestId = { `add-env-${ clusterId } ` }
170
- ariaLabel = { `add-env-${ clusterId } ` }
171
- icon = { < Icon name = "ic-add" color = { null } /> }
172
- showAriaLabelInTippy = { false }
173
- variant = { ButtonVariantType . borderLess }
174
- size = { ComponentSizeType . xs }
175
- onClick = { handleAddEnv }
176
- showTooltip
177
- tooltipProps = { {
178
- content : 'Add Environment' ,
179
- } }
180
- />
181
- < Button
182
- dataTestId = { `edit-cluster-${ clusterId } ` }
183
- ariaLabel = { `edit-cluster-${ clusterId } ` }
184
- icon = { < Icon name = "ic-pencil" color = { null } /> }
185
- variant = { ButtonVariantType . borderLess }
186
- showAriaLabelInTippy = { false }
187
- style = { ButtonStyleType . neutral }
188
- size = { ComponentSizeType . xs }
189
- onClick = { handleEditCluster }
190
- showTooltip
191
- tooltipProps = { {
192
- content : 'Edit Cluster' ,
193
- } }
194
- />
195
- < ActionMenu
196
- id = "cluster-actions-action-menu"
197
- onClick = { handleActionMenuClick }
198
- options = { [
199
- ...( ! isVirtualCluster && HibernationRulesModal
200
- ? [
201
- {
202
- items : [
203
- {
204
- id : 'edit-pod-spread' ,
205
- label : 'Edit Pod Spread' ,
206
- startIcon : { name : 'ic-two-cubes' as IconName } ,
207
- } ,
208
- {
209
- id : 'hibernation-rules' ,
210
- label : 'Hibernation Rules' ,
211
- startIcon : {
212
- name : 'ic-hibernate-circle' as IconName ,
213
- } ,
214
- } ,
215
- ] ,
216
- } ,
217
- ]
218
- : [ ] ) ,
219
- {
220
- items : [
221
- {
222
- id : 'delete-cluster' ,
223
- label : 'Delete cluster' ,
224
- startIcon : { name : 'ic-delete' } ,
225
- isDisabled : clusterId === DEFAULT_CLUSTER_ID ,
226
- type : 'negative' ,
227
- } ,
228
- ] ,
229
- } ,
230
- ] }
231
- buttonProps = { {
232
- ariaLabel : 'cluster-actions' ,
233
- dataTestId : 'cluster-actions' ,
234
- icon : < Icon name = "ic-more-vertical" color = { null } /> ,
235
- size : ComponentSizeType . xs ,
236
- variant : ButtonVariantType . borderLess ,
237
- style : ButtonStyleType . neutral ,
238
- showAriaLabelInTippy : false ,
239
- } }
240
- />
241
- </ div >
246
+ < div className = { `${ isRowActive ? '' : 'dc__opacity-hover--child' } py-10` } >
247
+ < ClusterActions clusterId = { clusterId } isVirtualCluster = { isVirtualCluster } />
242
248
</ div >
243
249
)
244
250
default :
0 commit comments