summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-03-18 15:09:41 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-03-18 15:09:41 -0400
commit8400f93f0b4841eb967e32e9dd500c0e66a93a87 (patch)
tree47934fbadfbf9152f6bc78911d0ea5af6e6434c0
parent0948cb4d472784946a6d54e4797d20183cdcc799 (diff)
#200 - if you delete Demo, it won't come back
Former-commit-id: 51e4371b9be198767fd579ff4073f28649479cbc
-rw-r--r--www/js/DataModel.js13
-rw-r--r--www/js/LoginCtrl.js3
2 files changed, 13 insertions, 3 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 7207df83..70fd5caf 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -213,7 +213,7 @@ angular.module('zmApp.controllers')
var tLd = serverGroupList[loginData.serverName];
var keepBuilding = true;
- while (keepBuilding==true)
+ while (keepBuilding==true && tLd)
{
if (arrayObjectIndexOf(chainURLs,tLd.url,"url") == -1 ) // no loop
{
@@ -223,6 +223,11 @@ angular.module('zmApp.controllers')
if (tLd.fallbackConfiguration)
{
tLd = serverGroupList [tLd.fallbackConfiguration];
+ if (tLd == undefined)
+ {
+ // This can happen if the fallback profile was deleted
+ zmLog ("Looks like a server object was deleted, but is still in fallback");
+ }
}
else
{
@@ -320,7 +325,11 @@ angular.module('zmApp.controllers')
//console.log ("************ FOUND SERVER NAME " + as[x]);
// if serverGroupList[x]
}
- if (!isFoundDemo)
+
+ // Don't add the demo if there is another server
+ // because this means the user deleted it
+
+ if (!isFoundDemo && as.length == 0)
{
zmDebug ("Pushing demo server config to server groups");
//serverGroupList.push(demoS);
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index 11876862..e91c12d8 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -2,7 +2,7 @@
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console */
-angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', 'EventServer', '$ionicHistory', '$state', '$ionicActionSheet', 'SecuredPopups', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups) {
+angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', 'EventServer', '$ionicHistory', '$state', '$ionicActionSheet', 'SecuredPopups', '$localstorage', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups, $localstorage) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
@@ -137,6 +137,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
//console.log ("YOU WANT TO DELETE " + $scope.loginData.serverName);
//console.log ("LENGTH OF SERVERS IS " + Object.keys(zmServers).length);
if (Object.keys(zmServers).length > 1) {
+
ZMDataModel.zmLog("Deleting " + $scope.loginData.serverName);
delete zmServers[$scope.loginData.serverName];
ZMDataModel.setServerGroups(zmServers);