diff --git a/app/models/Status.js b/app/models/Status.js
index 321e227..517b51c 100644
--- a/app/models/Status.js
+++ b/app/models/Status.js
@@ -9,11 +9,6 @@ function spec() {
var rpc = new RpcClient(config.bitcoind);
function Status() {
- this.info = {};
- this.difficulty = {};
- this.txoutsetinfo = {};
- this.bestblockhash = {};
- this.lastblockhash = {};
}
Status.prototype.getInfo = function(next) {
diff --git a/public/js/controllers/status.js b/public/js/controllers/status.js
index 8b5b538..2bf2779 100644
--- a/public/js/controllers/status.js
+++ b/public/js/controllers/status.js
@@ -1,30 +1,22 @@
'use strict';
-angular.module('insight.status').controller('StatusController', ['$scope', '$routeParams', '$location', 'Global', 'Status', function ($scope, $routeParams, $location, Global, Status) {
+angular.module('insight.status').controller('StatusController', ['$scope', '$routeParams', '$location', 'Global', 'Status', 'Sync', function ($scope, $routeParams, $location, Global, Status, Sync) {
$scope.global = Global;
- $scope.getData = function(q) {
+ $scope.getStatus = function(q) {
Status.get({
- q: q
+ q: 'get' + q
}, function(d) {
- if (q === 'getInfo') {
- $scope.info = d.info;
- }
- if (q === 'getDifficulty') {
- $scope.difficulty = d.difficulty;
- }
- if (q === 'getTxOutSetInfo') {
- $scope.txoutsetinfo = d.txoutsetinfo;
- }
- if (q === 'getBestBlockHash') {
- $scope.bestblockhash = d.bestblockhash;
- }
- if (q === 'getLastBlockHash') {
- $scope.lastblockhash = d.lastblockhash;
- }
-
+ angular.extend($scope, d);
});
};
+ $scope.getSync = function() {
+ Sync.get({}, function(sync) {
+ $scope.sync = sync;
+ }, function() {
+ $rootScope.flashMessage = 'Could not get sync information';
+ });
+ };
}]);
diff --git a/public/js/services/status.js b/public/js/services/status.js
index f911c33..67d7004 100644
--- a/public/js/services/status.js
+++ b/public/js/services/status.js
@@ -6,3 +6,7 @@ angular.module('insight.status').factory('Status', ['$resource', function($resou
});
}]);
+angular.module('insight.status').factory('Sync', ['$resource', function($resource) {
+ return $resource('/api/sync');
+}]);
+
diff --git a/public/views/status.html b/public/views/status.html
index 9009f92..d439d63 100644
--- a/public/views/status.html
+++ b/public/views/status.html
@@ -7,7 +7,7 @@
getInfo
-
+
| Loading... |
@@ -72,8 +72,53 @@
+
sync status
+
+
+
+ | Sync Progress |
+ {{(100 * sync.syncedBlocks/sync.blocksToSync)| number:2}}%
+ |
+
+ | blocksToSync |
+ {{sync.blocksToSync}} |
+
+
+ | syncedBlocks |
+ {{sync.syncedBlocks}} |
+
+
+ | start |
+ {{sync.start}}
+ (genesisBlock)
+ |
+
+
+ | end |
+ {{sync.end}}
+ (genesisBlock)
+ |
+
+
+ | Sync Type |
+
+
+ - Stops at existing block
+
-
+ scanningBackward
+ scanningForward
+
+ |
+
+
+
+
+
+
+
+
getTxOutSetInfo
-
+
| Loading... |
@@ -114,7 +159,7 @@
getDifficulty
-
+
| Loading... |
@@ -128,7 +173,7 @@