start with closed websocket, so that icon loads

This commit is contained in:
David Kaltschmidt
2015-06-16 15:49:36 +02:00
parent 35e5335359
commit 3dcd3e527f
4 changed files with 12 additions and 6 deletions

View File

@@ -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}

View File

@@ -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>
);
}

View File

@@ -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);

View File

@@ -127,6 +127,10 @@ const AppStore = assign({}, EventEmitter.prototype, {
getVersion: function() {
return version;
},
isWebsocketClosed: function() {
return websocketClosed;
}
});