errors in sync header

This commit is contained in:
Matias Alejo Garcia 2014-01-21 17:46:42 -03:00
parent 7e7e51a094
commit 92dc356b0b
4 changed files with 27 additions and 14 deletions

View File

@ -368,4 +368,10 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
font-size: 80%;
}
.status .text-danger {
color: white;
background: red;
display: inline-block;
padding:0px 5px;
}

View File

@ -25,31 +25,33 @@ function($scope, $routeParams, $location, $rootScope, Global, Status, Sync, get_
var on_sync_update = function(sync) {
if (sync.error) {
$rootScope.syncError = sync.error;
return;
$scope.syncError = sync.error;
}
if (sync.blocksToSync > sync.syncedBlocks) {
var p = parseInt(100*(sync.syncedBlocks) / sync.blocksToSync);
var delta = sync.blocksToSync - sync.syncedBlocks;
sync.message = 'Sync ' + p + '% ['+delta+' blocks remaining]';
sync.style = 'warn';
} else {
sync.message = 'On sync';
sync.style = 'success';
else {
if (sync.blocksToSync > sync.syncedBlocks) {
var p = parseInt(100*(sync.syncedBlocks) / sync.blocksToSync);
var delta = sync.blocksToSync - sync.syncedBlocks;
sync.message = 'Sync ' + p + '% ['+delta+' blocks remaining]';
sync.style = 'warn';
} else {
sync.message = 'On sync';
sync.style = 'success';
}
sync.tooltip = 'Synced blocks: '+sync.syncedBlocks;
}
sync.tooltip = 'Synced blocks: '+sync.syncedBlocks;
$scope.sync = sync;
$scope.hola = 'hola';
console.log('[status.js.43:hola:]'); //TODO
};
$scope.getSync = function() {
Sync.get({},
function(sync) {
$rootScope.syncError = null;
$scope.syncError = null;
on_sync_update(sync);
},
function(e) {
$rootScope.syncError = 'Could not get sync information' + e;
$scope.syncError = 'Could not get sync information' + e;
});
};

View File

@ -25,6 +25,8 @@
</div>
<div class="status" data-ng-controller="StatusController">
<span data-ng-init="getSync()">
<div class="text-danger" data-ng-show="syncError" tooltip="{{sync.error}}" tooltip-placement="bottom"> ERROR </div>
<span class="small" tooltip="{{sync.tooltip}}" tooltip-placement="down">
<i class="{{sync.style}}"><strong> {{sync.message}} </strong></i>
</span>

View File

@ -55,8 +55,11 @@ walk(models_path);
// historic_sync process
var historicSync = {};
if (!config.disableHistoricSync) {
historicSync = new HistoricSync();
historicSync.init({
skipDbConnection: true,
shouldBroadcast: true,