7
7
Button ,
8
8
ButtonStyleType ,
9
9
ButtonVariantType ,
10
+ ClusterStatusType ,
10
11
ComponentSizeType ,
11
12
Drawer ,
12
13
FiltersTypeEnum ,
@@ -31,19 +32,41 @@ import {
31
32
DEFAULT_CLUSTER_ID ,
32
33
EditDeleteClusterProps ,
33
34
} from './cluster.type'
35
+ import { getBulletColorAccToStatus } from './cluster.util'
34
36
import { ClusterEnvironmentDrawer } from './ClusterEnvironmentDrawer'
35
37
import DeleteClusterConfirmationModal from './DeleteClusterConfirmationModal'
36
38
import EditClusterDrawerContent from './EditClusterDrawerContent'
37
39
38
40
const HibernationRulesModal = importComponentFromFELibrary ( 'HibernationRulesModal' , null , 'function' )
39
41
const VirtualClusterForm = importComponentFromFELibrary ( 'VirtualClusterForm' , null , 'function' )
40
42
43
+ export const ClusterIconWithStatus = ( {
44
+ clusterStatus,
45
+ isVirtualCluster,
46
+ } : {
47
+ clusterStatus : ClusterStatusType
48
+ isVirtualCluster : boolean
49
+ } ) => {
50
+ const statusColor = getBulletColorAccToStatus ( clusterStatus )
51
+ return (
52
+ < span className = "dc__position-rel dc__overflow-hidden icon-dim-24" >
53
+ < Icon name = "ic-bg-cluster" color = { null } size = { 24 } />
54
+ { ! isVirtualCluster && (
55
+ < span
56
+ className = { `dc__position-abs dc__top-16 icon-dim-10 dc__border-radius-50-per dc__right-2--neg ${ statusColor } ` }
57
+ style = { { border : '2px solid var(--N0)' } }
58
+ />
59
+ ) }
60
+ </ span >
61
+ )
62
+ }
63
+
41
64
export const ClusterListCellComponent : FunctionComponent <
42
65
TableCellComponentProps < ClusterRowData , FiltersTypeEnum . STATE , { } >
43
66
> = ( {
44
67
field,
45
68
row : {
46
- data : { clusterId, clusterName, clusterType, envCount, serverUrl, clusterCategory, isVirtualCluster } ,
69
+ data : { clusterId, clusterName, clusterType, envCount, serverUrl, clusterCategory, isVirtualCluster, status } ,
47
70
} ,
48
71
isRowActive,
49
72
} : TableCellComponentProps < ClusterRowData , FiltersTypeEnum . STATE , { } > ) => {
@@ -82,6 +105,9 @@ export const ClusterListCellComponent: FunctionComponent<
82
105
} )
83
106
break
84
107
case 'delete-cluster' :
108
+ if ( clusterId === DEFAULT_CLUSTER_ID ) {
109
+ break
110
+ }
85
111
push ( {
86
112
pathname : generatePath ( `${ URLS . GLOBAL_CONFIG_CLUSTER } /${ URLS . DELETE_CLUSTER } /:clusterId` , {
87
113
clusterId,
@@ -97,9 +123,9 @@ export const ClusterListCellComponent: FunctionComponent<
97
123
switch ( field ) {
98
124
case ClusterListFields . ICON :
99
125
return (
100
- < span className = "flex py-8 " >
101
- < Icon name = "ic-bg-cluster" color = { null } size = { 24 } />
102
- </ span >
126
+ < div className = "flex left py-10 " >
127
+ < ClusterIconWithStatus clusterStatus = { status } isVirtualCluster = { isVirtualCluster } />
128
+ </ div >
103
129
)
104
130
case ClusterListFields . CLUSTER_NAME :
105
131
return (
@@ -108,27 +134,37 @@ export const ClusterListCellComponent: FunctionComponent<
108
134
selectedTab : ClusterEnvTabs . ENVIRONMENTS ,
109
135
clusterId,
110
136
} ) }
111
- className = "flex left py-8 dc__truncate "
137
+ className = "flex left py-10 "
112
138
>
113
- { clusterName }
139
+ < Tooltip content = { clusterName } >
140
+ < span className = "dc__truncate" > { clusterName } </ span >
141
+ </ Tooltip >
114
142
</ Link >
115
143
)
116
144
case ClusterListFields . CLUSTER_TYPE :
117
- return < span className = "flex left py-8 " > { clusterType } </ span >
145
+ return < span className = "flex left py-10 " > { clusterType } </ span >
118
146
case ClusterListFields . ENV_COUNT :
119
- return < span className = "flex left py-8 " > { envCount ? `${ envCount } ` : 'No' } Environments</ span >
147
+ return < span className = "flex left py-10 " > { envCount ? `${ envCount } ` : 'No' } Environments</ span >
120
148
case ClusterListFields . CLUSTER_CATEGORY :
121
- return < span className = "flex left py-8 dc__truncate" > { clusterCategory } </ span >
149
+ return (
150
+ < div className = "flex left py-10" >
151
+ < Tooltip content = { clusterCategory } >
152
+ < span className = "dc__truncate" > { clusterCategory } </ span >
153
+ </ Tooltip >
154
+ </ div >
155
+ )
122
156
case ClusterListFields . SERVER_URL :
123
157
return (
124
- < Tooltip content = { serverUrl } >
125
- < span className = "flex left py-8 dc__truncate" > { serverUrl } </ span >
126
- </ Tooltip >
158
+ < div className = "flex left py-10" >
159
+ < Tooltip content = { serverUrl } >
160
+ < span className = "dc__truncate" > { serverUrl } </ span >
161
+ </ Tooltip >
162
+ </ div >
127
163
)
128
164
case ClusterListFields . ACTIONS :
129
165
return (
130
166
< div className = { isRowActive ? '' : 'dc__opacity-hover--child' } >
131
- < div className = "flex dc__gap-8 py-8 " >
167
+ < div className = "flex dc__gap-8 py-10 " >
132
168
< Button
133
169
dataTestId = { `add-env-${ clusterId } ` }
134
170
ariaLabel = { `add-env-${ clusterId } ` }
@@ -137,6 +173,10 @@ export const ClusterListCellComponent: FunctionComponent<
137
173
variant = { ButtonVariantType . borderLess }
138
174
size = { ComponentSizeType . xs }
139
175
onClick = { handleAddEnv }
176
+ showTooltip
177
+ tooltipProps = { {
178
+ content : 'Add Environment' ,
179
+ } }
140
180
/>
141
181
< Button
142
182
dataTestId = { `edit-cluster-${ clusterId } ` }
@@ -147,6 +187,10 @@ export const ClusterListCellComponent: FunctionComponent<
147
187
style = { ButtonStyleType . neutral }
148
188
size = { ComponentSizeType . xs }
149
189
onClick = { handleEditCluster }
190
+ showTooltip
191
+ tooltipProps = { {
192
+ content : 'Edit Cluster' ,
193
+ } }
150
194
/>
151
195
< ActionMenu
152
196
id = "cluster-actions-action-menu"
@@ -262,6 +306,7 @@ export const EditCluster = ({ clusterList, reloadClusterList, handleClose }: Edi
262
306
handleModalClose = { handleClose }
263
307
reload = { reloadClusterList }
264
308
category = { cluster . category }
309
+ isProd = { cluster . isProd }
265
310
/>
266
311
)
267
312
}
@@ -289,9 +334,12 @@ export const DeleteCluster = ({ clusterList, reloadClusterList, handleClose }: E
289
334
export const ClusterEnvLoader = ( ) => (
290
335
< >
291
336
{ Array . from ( { length : 3 } ) . map ( ( _ , idx ) => (
292
- // eslint-disable-next-line react/no-array-index-key
293
- < div key = { idx } className = "px-20 py-8 dc__grid environment-row dc__align-items-center" >
294
- { Array . from ( { length : 5 } ) . map ( ( _ , index ) => (
337
+ < div
338
+ // eslint-disable-next-line react/no-array-index-key
339
+ key = { idx }
340
+ className = { `px-20 py-8 dc__grid environment-row ${ VirtualClusterForm ? 'with-category' : '' } dc__align-items-center` }
341
+ >
342
+ { Array . from ( { length : 5 } ) . map ( ( _val , index ) => (
295
343
// eslint-disable-next-line react/no-array-index-key
296
344
< span key = { index } className = "shimmer" />
297
345
) ) }
0 commit comments