@@ -2,14 +2,11 @@ import { Link } from 'react-router-dom'
2
2
3
3
import {
4
4
ALL_NAMESPACE_OPTION ,
5
- BulkSelectionEvents ,
6
5
BulkSelectionIdentifiersType ,
7
6
Button ,
8
7
ButtonComponentType ,
9
8
ButtonStyleType ,
10
9
ButtonVariantType ,
11
- Checkbox ,
12
- CHECKBOX_VALUE ,
13
10
ClusterDetail ,
14
11
ClusterStatusType ,
15
12
ComponentSizeType ,
@@ -31,42 +28,18 @@ import { ClusterListRowTypes } from './types'
31
28
const CompareClusterButton = importComponentFromFELibrary ( 'CompareClusterButton' , null , 'function' )
32
29
const ClusterStatusCell = importComponentFromFELibrary ( 'ClusterStatus' , null , 'function' )
33
30
const KubeConfigButton = importComponentFromFELibrary ( 'KubeConfigButton' , null , 'function' )
31
+ const KubeConfigRowCheckbox = importComponentFromFELibrary ( 'KubeConfigRowCheckbox' , null , 'function' )
34
32
35
33
const ClusterListRow = ( {
36
34
clusterData,
37
35
clusterListLoader,
38
36
onChangeShowKubeConfigModal,
39
37
setSelectedClusterName,
40
38
} : ClusterListRowTypes ) => {
41
- const {
42
- selectedIdentifiers : bulkSelectionState ,
43
- handleBulkSelection,
44
- getSelectedIdentifiersCount,
45
- } = useBulkSelection < BulkSelectionIdentifiersType < ClusterDetail > > ( )
39
+ const { selectedIdentifiers : bulkSelectionState , getSelectedIdentifiersCount } =
40
+ useBulkSelection < BulkSelectionIdentifiersType < ClusterDetail > > ( )
46
41
const errorCount = clusterData . nodeErrors ? Object . keys ( clusterData . nodeErrors ) . length : 0
47
-
48
- const handleSelection = ( ) => {
49
- const { name } = clusterData
50
- if ( bulkSelectionState [ name ] ) {
51
- handleBulkSelection ( {
52
- action : BulkSelectionEvents . CLEAR_IDENTIFIERS ,
53
- data : {
54
- identifierIds : [ name ] ,
55
- } ,
56
- } )
57
- } else {
58
- handleBulkSelection ( {
59
- action : BulkSelectionEvents . SELECT_IDENTIFIER ,
60
- data : {
61
- identifierObject : {
62
- ...bulkSelectionState ,
63
- [ name ] : clusterData ,
64
- } ,
65
- } ,
66
- } )
67
- }
68
- setSelectedClusterName ( '' )
69
- }
42
+ const identifierCount = getSelectedIdentifiersCount ( )
70
43
71
44
const hideDataOnLoad = ( value ) => {
72
45
if ( clusterListLoader ) {
@@ -92,22 +65,8 @@ const ClusterListRow = ({
92
65
className = { `cluster-list-row fw-4 cn-9 fs-13 dc__border-bottom-n1 pt-12 pb-12 pr-20 pl-20 hover-class dc__visible-hover dc__visible-hover--parent
93
66
${ clusterListLoader ? 'show-shimmer-loading dc__align-items-center' : '' } ` }
94
67
>
95
- < div
96
- className = {
97
- isIdentifierSelected || getSelectedIdentifiersCount ( ) > 0
98
- ? 'dc__visible'
99
- : 'dc__visible-hover--child flex left'
100
- }
101
- >
102
- < Checkbox
103
- isChecked = { isIdentifierSelected }
104
- onChange = { handleSelection }
105
- rootClassName = "icon-dim-20 m-0"
106
- dataTestId = { `activate-${ clusterData . name } ` }
107
- value = { CHECKBOX_VALUE . CHECKED }
108
- />
109
- </ div >
110
- { ! isIdentifierSelected && getSelectedIdentifiersCount ( ) === 0 && (
68
+ { KubeConfigRowCheckbox && < KubeConfigRowCheckbox clusterData = { clusterData } /> }
69
+ { ! isIdentifierSelected && identifierCount === 0 && (
111
70
< div className = "dc__visible-hover--hide-child flex left" >
112
71
< Icon name = "ic-bg-cluster" color = { null } size = { 24 } />
113
72
</ div >
0 commit comments