@@ -4,14 +4,17 @@ import ReactScrolla from 'react-scrolla';
44
55import { LogProvider } from './Providers/LogProvider.js' ;
66import { LogTable } from './Components/LogTable.js' ;
7- import { SideBar } from './Components/SideBar.js' ;
7+ import { SideBar , Entry , Separator } from './Components/SideBar.js' ;
8+ import { ToggleEntry } from './Components/ToggleEntry.js' ;
9+ import { App as OCApp } from './Components/App.js' ;
810
911import { LogSearch } from './Search.js' ;
1012
1113export class App extends Component {
1214 state = {
1315 'entries' : [ ] ,
14- 'loading' : false
16+ 'loading' : false ,
17+ 'levels' : [ true , true , true , true , true ]
1518 } ;
1619
1720 constructor ( ) {
@@ -31,23 +34,40 @@ export class App extends Component {
3134 this . setState ( { loading : false } ) ;
3235 } ;
3336
37+ setLevel ( level , newState ) {
38+ let levels = this . state . levels ;
39+ levels [ level ] = newState ;
40+ this . setState ( { levels} ) ;
41+ }
42+
3443 render ( ) {
44+ let entries = this . state . entries . filter ( entry => {
45+ return this . state . levels [ entry . level ] ;
46+ } ) ;
47+
48+ let filters = this . state . levels . map ( ( status , level ) => {
49+ return (
50+ < ToggleEntry active = { status }
51+ onChange = { this . setLevel . bind ( this , level ) } >
52+ { LogProvider . levels [ level ] }
53+ </ ToggleEntry >
54+ ) ;
55+ } ) ;
56+
3557 return (
36- < div id = "content" role = "main" className = { "app-" + this . props . appId } >
58+ < OCApp appId = "logreader" >
3759 < SideBar >
38- < p > Dummy 1</ p >
39-
40- < p > Dummy 2</ p >
60+ { filters }
4161 </ SideBar >
4262
4363 < ReactScrolla
4464 id = "app-content"
4565 percentage = { 85 }
4666 onPercentage = { this . fetchNextPage }
4767 isLoading = { this . state . loading } >
48- < LogTable entries = { this . state . entries } />
68+ < LogTable entries = { entries } />
4969 </ ReactScrolla >
50- </ div >
70+ </ OCApp >
5171 ) ;
5272 }
5373}
0 commit comments