const React = require('react');
const Status = React.createClass({
renderConnectionState: function(errorUrl, websocketClosed) {
if (errorUrl || websocketClosed) {
const title = errorUrl ? 'Cannot reach Scope. Make sure the following URL is reachable: ' + errorUrl : '';
return (
Trying to reconnect...
);
}
},
renderTopologyStats: function(stats) {
const statsText = `${stats.node_count} nodes, ${stats.edge_count} connections`;
return {statsText}
;
},
render: function() {
const showStats = this.props.topology && !this.props.errorUrl && !this.props.websocketClosed;
return (
{showStats && this.renderTopologyStats(this.props.topology.stats)}
{!showStats && this.renderConnectionState(this.props.errorUrl, this.props.websocketClosed)}
);
}
});
module.exports = Status;