summaryrefslogtreecommitdiff
path: root/www/js/LoginCtrl.js
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-03-16 16:33:58 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-03-16 16:33:58 -0400
commit8af8b2ceedebdb3e513591be0ac5ee28ac93217c (patch)
tree8440afc3076e9776f850190a3db4e70587ee960f /www/js/LoginCtrl.js
parentfcad5d2d8d654cd5dba9181a34f536da4aeb49ad (diff)
#133 - initial code to daisy chain configurations
Former-commit-id: d889e12001de6e6e9974703a2dfcc5345028dee7
Diffstat (limited to 'www/js/LoginCtrl.js')
-rw-r--r--www/js/LoginCtrl.js56
1 files changed, 47 insertions, 9 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index 0c09e4c3..e892d3f3 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -10,6 +10,15 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
var serverbuttons = [];
var availableServers;
+ $scope.loginData = ZMDataModel.getLogin();
+
+ $scope.check = {
+ isUseAuth: "",
+ isUseEventServer: ""
+ };
+
+ $scope.check.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false;
+ $scope.check.isUseEventServer = ($scope.loginData.isUseEventServer == true) ? true : false;
//----------------------------------------------------------------
// Alarm notification handling
@@ -29,15 +38,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
}
};
- $scope.loginData = ZMDataModel.getLogin();
-
- $scope.check = {
- isUseAuth: "",
- isUseEventServer: ""
- };
-
- $scope.check.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false;
- $scope.check.isUseEventServer = ($scope.loginData.isUseEventServer == true) ? true : false;
+
//console.log("*************************************************");
@@ -50,6 +51,43 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
});
//console.log("ADDING : " + availableServers[servIter]);
}
+
+
+ $scope.selectFallback = function ()
+ {
+ var as = Object.keys(ZMDataModel.getServerGroups());
+ if (as.length < 2)
+ {
+ $rootScope.zmPopup= SecuredPopups.show('alert',{
+ title: 'Error',
+ template: 'You need to have at least 2 distinct configurations created for a fallback'
+ });
+ return;
+
+ }
+ var ab = [{text:'Clear'}];
+ var ld = ZMDataModel.getLogin();
+ as.forEach(function(item) { if (item != ld.serverName) ab.push({text:item});});
+ var sheet = $ionicActionSheet.show({
+ buttons: ab,
+ titleText: 'Select fallback',
+ cancelText: 'Cancel',
+ cancel: function() {},
+ buttonClicked: function (index)
+ {
+ console.log ("YOU WANT " + ab[index].text + index);
+ if (index==0)
+ $scope.loginData.fallbackConfiguration="";
+ else
+ $scope.loginData.fallbackConfiguration = ab[index].text;
+ ZMDataModel.setLogin($scope.loginData);
+ return true;
+ }
+ });
+
+
+
+ };
$scope.serverActionSheet = function () {
var hideSheet = $ionicActionSheet.show({