improve error messages + fix server error display

This commit is contained in:
Manuel Araoz 2014-02-13 17:00:26 -03:00
parent b8d2a863d9
commit 25b6011b7c
3 changed files with 48 additions and 44 deletions

View File

@ -136,11 +136,16 @@ A REST API is provided at /api. The entry points are:
/api/txs/?address=mmhmMNfBiZZ37g1tgg2t8DDbNoEdqKVxAL /api/txs/?address=mmhmMNfBiZZ37g1tgg2t8DDbNoEdqKVxAL
``` ```
### Sync status ### Historic blockchain data sync status
``` ```
/api/sync /api/sync
``` ```
### Live network p2p data sync status
```
/api/peer
```
## Web Socket API ## Web Socket API
The web socket API is served using [socket.io](http://socket.io) at: The web socket API is served using [socket.io](http://socket.io) at:
``` ```

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('insight.connection').controller('ConnectionController', angular.module('insight.connection').controller('ConnectionController',
function($scope, $window, Status, getSocket, PeerSync) { function($scope, $window, Status, getSocket, PeerSync) {
// Set initial values // Set initial values
$scope.apiOnline = true; $scope.apiOnline = true;
@ -11,12 +11,11 @@ function($scope, $window, Status, getSocket, PeerSync) {
var socket = getSocket($scope); var socket = getSocket($scope);
// Check for the node server connection // Check for the node server connection
socket.on('connect', function() {
$scope.serverOnline = true;
socket.on('disconnect', function() { socket.on('disconnect', function() {
$scope.serverOnline = false; $scope.serverOnline = false;
}); });
socket.on('connect', function() {
$scope.serverOnline = true;
}); });
// Check for the api connection // Check for the api connection
@ -42,10 +41,10 @@ function($scope, $window, Status, getSocket, PeerSync) {
}); });
}, true); }, true);
$window.addEventListener('online', function () { $window.addEventListener('online', function() {
$scope.$apply(function() { $scope.$apply(function() {
$scope.clienteOnline = true; $scope.clienteOnline = true;
}); });
}, true); }, true);
}); });

View File

@ -3,8 +3,8 @@
<!-- apiOnline disabled || !apiOnline --> <!-- apiOnline disabled || !apiOnline -->
<div class="alert alert-danger" data-ng-show="!serverOnline || !clienteOnline || !apiOnline", data-ng-init="getConnStatus()"> <div class="alert alert-danger" data-ng-show="!serverOnline || !clienteOnline || !apiOnline", data-ng-init="getConnStatus()">
<strong>Error!</strong> <strong>Error!</strong>
<p data-ng-show="!apiOnline">Can't connect to bitcoind.</p> <p data-ng-show="!apiOnline">Can't connect to bitcoind to get live updates from the p2p network.</p>
<p data-ng-show="!serverOnline">Can't connect to server.</p> <p data-ng-show="!serverOnline">Can't connect to insight server. Attempting to reconnect... </p>
<p data-ng-show="!clienteOnline">Can't connect to internet. Please, check your connection.</p> <p data-ng-show="!clienteOnline">Can't connect to internet. Please, check your connection.</p>
</div> </div>
</div> </div>