diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 5ee895cebc93e8fe761c7447715561a8dee7f957..38c667271bc87debf9ee9a2a72cc526df06daa98 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -5,7 +5,7 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce .factory('BMA', function($q, csSettings, csHttp, $rootScope) { 'ngInject'; - function factory(host, port) { + function factory(host, port, cacheEnable) { var errorCodes = { @@ -48,7 +48,9 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce return host2 == host && ((!port && !port2) ||(port == port2)); } - var getMembers = csHttp.getWithCache(host, port, '/wot/members'); + var getMembers = cacheEnable ? + csHttp.getWithCache(host, port, '/wot/members') : + csHttp.get(host, port, '/wot/members'); function getMemberUidsByPubkey() { return getMembers() @@ -71,8 +73,12 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce }); } - var getBlockchainWithUd = csHttp.getWithCache(host, port, '/blockchain/with/ud', csHttp.cache.SHORT); - var getBlockchainBlock = csHttp.getWithCache(host, port, '/blockchain/block/:block', csHttp.cache.SHORT); + var getBlockchainWithUd = cacheEnable ? + csHttp.getWithCache(host, port, '/blockchain/with/ud', csHttp.cache.SHORT) : + csHttp.get(host, port, '/blockchain/with/ud'); + var getBlockchainBlock = cacheEnable ? + csHttp.getWithCache(host, port, '/blockchain/block/:block', csHttp.cache.SHORT) : + csHttp.get(host, port, '/blockchain/block/:block'); function getBlockchainLastUd() { return getBlockchainWithUd() @@ -220,7 +226,9 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce peers: csHttp.get(host, port, '/network/peers') }, blockchain: { - parameters: csHttp.getWithCache(host, port, '/blockchain/parameters', csHttp.cache.LONG), + parameters: cacheEnable ? + csHttp.getWithCache(host, port, '/blockchain/parameters', csHttp.cache.LONG) : + csHttp.get(host, port, '/blockchain/parameters'), current: csHttp.get(host, port, '/blockchain/current'), block: getBlockchainBlock, membership: csHttp.post(host, port, '/blockchain/membership'), @@ -236,9 +244,13 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce process: csHttp.post(host, port, '/tx/process'), history: { all: csHttp.get(host, port, '/tx/history/:pubkey'), - times: csHttp.getWithCache(host, port, '/tx/history/:pubkey/times/:from/:to'), + times: cacheEnable ? + csHttp.getWithCache(host, port, '/tx/history/:pubkey/times/:from/:to') : + csHttp.get(host, port, '/tx/history/:pubkey/times/:from/:to'), timesNoCache: csHttp.get(host, port, '/tx/history/:pubkey/times/:from/:to'), - blocks: csHttp.getWithCache(host, port, '/tx/history/:pubkey/blocks/:from/:to'), + blocks: cacheEnable ? + csHttp.getWithCache(host, port, '/tx/history/:pubkey/blocks/:from/:to') : + csHttp.get(host, port, '/tx/history/:pubkey/blocks/:from/:to'), pending: csHttp.get(host, port, '/tx/history/:pubkey/pending') } }, @@ -269,7 +281,7 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce }; } - var service = factory(csSettings.data.node.host, csSettings.data.node.port); + var service = factory(csSettings.data.node.host, csSettings.data.node.port, true /*cache*/); service.instance = factory; // Listen settings changes @@ -277,7 +289,7 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce var nodeServer = csHttp.getServer(settings.node.host, settings.node.port); if (nodeServer != service.node.server) { - var newService = factory(settings.node.host, settings.node.port); + var newService = factory(settings.node.host, settings.node.port, true /*cache*/); service.copy(newService); // reload service } diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js index bc67f6e6847de5d532d1372972c533ca74a83596..c768c06f7277671b421112bf98ee9180ae8ae90e 100644 --- a/www/js/services/network-services.js +++ b/www/js/services/network-services.js @@ -99,7 +99,7 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se peer.server = server; peer.blockNumber = peer.block.replace(/-.+$/, ''); data.newPeers.push(peer); - var node = BMA.instance(peer.getHost(), peer.getPort()); + var node = BMA.instance(peer.getHost(), peer.getPort(), false); return node.blockchain.current() .then(function(block){ peer.current = block; @@ -130,18 +130,25 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se var resolved = false; interval = $interval(function() { + console.debug('[network] check if finish...'); if (data.newPeers.length) { data.peers = data.peers.concat(data.newPeers.splice(0)); + console.debug('[network] New peers found: sort and ad them to result...'); sortPeers(); if (!waitAllPeers) { - resolved = true; - resolve(data.peers); + console.debug('[network] Returning to main process (peers will continue to be updating in background)'); + if (!resolved) { + resolved = true; + resolve(data.peers); + } } } else if (data.updatingPeers && !data.searchingPeersOnNetwork) { + console.debug('[network] Finish : all peers found. Stopping new peers check.'); // The peer lookup end, we can make a clean final report sortPeers(); data.updatingPeers = false; if (!resolved) { + console.debug('[network] refresh peer finished'); resolve(data.peers); } $interval.cancel(interval); diff --git a/www/templates/currency/view_currency.html b/www/templates/currency/view_currency.html index 5288c7d718922a908a67f290859569cba1ce1afc..c27347d782c408cf41a7683609f1b58e9a71e5ac 100644 --- a/www/templates/currency/view_currency.html +++ b/www/templates/currency/view_currency.html @@ -12,20 +12,22 @@ </ion-nav-buttons> <ion-content scroll="false"> - <ion-tabs class="tabs-icon-top tabs-positive has-header"> + <ion-tabs class="tabs-icon-top tabs-positive"> <ion-tab title="{{'CURRENCY.VIEW.TAB_CURRENCY'|translate}}" icon="ion-stats-bars"> - <ion-nav-view name="currency-tab"/> - <ion-content> - <ng-include src="'templates/currency/tabs/view_parameters.html'"/> - </ion-content> + <ion-nav-view name="currency-tab"> + <ion-content> + <ng-include src="'templates/currency/tabs/view_parameters.html'"/> + </ion-content> + </ion-nav-view> </ion-tab> <ion-tab title="{{'CURRENCY.VIEW.TAB_NETWORK'|translate}}" icon="ion-network" > - <ion-nav-view name="network-tab"/> - <ion-content class="padding no-padding-xs"> - <ng-include src="'templates/currency/tabs/view_network.html'"/> - </ion-content> + <ion-nav-view name="network-tab"> + <ion-content> + <ng-include src="'templates/currency/tabs/view_network.html'"/> + </ion-content> + </ion-nav-view> </ion-tab> </ion-tab> diff --git a/www/templates/wot/view_certifications.html b/www/templates/wot/view_certifications.html index 7dea18bf14485133217512b713a1308daf3dd280..7a1b228a7b706d8a72463f0d713fbe0e7897f665 100644 --- a/www/templates/wot/view_certifications.html +++ b/www/templates/wot/view_certifications.html @@ -16,25 +16,27 @@ <ion-tab title="{{'WOT.CERTIFICATIONS.SUMMARY'|translate}}" icon="ion-ribbon-b" on-select="setShowCertifications(true)" on-deselect="setShowCertifications(false)"> - <ion-nav-view name="currency-tab"/> - <ion-content> - <div class="center padding" ng-if="loading"> - <ion-spinner icon="android"></ion-spinner> - </div> - <ng-include src="'templates/wot/tabs/view_certifications.html'"/> - </ion-content> + <ion-nav-view name="currency-tab"> + <ion-content> + <div class="center padding" ng-if="loading"> + <ion-spinner icon="android"></ion-spinner> + </div> + <ng-include src="'templates/wot/tabs/view_certifications.html'"/> + </ion-content> + </ion-nav-view> </ion-tab> <ion-tab title="{{'WOT.GIVEN_CERTIFICATIONS.SUMMARY'|translate}}" icon="ion-ribbon-a" on-select="setShowGivenCertifications(true)" on-deselect="setShowGivenCertifications(false)"> - <ion-nav-view name="network-tab"/> - <ion-content class="padding no-padding-xs"> - <div class="center padding" ng-if="loading"> - <ion-spinner icon="android"></ion-spinner> - </div> - <ng-include src="'templates/wot/tabs/view_given_certifications.html'"/> - </ion-content> + <ion-nav-view name="network-tab"> + <ion-content> + <div class="center padding" ng-if="loading"> + <ion-spinner icon="android"></ion-spinner> + </div> + <ng-include src="'templates/wot/tabs/view_given_certifications.html'"/> + </ion-content> + </ion-nav-view> </ion-tab> </ion-tab>