@@ -13,6 +13,9 @@ import {
1313 ToolbarContent ,
1414 ToolbarItem ,
1515 ToolbarToggleGroup ,
16+ Switch ,
17+ FlexItem ,
18+ Flex ,
1619} from '@patternfly/react-core' ;
1720import { FilterIcon } from '@patternfly/react-icons/dist/esm/icons/filter-icon' ;
1821import { sortable } from '@patternfly/react-table' ;
@@ -38,7 +41,7 @@ import {
3841} from '../module/k8s' ;
3942import { connectToFlags } from '../reducers/connectToFlags' ;
4043import { RootState } from '../redux' ;
41- import { CheckBox , CheckBoxControls } from './row-filter' ;
44+ import { RowFilter } from './row-filter' ;
4245import { DefaultPage } from './default-resource' ;
4346import { Table , TextFilter } from './factory' ;
4447import { exactMatch , fuzzyCaseInsensitive } from './factory/table-filters' ;
@@ -586,17 +589,14 @@ const APIResourceAccessReview: React.FC<APIResourceTabProps> = ({
586589 ] ) ;
587590
588591 // event handlers
589- const toggleShowUsers = ( e : React . MouseEvent < HTMLAnchorElement > ) => {
590- e . preventDefault ( ) ;
591- setShowUsers ( ! showUsers ) ;
592+ const toggleShowUsers = ( e : React . FormEvent < HTMLInputElement > , checked : boolean ) => {
593+ setShowUsers ( checked ) ;
592594 } ;
593- const toggleShowGroups = ( e : React . MouseEvent < HTMLAnchorElement > ) => {
594- e . preventDefault ( ) ;
595- setShowGroups ( ! showGroups ) ;
595+ const toggleShowGroups = ( e : React . FormEvent < HTMLInputElement > , checked : boolean ) => {
596+ setShowGroups ( checked ) ;
596597 } ;
597- const toggleShowServiceAccounts = ( e : React . MouseEvent < HTMLAnchorElement > ) => {
598- e . preventDefault ( ) ;
599- setShowServiceAccounts ( ! showServiceAccounts ) ;
598+ const toggleShowServiceAccounts = ( e : React . FormEvent < HTMLInputElement > , checked : boolean ) => {
599+ setShowServiceAccounts ( checked ) ;
600600 } ;
601601 const onSelectAll = ( e : React . MouseEvent < HTMLButtonElement > ) => {
602602 e . preventDefault ( ) ;
@@ -625,31 +625,42 @@ const APIResourceAccessReview: React.FC<APIResourceTabProps> = ({
625625 </ div >
626626 </ div >
627627 < div className = "co-m-pane__body" >
628- < CheckBoxControls
628+ < RowFilter
629629 allSelected = { allSelected }
630630 itemCount = { itemCount }
631631 selectedCount = { selectedCount }
632632 onSelectAll = { onSelectAll }
633633 >
634- < CheckBox
635- title = { t ( 'public~User' ) }
636- active = { showUsers }
637- number = { users . length }
638- toggle = { toggleShowUsers }
639- />
640- < CheckBox
641- title = { t ( 'public~Group' ) }
642- active = { showGroups }
643- number = { groups . length }
644- toggle = { toggleShowGroups }
645- />
646- < CheckBox
647- title = { t ( 'public~ServiceAccount' ) }
648- active = { showServiceAccounts }
649- number = { serviceAccounts . length }
650- toggle = { toggleShowServiceAccounts }
651- />
652- </ CheckBoxControls >
634+ < Flex >
635+ < FlexItem >
636+ < Switch
637+ id = "user-switch"
638+ label = { t ( 'public~{{count}} User' , { count : users . length } ) }
639+ isChecked = { showUsers }
640+ onChange = { toggleShowUsers }
641+ ouiaId = "UserSwitch"
642+ />
643+ </ FlexItem >
644+ < FlexItem >
645+ < Switch
646+ id = "group-switch"
647+ label = { t ( 'public~{{count}} Group' , { count : groups . length } ) }
648+ isChecked = { showGroups }
649+ onChange = { toggleShowGroups }
650+ ouiaId = "GroupSwitch"
651+ />
652+ </ FlexItem >
653+ < FlexItem >
654+ < Switch
655+ id = "service-account-switch"
656+ label = { t ( 'public~{{count}} ServiceAccount' , { count : serviceAccounts . length } ) }
657+ isChecked = { showServiceAccounts }
658+ onChange = { toggleShowServiceAccounts }
659+ ouiaId = "ServiceAccountSwitch"
660+ />
661+ </ FlexItem >
662+ </ Flex >
663+ </ RowFilter >
653664 < p className = "co-m-pane__explanation" >
654665 { namespaced &&
655666 namespace &&
0 commit comments