11import React , { useMemo } from 'react' ;
2- import { Pagination } from '@patternfly/react-core' ;
2+ import { Pagination , TreeViewDataItem } from '@patternfly/react-core' ;
33import { BrowserRouter , useSearchParams } from 'react-router-dom' ;
44import { useDataViewFilters , useDataViewPagination } from '@patternfly/react-data-view/dist/dynamic/Hooks' ;
55import { DataView } from '@patternfly/react-data-view/dist/dynamic/DataView' ;
@@ -8,6 +8,7 @@ import { DataViewToolbar } from '@patternfly/react-data-view/dist/dynamic/DataVi
88import { DataViewFilterOption , DataViewFilters } from '@patternfly/react-data-view/dist/dynamic/DataViewFilters' ;
99import { DataViewTextFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTextFilter' ;
1010import { DataViewCheckboxFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewCheckboxFilter' ;
11+ import { DataViewTreeFilter } from '@patternfly/react-data-view/dist/dynamic/DataViewTreeFilter' ;
1112
1213const perPageOptions = [
1314 { title : '5' , value : 5 } ,
@@ -43,6 +44,61 @@ const filterOptions: DataViewFilterOption[] = [
4344 { label : 'Workspace three' , value : 'workspace-three' }
4445] ;
4546
47+ const statusOptions : TreeViewDataItem [ ] = [
48+ {
49+ name : 'Ready' ,
50+ id : 'ready' ,
51+ checkProps : { checked : false } ,
52+ customBadgeContent : 1 ,
53+ children : [
54+ {
55+ name : 'Updated' ,
56+ id : 'updated' ,
57+ checkProps : { checked : false } ,
58+ customBadgeContent : 0
59+ } ,
60+ {
61+ name : 'Waiting to update' ,
62+ id : 'waiting' ,
63+ checkProps : { checked : false } ,
64+ customBadgeContent : 0
65+ } ,
66+ {
67+ name : 'Conditions degraded' ,
68+ id : 'degraded' ,
69+ checkProps : { checked : false } ,
70+ customBadgeContent : 1
71+ } ,
72+ {
73+ name : 'Approval required' ,
74+ id : 'approval' ,
75+ checkProps : { checked : false } ,
76+ customBadgeContent : 0
77+ }
78+ ]
79+ } ,
80+ {
81+ name : 'Not ready' ,
82+ id : 'nr' ,
83+ checkProps : { checked : false } ,
84+ customBadgeContent : 1 ,
85+ children : [
86+ {
87+ name : 'Conditions degraded' ,
88+ id : 'nr-degraded' ,
89+ checkProps : { checked : false } ,
90+ customBadgeContent : 1
91+ }
92+ ]
93+ } ,
94+ {
95+ name : 'Updating' ,
96+ id : 'updating' ,
97+ checkProps : { checked : false } ,
98+ customBadgeContent : 0
99+ }
100+ ] ;
101+
46102const columns = [ 'Name' , 'Branch' , 'Pull requests' , 'Workspace' , 'Last commit' ] ;
47103
48104const ouiaId = 'LayoutExample' ;
@@ -81,6 +137,7 @@ const MyTable: React.FunctionComponent = () => {
81137 < DataViewTextFilter filterId = "name" title = 'Name' placeholder = 'Filter by name' />
82138 < DataViewTextFilter filterId = "branch" title = 'Branch' placeholder = 'Filter by branch' />
83139 < DataViewCheckboxFilter filterId = "workspace" title = 'Workspace' placeholder = 'Filter by workspace' options = { filterOptions } />
140+ < DataViewTreeFilter filterId = "status" title = 'Status' placeholder = 'Filter by status' options = { statusOptions } />
84141 </ DataViewFilters >
85142 }
86143 />
0 commit comments