Skip to content
Snippets Groups Projects
Commit 3d8cc369 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[enh] Starting to implement startup node selection

parent 0660404d
No related branches found
No related tags found
1 merge request!647[enh] If node unreachable, select a random UP fallback peer
Pipeline #11415 failed
Subproject commit 366b85e16a589746f53ad260a02abdaa346a1212 Subproject commit 05c905f9f5cc2cc8698a995e87797991e87e9a26
...@@ -403,6 +403,8 @@ function NetworkLookupModalController($scope, $controller, parameters) { ...@@ -403,6 +403,8 @@ function NetworkLookupModalController($scope, $controller, parameters) {
$scope.enableLocationHref = false; $scope.enableLocationHref = false;
$scope.helptipPrefix = ''; $scope.helptipPrefix = '';
//$scope.compactMode = false; // Always false, because no toggle button in the modal
$scope.selectPeer = function(peer) { $scope.selectPeer = function(peer) {
$scope.closeModal(peer); $scope.closeModal(peer);
}; };
......
...@@ -100,8 +100,9 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -100,8 +100,9 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
}) })
.factory('csPlatform', function (ionicReady, $rootScope, $q, $state, $translate, $timeout, $ionicHistory, UIUtils, .factory('csPlatform', function (ionicReady, $rootScope, $q, $state, $translate, $timeout, $ionicHistory, $window,
BMA, Device, csHttp, csConfig, csCache, csSettings, csCurrency, csWallet) { UIUtils, Modals, BMA, Device,
csHttp, csConfig, csCache, csSettings, csCurrency, csWallet) {
'ngInject'; 'ngInject';
var var
...@@ -201,6 +202,38 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -201,6 +202,38 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
}); });
} }
// User can select a node
function selectBmaNode() {
var parameters = {
enableFilter: false,
type: 'all',
bma: true,
expertMode: true
};
if ($window.location.protocol === 'https:') {
parameters.ssl = true;
}
return Modals.showNetworkLookup(parameters)
.then(function(peer) {
if (!peer) return true; // User cancelled (= keep the default node)
var node = {
host: peer.getHost(),
port: peer.getPort(),
useSsl: peer.isSsl()
};
console.info("[platform] Selected peer:", node);
// Only change BMA node in settings
csSettings.data.node = node;
// Add a marker, for UI
csSettings.data.node.temporary = true;
return BMA.copy(node);
});
}
function isStarted() { function isStarted() {
return started; return started;
} }
...@@ -275,7 +308,9 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services'] ...@@ -275,7 +308,9 @@ angular.module('cesium.platform', ['ngIdle', 'cesium.config', 'cesium.services']
// Load BMA // Load BMA
.then(function(){ .then(function(){
return BMA.ready().then(checkBmaNodeAlive); return BMA.ready()
.then(checkBmaNodeAlive)
.then(selectBmaNode);
}) })
// Load currency // Load currency
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment