@@ -50,7 +50,9 @@ export default class extends React.Component {
50
50
componentDidMount ( ) {
51
51
const socket = io . connect ( 'http://localhost:3000' ) ;
52
52
socket . on ( 'data' , ( fetchedData ) => {
53
- this . addItem ( fetchedData ) ;
53
+ if ( ! this . state . paused ) {
54
+ this . addItem ( fetchedData ) ;
55
+ }
54
56
} ) ;
55
57
}
56
58
@@ -110,23 +112,45 @@ export default class extends React.Component {
110
112
this . setState ( _ . cloneDeep ( defaultState ) ) ;
111
113
}
112
114
115
+ toggle = ( ) => this . setState ( { hideMenu : ! this . state . hideMenu } )
116
+
117
+ pauseResume = ( ) => this . setState ( { paused : ! this . state . paused } )
118
+
113
119
render ( ) {
114
120
return (
115
- < div style = { { height : '100vh' } } >
116
- < div style = { { flex : 1 } } >
117
- < ReactFC
118
- type = { this . state . type }
119
- width = "100%"
120
- height = "90%"
121
- dataFormat = "json"
122
- dataSource = { this . state . dataSource }
123
- />
124
- </ div >
125
- < div className = "text-center mt-2" >
126
- < button className = "btn btn-primary mr-2" onClick = { this . addSeries } > Add Variant</ button >
127
- </ div >
128
- < div className = "text-center mt-2" >
129
- < button className = "btn btn-danger" onClick = { this . clear } > Clear</ button >
121
+ < div className = "container-fluid" >
122
+ < div className = "row" >
123
+ < div className = { `control-panel${ this . state . hideMenu ? ' hidden' : '' } ` } >
124
+ < div style = { { flex : 1 } } >
125
+ < div className = "text-center mt-2" >
126
+ < button type = "button" className = "btn btn-primary mr-2" onClick = { this . addSeries } > Add Variant</ button >
127
+ </ div >
128
+ < div className = "text-center mt-2" >
129
+ < button type = "button" className = "btn btn-primary" onClick = { this . pauseResume } >
130
+ { this . state . paused ? 'Resume' : 'Pause' }
131
+ </ button >
132
+ </ div >
133
+ </ div >
134
+ < div className = "text-center mt-2 mb-2" >
135
+ < button type = "button" className = "btn btn-danger" onClick = { this . clear } > Clear Tests</ button >
136
+ </ div >
137
+ </ div >
138
+ < div className = "content" >
139
+ < div className = "nav" >
140
+ < a onClick = { this . toggle } >
141
+ < img height = { 34 } src = "/static/menu.svg" />
142
+ </ a >
143
+ </ div >
144
+ < div className = "content-inner" >
145
+ < ReactFC
146
+ type = { this . state . type }
147
+ width = "100%"
148
+ height = "85%"
149
+ dataFormat = "json"
150
+ dataSource = { this . state . dataSource }
151
+ />
152
+ </ div >
153
+ </ div >
130
154
</ div >
131
155
</ div >
132
156
) ;
0 commit comments