mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
* always set updated topology object when received * track whether route was set on initial load * removed connection count from status bar (was not deemed important) * fixed issue where topology option changes did not affect details pane * only show filtered nodes when count > 0 * clear nodes graph when empty topology is loaded * also prevent JS error if nodes are hovered over that should be gone * fixed options sync issue between graph and status bar * implemented topology options with immutable DS
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
const React = require('react');
|
|
|
|
const Status = React.createClass({
|
|
|
|
render: function() {
|
|
let title = '';
|
|
let text = 'Trying to reconnect...';
|
|
let showWarningIcon = false;
|
|
let classNames = 'status sidebar-item';
|
|
|
|
if (this.props.errorUrl) {
|
|
title = `Cannot reach Scope. Make sure the following URL is reachable: ${this.props.errorUrl}`;
|
|
classNames += ' status-loading';
|
|
showWarningIcon = true;
|
|
} else if (!this.props.topologiesLoaded) {
|
|
text = 'Loading topologies...';
|
|
classNames += ' status-loading';
|
|
showWarningIcon = false;
|
|
} else if (this.props.websocketClosed) {
|
|
classNames += ' status-loading';
|
|
showWarningIcon = true;
|
|
} else if (this.props.topology) {
|
|
const stats = this.props.topology.stats;
|
|
text = `${stats.node_count} nodes`;
|
|
if (stats.filtered_nodes) {
|
|
text = `${text} (${stats.filtered_nodes} filtered)`;
|
|
}
|
|
classNames += ' status-stats';
|
|
showWarningIcon = false;
|
|
}
|
|
|
|
return (
|
|
<div className={classNames}>
|
|
{showWarningIcon && <span className="status-icon fa fa-exclamation-circle" />}
|
|
<span className="status-label" title={title}>{text}</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
});
|
|
|
|
module.exports = Status;
|