From 92dc356b0b73ab155d2182c0bd64138549096ce7 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 21 Jan 2014 17:46:42 -0300 Subject: [PATCH] errors in sync header --- public/css/common.css | 6 ++++++ public/js/controllers/status.js | 30 ++++++++++++++++-------------- public/views/header.html | 2 ++ server.js | 3 +++ 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/public/css/common.css b/public/css/common.css index 7e4da55..9cc2c09 100644 --- a/public/css/common.css +++ b/public/css/common.css @@ -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; +} diff --git a/public/js/controllers/status.js b/public/js/controllers/status.js index a350002..59f34b0 100644 --- a/public/js/controllers/status.js +++ b/public/js/controllers/status.js @@ -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; }); }; diff --git a/public/views/header.html b/public/views/header.html index 47917e1..a465aa9 100755 --- a/public/views/header.html +++ b/public/views/header.html @@ -25,6 +25,8 @@
+
ERROR
+ {{sync.message}} diff --git a/server.js b/server.js index a44d1ef..b2cdaf0 100644 --- a/server.js +++ b/server.js @@ -55,8 +55,11 @@ walk(models_path); // historic_sync process var historicSync = {}; + + if (!config.disableHistoricSync) { historicSync = new HistoricSync(); + historicSync.init({ skipDbConnection: true, shouldBroadcast: true,