From 5c070d0e6500e1528e3869a2c3adea0ee4fc475e Mon Sep 17 00:00:00 2001 From: Sky Young Date: Mon, 21 May 2018 13:56:49 -0700 Subject: [PATCH] Get Network Info on Index page --- package.json | 2 +- public/src/js/controllers/index.js | 16 ++++++++++++++-- public/views/index.html | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4750f1a..b748488 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "flosight-ui", "description": "An open-source frontend for the Flosight API. The Flosight API provides you with a convenient, powerful and simple way to query and broadcast data on the florincoin network and build your own services with it.", - "version": "5.0.0-beta.58", + "version": "5.0.0-beta.59", "repository": "git://github.com/bitpay/flosight-ui.git", "bugs": { "url": "https://github.com/bitpay/flosight-ui/issues" diff --git a/public/src/js/controllers/index.js b/public/src/js/controllers/index.js index 169b80f..73351ba 100644 --- a/public/src/js/controllers/index.js +++ b/public/src/js/controllers/index.js @@ -4,7 +4,7 @@ var TRANSACTION_DISPLAYED = 10; var BLOCKS_DISPLAYED = 5; angular.module('flosight.system').controller('IndexController', - function($scope, Global, getSocket, Blocks) { + function($scope, Global, getSocket, Blocks, Status) { $scope.global = Global; var _getBlocks = function(loadTxs) { @@ -49,7 +49,18 @@ angular.module('flosight.system').controller('IndexController', _startSocket(); }); - + var _getStatus = function(q) { + Status.get({ + q: 'get' + q + }, + function(d) { + $scope.loaded = 1; + angular.extend($scope, d); + }, + function(e) { + $scope.error = 'API ERROR: ' + e.data; + }); + }; $scope.humanSince = function(time) { var m = moment.unix(time); @@ -59,6 +70,7 @@ angular.module('flosight.system').controller('IndexController', $scope.index = function() { _getBlocks(true); _startSocket(); + _getStatus('Info'); }; $scope.txs = []; diff --git a/public/views/index.html b/public/views/index.html index a50da8f..c4bf44a 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -9,7 +9,7 @@
-

Latest Blocks

+

Latest Blocks {{info.network}}