Created
November 2, 2017 15:00
-
-
Save remyleone/bb58045a9fd479a076672b4ca8eb881e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import {DebugPanel} from './DebutPanel'; | |
| import {SessionConfig} from './SessionConfig'; | |
| import {AboutTestingTool} from './AboutTestingTool'; | |
| import {Agent} from './Agent'; | |
| import {Footer} from './Footer'; | |
| import {TestNavigation} from './session/TestNavigation'; | |
| export default class App extends React.Component { | |
| constructor() { | |
| super(); | |
| this.refresh_state() | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <TestNavigation supported_tests={this.props.supported_tests}/> | |
| <Agent agent_link="http://localhost/agent_location"/> | |
| <DebugPanel/> | |
| <SessionConfig amqp_url={this.state.session_config.amqp_url}/> | |
| <AboutTestingTool/> | |
| <Footer/> | |
| </div> | |
| ) | |
| } | |
| static propTypes = { | |
| // supported_tests: PropTypes.arrayOf(String).isRequired | |
| }; | |
| refresh_state() { | |
| fetch('/state') | |
| .then(response => { | |
| if (response.status !== 200) { | |
| console.log('Looks like there was a problem. Status Code: ' + | |
| response.status); | |
| return; | |
| } | |
| // Examine the text in the response | |
| response.json().then(data => this.setState(data)); | |
| } | |
| ) | |
| .catch(err => { | |
| console.log('Fetch Error :-S', err); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment