diff options
| -rw-r--r-- | www/js/DataModel.js | 3 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 16 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 9 |
3 files changed, 22 insertions, 6 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index e01ed14e..7207df83 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -245,7 +245,8 @@ angular.module('zmApp.controllers') loginData = angular.copy(serverGroupList[firstReachableUrl.server]); - $localstorage.set("defaultServerName",firstReachableUrl.server); + setLogin(loginData); + //$localstorage.set("defaultServerName",firstReachableUrl.server); zmLog ("Based on reachability, first serverName will be " + firstReachableUrl.server); console.log ("set login Data to " + JSON.stringify(loginData)); diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 040dd2f9..11876862 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -105,6 +105,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r var zmServers = ZMDataModel.getServerGroups(); $scope.loginData = zmServers[serverbuttons[index].text]; + console.log ("NEW LOOGIN OBJECT IS " + JSON.stringify($scope.loginData)); $scope.check.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false; @@ -336,6 +337,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r function saveItems(showalert) { + console.log ("*********** SAVE ITEMS CALLED "); //console.log('Saving login'); ZMDataModel.setFirstUse(false); @@ -418,7 +420,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r if ($scope.check.isUseAuth) { if (!$scope.loginData.username) $scope.loginData.username = "x"; if (!$scope.loginData.password) $scope.loginData.password = "x"; - ZMDataModel.zmLog("Authentication is disabled, setting dummy user & pass"); + //ZMDataModel.zmLog("Authentication is disabled, setting dummy user & pass"); } if (parseInt($scope.loginData.maxMontage) <= 0) { @@ -501,6 +503,18 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r .then(function (data) { // Now let's validate if the API works + + // note that due to reachability, it might have switched to another server + + if ($scope.loginData.serverName != ZMDataModel.getLogin().serverName) + { + ZMDataModel.zmDebug (">>> Server information has changed, likely a fallback took over!"); + $scope.loginData = ZMDataModel.getLogin(); + apiurl = $scope.loginData.apiurl + '/host/getVersion.json'; + portalurl = $scope.loginData.url + '/index.php'; + } + + ZMDataModel.zmLog("Validating APIs at " + apiurl); $http.get(apiurl) diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index a3ad81dc..ba369771 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -254,7 +254,7 @@ function initPackery() if (!progressCalled) { - ZMDataModel.zmlog ("*** BUG PROGRESS WAS NOT CALLED"); + ZMDataModel.zmLog ("*** BUG PROGRESS WAS NOT CALLED"); pckry.reloadItems(); } @@ -287,7 +287,8 @@ function initPackery() //console.log ("Index:"+positions[j].attr+ " with size: " + positions[j].size); } } - $timeout(function(){pckry.initShiftLayout(positions, 'data-item-id'); },100); + $timeout(function(){ZMDataModel.zmDebug ("All images loaded, doing image layout");pckry.initShiftLayout(positions, 'data-item-id'); },100); + $timeout(function(){ZMDataModel.zmDebug ("Re-doing layout again - to overcome odd layout...");pckry.initShiftLayout(positions, 'data-item-id'); },200); //$grid.packery( 'initShiftLayout', initPositions, 'data-item-id' ); } @@ -664,7 +665,8 @@ function initPackery() // }.bind(this), 60 * 1000); //$interval.cancel(modalIntervalHandle); - + + }; @@ -913,7 +915,6 @@ function initPackery() $scope.doRefresh = function () { - // console.log("***Pull to Refresh, recomputing Rand"); ZMDataModel.zmLog("Reloading view for montage view, recomputing rand"); $rootScope.rand = Math.floor((Math.random() * 100000) + 1); |
