starting to show sync status via socket

This commit is contained in:
Manuel Araoz 2014-01-21 11:51:34 -03:00
parent 99c04752cd
commit ae9dd66b7a
4 changed files with 13 additions and 13 deletions

View File

@ -27,5 +27,6 @@ module.exports.broadcast_address_tx = function(address, tx) {
};
module.exports.broadcastSyncInfo = function(syncInfo) {
ios.sockets.emit('sync', syncInfo);
console.log('broadcastSyncInfo');
ios.sockets.in('sync').emit('status', syncInfo);
};

View File

@ -1,16 +1,8 @@
'use strict';
angular.module('insight.system').controller('FooterController',
function ($scope, Global, Status) {
function ($scope, Global) {
$scope.global = Global;
$scope.getFooter = function() {
Status.get({
q: 'getInfo'
}, function(d) {
$scope.info = d.info;
});
};
});

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('insight.status').controller('StatusController',
function ($scope, $routeParams, $location, $rootScope, Global, Status, Sync) {
function ($scope, $routeParams, $location, $rootScope, Global, Status, Sync, get_socket) {
$scope.global = Global;
$scope.getStatus = function(q) {
@ -28,5 +28,12 @@ angular.module('insight.status').controller('StatusController',
$rootScope.syncError = 'Could not get sync information' + e;
});
};
var socket = get_socket($scope);
socket.emit('subscribe', 'sync');
socket.on('status', function(info) {
console.log('info '+JSON.stringify(info));
});
});

View File

@ -22,9 +22,9 @@
</div>
<div class="no_matching text-danger" ng-show="badQuery">No matching records found!</div>
</form>
<div class="status" data-ng-controller="FooterController" data-ng-init="getFooter()">
<div class="status" data-ng-controller="StatusController" data-ng-init="getStatus('Info')">
<i class="small" data-ng-show="info.blocks">
<strong>Status:</strong> On Sync
<strong>Status:</strong> {{statusMessage}}
</i>
<i class="small">
<strong> Connections: </strong> {{info.connections}}