diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js index 2fef96f6bda2f2c23d4f24ef08383ffc03904323..099bd3b7ef89c1f93ea3fbf2ceb2e87b51ff36a8 100644 --- a/www/js/controllers/network-controllers.js +++ b/www/js/controllers/network-controllers.js @@ -157,11 +157,25 @@ function NetworkLookupController($scope, $state, $location, $ionicPopover, $win $scope.load = function() { if ($scope.search.loading){ + $scope.refreshing = false; + // Start network scan - csNetwork.start($scope.node, $scope.computeOptions()); + csNetwork.start($scope.node, $scope.computeOptions()) + .then(function(){ + if (!$scope.refreshing) { + $scope.refreshing = true; + csWot.extendAll(csNetwork.data.peers) + .then(function() { + // Avoid to refresh if view has been leaving + if ($scope.networkStarted) { + $scope.updateView(csNetwork.data); + } + $scope.refreshing = false; + }); + } + }); // Catch event on new peers - $scope.refreshing = false; $scope.listeners.push( csNetwork.api.data.on.changed($scope, function(data){ if (!$scope.refreshing) { diff --git a/www/js/platform.js b/www/js/platform.js index 39813ca2b962fe85a67aee1d6404245942ba8199..dd2f28b2c9655a1121f445183db0dacd581a536a 100644 --- a/www/js/platform.js +++ b/www/js/platform.js @@ -161,7 +161,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] // Not expert mode: continue with the fallback node if (!csSettings.data.expertMode) { - console.info("[platform] Switching to fallback node: {}".format(fallbackNode.server)); + console.info("[platform] Switching to fallback node: {0}".format(fallbackNode.server)); return fallbackNode; } @@ -190,8 +190,8 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] // Only change BMA node in settings csSettings.data.node = fallbackNode; - // Add a marker, for UI - csSettings.data.node.temporary = true; + // Add a marker, for UI (only if not expert mode) + csSettings.data.node.temporary = !csSettings.data.expertMode; csHttp.cache.clear(); @@ -213,6 +213,7 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] console.info("[platform] Network scanned in {0}ms, {1} peers (UP and synchronized) found".format(Date.now() - now, peers.length)); // TODO: store sync peers in storage ? + //csSettings.data. // Try to find the current peer in the list of synchronized peers var synchronized = _.some(peers, function(peer) { diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index edf1cb67c1d4d5d46579407de5bff9a1d824ef8f..e61558fd70ebf5737af69ad5c3c3409bbea92def 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -259,7 +259,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. return isCompatible; }) .catch(function() { - return false; // Unreacheable + return false; // Unreachable }); }; @@ -398,14 +398,14 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. aliveNodes.push(node); } else { - console.error('[BMA] Unreacheable (or not compatible) fallback node [{0}]: skipping'.format(node.server)); + console.error('[BMA] Unreachable (or not compatible) fallback node [{0}]: skipping'.format(node.server)); } }) })) .then(function() { return aliveNodes; }); - } + }; that.api.registerEvent('node', 'start'); that.api.registerEvent('node', 'stop');