Skip to content

Instantly share code, notes, and snippets.

@remyleone
Created November 2, 2017 15:43
Show Gist options
  • Select an option

  • Save remyleone/8814b0f469e2709e87549883c7cac4e6 to your computer and use it in GitHub Desktop.

Select an option

Save remyleone/8814b0f469e2709e87549883c7cac4e6 to your computer and use it in GitHub Desktop.
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.state = { hasData: false };
}
componentDidMount() {
if (!this.state.hadData) {
return <div>Loading</div>;
} else {
this.render();
}
}
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);
});
this.state.hasData = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment