@@ -15,12 +15,12 @@ import {
1515} from 'material-ui-pickers' ;
1616import DateFnsUtils from 'material-ui-pickers/utils/date-fns-utils' ;
1717
18- import Commands from './Commands' ;
19- import Sessions from './Sessions' ;
20- import SessionReplay from './ SessionReplay.jsx ' ;
18+ import Commands from '../containers /Commands' ;
19+ import Sessions from '../containers /Sessions' ;
20+ import SessionReplay from '../containers/ SessionReplay' ;
2121import {
2222 get
23- } from '../MyAxios.jsx' ;
23+ } from '../reducers/myAxios'
2424
2525function TabContainer ( props ) {
2626 return (
@@ -62,15 +62,11 @@ const styles = theme => ({
6262class App extends React . Component {
6363 state = {
6464 user : window . localStorage . getItem ( 'user' ) ,
65- commandsSessionID : '' ,
66- commandsSince : new Date ( ) ,
67- replaySessionID : 0 ,
68- tabIndex : 0
6965 } ;
7066
7167 componentDidMount = ( ) => {
7268 let params = new URLSearchParams ( window . location . search . substring ( 1 ) ) ;
73- let user = params . get ( " user" ) ;
69+ let user = params . get ( ' user' ) ;
7470 if ( user ) {
7571 this . setState ( {
7672 user : user
@@ -106,49 +102,18 @@ class App extends React.Component {
106102 get ( '/api/logout' , this . logout ) ;
107103 } ;
108104
109- handleReplay = ( sessionID ) => {
110- this . setState ( {
111- tabIndex : 2 ,
112- replaySessionID : sessionID
113- } )
114- }
115-
116- handleSessionSearchCommands = ( sessionID , since ) => {
117- this . setState ( {
118- tabIndex : 1 ,
119- commandsSessionID : sessionID ,
120- commandsSince : since
121- } ) ;
122- } ;
123-
124- handleCommandsSessionIDChange = event => {
125- this . setState ( {
126- commandsSessionID : event . target . value
127- } )
128- }
129-
130- handleCommandsSinceChange = since => {
131- this . setState ( {
132- commandsSince : since
133- } )
134- }
135-
136- handleTabIndexChange = ( event , tabIndex ) => {
137- this . setState ( {
138- tabIndex : tabIndex ,
139- } ) ;
140- } ;
141-
142105 render ( ) {
143106 const {
144- classes
107+ classes,
108+ commandsCount,
109+ commandsRowsPerPage,
110+ sessionsCount,
111+ sessionsRowsPerPage,
112+ tabIndex,
113+ onChangeTabIndex,
145114 } = this . props ;
146115 const {
147116 user,
148- tabIndex,
149- commandsSessionID,
150- commandsSince,
151- replaySessionID
152117 } = this . state ;
153118
154119 return (
@@ -177,7 +142,7 @@ class App extends React.Component {
177142 ) }
178143 </ Toolbar >
179144
180- < Tabs value = { tabIndex } onChange = { this . handleTabIndexChange } >
145+ < Tabs value = { tabIndex } onChange = { onChangeTabIndex } >
181146 < Tab label = "Sessions" />
182147 < Tab label = "Commands" />
183148 { tabIndex === 2 && < Tab label = "Replay" /> }
@@ -187,25 +152,15 @@ class App extends React.Component {
187152 < div style = { { display : ( tabIndex === 0 ) ? 'block' : 'none' } } >
188153 < TabContainer >
189154 < div className = { classes . main } >
190- < Sessions
191- onReplay = { this . handleReplay }
192- onSearchCommands = { this . handleSessionSearchCommands }
193- >
194- </ Sessions >
155+ < Sessions count = { sessionsCount } rowsPerPage = { sessionsRowsPerPage } />
195156 </ div >
196157 </ TabContainer >
197158 </ div >
198159
199160 < div style = { { display : ( tabIndex === 1 ) ? 'block' : 'none' } } >
200161 < TabContainer >
201162 < div className = { classes . main } >
202- < Commands
203- sessionID = { commandsSessionID }
204- onSessionIDChange = { this . handleCommandsSessionIDChange }
205- since = { commandsSince }
206- onSinceChange = { this . handleCommandsSinceChange }
207- >
208- </ Commands >
163+ < Commands count = { commandsCount } rowsPerPage = { commandsRowsPerPage } />
209164 </ div >
210165 </ TabContainer >
211166 </ div >
@@ -214,10 +169,7 @@ class App extends React.Component {
214169 < div >
215170 < TabContainer >
216171 < div className = { classes . main } >
217- < SessionReplay
218- sessionID = { replaySessionID }
219- >
220- </ SessionReplay >
172+ < SessionReplay />
221173 </ div >
222174 </ TabContainer >
223175 </ div >
@@ -229,7 +181,13 @@ class App extends React.Component {
229181} ;
230182
231183App . propTypes = {
232- classes : PropTypes . object . isRequired
184+ classes : PropTypes . object . isRequired ,
185+ commandsCount : PropTypes . number . isRequired ,
186+ commandsRowsPerPage : PropTypes . number . isRequired ,
187+ sessionsCount : PropTypes . number . isRequired ,
188+ sessionsRowsPerPage : PropTypes . number . isRequired ,
189+ tabIndex : PropTypes . number . isRequired ,
190+ onChangeTabIndex : PropTypes . func . isRequired
233191} ;
234192
235193export default withStyles ( styles ) ( App ) ;
0 commit comments