mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
start with closed websocket, so that icon loads
This commit is contained in:
@@ -23,7 +23,8 @@ function getStateFromStores() {
|
||||
nodeDetails: AppStore.getNodeDetails(),
|
||||
nodes: AppStore.getNodes(),
|
||||
topologies: AppStore.getTopologies(),
|
||||
version: AppStore.getVersion()
|
||||
version: AppStore.getVersion(),
|
||||
websocketClosed: AppStore.isWebsocketClosed()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ const App = React.createClass({
|
||||
<div className="header">
|
||||
<Logo />
|
||||
<Topologies topologies={this.state.topologies} currentTopology={this.state.currentTopology} />
|
||||
<Status errorUrl={this.state.errorUrl} />
|
||||
<Status errorUrl={this.state.errorUrl} websocketClosed={this.state.websocketClosed} />
|
||||
</div>
|
||||
|
||||
<Nodes nodes={this.state.nodes} highlightedNodeIds={this.state.highlightedNodeIds}
|
||||
|
||||
@@ -2,9 +2,9 @@ const React = require('react');
|
||||
|
||||
const Status = React.createClass({
|
||||
|
||||
renderConnectionState: function(errorUrl) {
|
||||
if (errorUrl) {
|
||||
const title = 'Cannot reach Scope. Make sure the following URL is reachable: ' + errorUrl;
|
||||
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" />
|
||||
@@ -17,7 +17,7 @@ const Status = React.createClass({
|
||||
render: function() {
|
||||
return (
|
||||
<div className="status">
|
||||
{this.renderConnectionState(this.props.errorUrl)}
|
||||
{this.renderConnectionState(this.props.errorUrl, this.props.websocketClosed)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ describe('AppStore', function() {
|
||||
expect(AppStore.getNodes()).toEqual(NODE_SET);
|
||||
|
||||
registeredCallback(CloseWebsocketAction);
|
||||
expect(AppStore.isWebsocketClosed()).toBeTruthy();
|
||||
expect(AppStore.getNodes()).toEqual(NODE_SET);
|
||||
|
||||
registeredCallback(ReceiveEmptyNodesDeltaAction);
|
||||
|
||||
@@ -127,6 +127,10 @@ const AppStore = assign({}, EventEmitter.prototype, {
|
||||
|
||||
getVersion: function() {
|
||||
return version;
|
||||
},
|
||||
|
||||
isWebsocketClosed: function() {
|
||||
return websocketClosed;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user