mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
* status bar (fixes #207) * moved topology options to sidebar * render topology option like snackbar * upgrade material-ui to 0.11
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
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 (
|
|
<div className="status-connection" title={title}>
|
|
<span className="status-icon fa fa-exclamation-circle" />
|
|
<span className="status-label">Trying to reconnect...</span>
|
|
</div>
|
|
);
|
|
}
|
|
},
|
|
|
|
renderTopologyStats: function(stats) {
|
|
const statsText = `${stats.node_count} nodes, ${stats.edge_count} connections`;
|
|
return <div className="status-stats">{statsText}</div>;
|
|
},
|
|
|
|
render: function() {
|
|
const showStats = this.props.topology && !this.props.errorUrl && !this.props.websocketClosed;
|
|
return (
|
|
<div className="status sidebar-item">
|
|
{showStats && this.renderTopologyStats(this.props.topology.stats)}
|
|
{!showStats && this.renderConnectionState(this.props.errorUrl, this.props.websocketClosed)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
});
|
|
|
|
module.exports = Status;
|