diff options
| author | ARC <arjunrc@gmail.com> | 2015-05-09 19:18:30 -0400 |
|---|---|---|
| committer | ARC <arjunrc@gmail.com> | 2015-05-09 19:18:30 -0400 |
| commit | fdb1d93c54e4c67639185f2c859b1fec6a5fb904 (patch) | |
| tree | 3e4154164a3fc8f349503748b30fd99cd4946607 /www/js | |
| parent | bfe426a83bfcd32bac22bc06cccb15f15a9f9450 (diff) | |
Added support to limit maximum monitors in Montage View and also added a portal alias - those who many not be using one can keep this empty
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 37 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 10 | ||||
| -rw-r--r-- | www/js/EventsGraphsCtrl.js | 4 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 12 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 4 | ||||
| -rw-r--r-- | www/js/app.js | 3 |
6 files changed, 58 insertions, 12 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index aab1e643..a4f471ef 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -13,9 +13,11 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion var loginData = { 'username': '', 'password': '', - 'url': '', // This is ZM portal API (Don't add /zm) + 'url': '', // This is the ZM portal path 'apiurl': '', // This is the API path - 'simulationMode': false // if true, data will be simulated + 'simulationMode': false, // if true, data will be simulated + 'maxMontage':"10", //total # of monitors to display in montage + 'alias':"" }; // This is really a test mode. This is how I am validating @@ -137,6 +139,18 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion } + if (window.localStorage.getItem("maxMontage") != undefined) { + loginData.maxMontage = + window.localStorage.getItem("maxMontage"); + + } + + if (window.localStorage.getItem("alias") != undefined) { + loginData.alias = + window.localStorage.getItem("alias"); + + } + monitorsLoaded = 0; console.log("Getting out of ZMDataModel init"); @@ -167,6 +181,25 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion window.localStorage.setItem("url", loginData.url); window.localStorage.setItem("apiurl", loginData.apiurl); window.localStorage.setItem("simulationMode", loginData.simulationMode); + window.localStorage.setItem("alias",loginData.alias); + + + + if (!loginData.maxMontage) + { + console.log ("INVALID MONTAGE NUM"); + loginData.maxMontage="10"; + } + + if (parseInt(loginData.maxMontage)<=0) + { + console.log ("*** TOO LOW ***"); + loginData.maxMontage=1; + } + + + window.localStorage.setItem("maxMontage", loginData.maxMontage); + console.log("********** SIMULATION IS " + loginData.simulationMode); }, diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index d49bc244..8b179016 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -42,7 +42,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion $scope.$on('$ionicView.unloaded', function () { console.log("**VIEW ** Events Ctrl Unloaded"); console.log("*** MODAL ** Destroying modal too"); - $scope.modal.remove(); + if (!($scope.modal===undefined)) {$scope.modal.remove()}; }); @@ -130,10 +130,12 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion // If I leave it as JSON, it gets converted to OPTONS due // to CORS behaviour and ZM/Apache don't seem to handle it + console.log ("POST: "+loginData.url +'/'+ loginData.alias+'/index.php'); + var req = $http({ method: 'POST', /*timeout: 15000,*/ - url: loginData.url + '/zm/index.php', + url: loginData.url +'/'+ loginData.alias+'/index.php', headers: { 'Content-Type': 'application/x-www-form-urlencoded', //'Accept': '*/*', @@ -210,14 +212,14 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion // it on open $scope.closeModal = function () { console.log("Close & Destroy Modal"); - $scope.modal.remove(); + if (!($scope.modal===undefined)) {$scope.modal.remove()}; }; //Cleanup the modal when we're done with it // I Don't think it ever comes here $scope.$on('$destroy', function () { console.log("Destroy Modal"); - $scope.modal.remove(); + if (!($scope.modal===undefined)) {$scope.modal.remove()}; }); console.log("***CALLING EVENTS FACTORY"); diff --git a/www/js/EventsGraphsCtrl.js b/www/js/EventsGraphsCtrl.js index 01701d88..5793ed10 100644 --- a/www/js/EventsGraphsCtrl.js +++ b/www/js/EventsGraphsCtrl.js @@ -68,8 +68,8 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', functio $scope.chartObject.type = "BarChart"; $scope.chartObject.options = { title: chartTitle, - - height: $rootScope.devHeight, // FIXME: I need to make this dynamic depending on + tooltip: {isHtml:true, trigger: 'both'}, + height: $rootScope.devHeight, // # of bars legend: 'none', animation: { diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index e734fef2..3b79f7bf 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -1,4 +1,4 @@ -angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', function ($scope, $rootScope, $ionicModal, ZMDataModel,$ionicSideMenuDelegate) { +angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', function ($scope, $rootScope, $ionicModal, ZMDataModel,$ionicSideMenuDelegate, $ionicPopup) { $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); } @@ -10,9 +10,17 @@ $scope.openMenu = function () { // Perform the login action when the user submits the login form $scope.login = function () { console.log('Saving login'); + + if (parseInt($scope.loginData.maxMontage) >10) + { + $ionicPopup.alert({ + title: 'Note', + template: 'You have selected to view more than 10 monitors in the Montage screen. Note that this is very resource intensive and may load the server or cause issues in the application. If you are not sure, please consider limiting this value to 10' + }); + } ZMDataModel.setLogin($scope.loginData); + }; - }; }) diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 57573c5e..c85011b0 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -73,8 +73,10 @@ function onPause() { } - console.log("********* Inside Montage Ctrl"); + $scope.LoginData = ZMDataModel.getLogin(); + $scope.monLimit = $scope.LoginData.maxMontage; + console.log("********* Inside Montage Ctrl, MAX LIMIT="+$scope.monLimit); // slider is tied to the view slider for montage //Remember not to use a variable. I'm using an object diff --git a/www/js/app.js b/www/js/app.js index 8c207d35..0d3024f3 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -98,9 +98,10 @@ angular.module('zmApp', [ // generates and error in desktops but works fine console.log("**** DEVICE READY ***"); + setTimeout(function () { $cordovaSplashscreen.hide() - }, 3000) + }, 3000) var pixelRatio = window.devicePixelRatio || 1; $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width); |
