diff options
| -rw-r--r-- | www/index.html | 9 | ||||
| -rw-r--r-- | www/js/DataModel.js | 24 | ||||
| -rw-r--r-- | www/js/DevOptionsCtrl.js | 36 | ||||
| -rw-r--r-- | www/js/MonitorModalCtrl.js | 11 | ||||
| -rw-r--r-- | www/js/app.js | 12 | ||||
| -rw-r--r-- | www/templates/devoptions.html | 39 | ||||
| -rw-r--r-- | www/templates/events-modal.html | 2 | ||||
| -rw-r--r-- | www/templates/help.html | 10 | ||||
| -rw-r--r-- | www/templates/login.html | 13 | ||||
| -rw-r--r-- | www/templates/monitors-modal.html | 2 |
10 files changed, 129 insertions, 29 deletions
diff --git a/www/index.html b/www/index.html index cb4d9677..f5c9e47e 100644 --- a/www/index.html +++ b/www/index.html @@ -49,6 +49,7 @@ <script src="js/MonitorCtrl.js"></script> <script src="js/HelpCtrl.js"></script> <script src="js/StateCtrl.js"></script> + <script src="js/DevOptionsCtrl.js"></script> <script src="lib/angular-circular-navigation/angular-circular-navigation.js"></script> @@ -114,7 +115,13 @@ <ion-item nav-clear menu-close href="#/login"> <span class=" item-icon-left"> <i class="icon ion-person"></i> - </span> Settings + </span> ZM Settings + </ion-item> + + <ion-item nav-clear menu-close href="#/devoptions"> + <span class=" item-icon-left"> + <i class="icon ion-person"></i> + </span> Developer Settings </ion-item> <ion-item nav-clear menu-close href="#/help"> diff --git a/www/js/DataModel.js b/www/js/DataModel.js index cbb3e74d..b9ede609 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -20,9 +20,10 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion 'password': '', '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. Not using this now 'maxMontage': "10", //total # of monitors to display in montage - 'streamingurl': "" + 'streamingurl': "", + 'maxFPS':"3" // image streaming FPS }; // This is really a test mode. This is how I am validating @@ -157,6 +158,15 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion } + if (window.localStorage.getItem("maxFPS") != undefined) { + loginData.maxFPS = + window.localStorage.getItem("maxFPS"); + console.log("maxFPS " + loginData.maxFPS); + + } + + + monitorsLoaded = 0; console.log("Getting out of ZMDataModel init"); @@ -182,6 +192,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion }, setLogin: function (newLogin) { loginData = newLogin; + window.localStorage.setItem("username", loginData.username); window.localStorage.setItem("password", loginData.password); window.localStorage.setItem("url", loginData.url); @@ -189,6 +200,13 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion window.localStorage.setItem("simulationMode", loginData.simulationMode); window.localStorage.setItem("streamingurl", loginData.streamingurl); + if (loginData.maxFPS >30) + { + console.log ("MAXFPS Too high, maxing to 30"); + loginData.maxFPS = "30"; + } + window.localStorage.setItem("maxFPS", loginData.maxFPS); + if (!loginData.maxMontage) { @@ -197,7 +215,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion } if (parseInt(loginData.maxMontage) <= 0) { - console.log("*** TOO LOW ***"); + console.log("*** MAXMONTAGE TOO LOW ***"); loginData.maxMontage = 1; } diff --git a/www/js/DevOptionsCtrl.js b/www/js/DevOptionsCtrl.js new file mode 100644 index 00000000..9bb5a759 --- /dev/null +++ b/www/js/DevOptionsCtrl.js @@ -0,0 +1,36 @@ +/* jshint -W041 */ +/* jslint browser: true*/ +/* global cordova,StatusBar,angular,console */ + +angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading) { + $scope.openMenu = function () { + $ionicSideMenuDelegate.toggleLeft(); + }; + + $scope.loginData = ZMDataModel.getLogin(); + + + + // Perform the login action when the user submits the login form + $scope.saveDevOptions = function () { + console.log('Saving Dev Options'); + + 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' + }); + } + + + if ((parseInt($scope.loginData.maxFPS) <0) || (parseInt($scope.loginData.maxFPS)>30)) + { + $scope.loginData.maxFPS='3'; + } + + + ZMDataModel.setLogin($scope.loginData); + }; + + +}]); diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js new file mode 100644 index 00000000..11306e4c --- /dev/null +++ b/www/js/MonitorModalCtrl.js @@ -0,0 +1,11 @@ +/* jshint -W041 */ +/* jslint browser: true*/ +/* global cordova,StatusBar,angular,console */ + +// controller for Modal Monitor View + +angular.module('zmApp.controllers').controller('zmApp.MonitorModalCtrl', ['$ionicPopup', '$scope', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', function ($ionicPopup,$scope, ZMDataModel, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope) { + + + +}]); diff --git a/www/js/app.js b/www/js/app.js index b541128c..7832a7bf 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -308,6 +308,18 @@ angular.module('zmApp', [ controller: 'zmApp.StateCtrl', }) + + .state('devoptions', { + data: { + requireLogin: true + }, + url: "/devoptions", + templateUrl: "templates/devoptions.html", + controller: 'zmApp.DevOptionsCtrl', + }) + + + .state('montage', { data: { requireLogin: true diff --git a/www/templates/devoptions.html b/www/templates/devoptions.html new file mode 100644 index 00000000..95c6d4e3 --- /dev/null +++ b/www/templates/devoptions.html @@ -0,0 +1,39 @@ +<ion-view view-title="Developer Settings"> + + <ion-nav-buttons side="left"> + <button class="button button-icon button-clear ion-navicon" ng-click="openMenu()"></button> + </ion-nav-buttons> + + + <ion-content class="padding"> + <div class="list list-inset"> + + <span style="color:rgb(100,100,100)"><i class="ion-android-settings" style="font-size:150%"></i> Developer Options</span> + + <!-- <ion-toggle ng-model="loginData.simulationMode" ng-checked={{loginData.simulationMode}} toggle-class="toggle-energized">Simulation Mode</ion-toggle>--> + + <div class="item item-input-inset"> + + Max Monitors in Montage + <label class="item-input-wrapper"> + <input type="tel" placeholder="be careful" ng-model="loginData.maxMontage"> + </label> + + </div> + + <div class="item item-input-inset"> + + Max FPS for streaming + <label class="item-input-wrapper"> + <input type="tel" placeholder="max is 30" ng-model="loginData.maxFPS"> + </label> + + </div> + + + + <button class="button button-block button-balanced icon ion-locked" ng-click="saveDevOptions()"> Save</button> + + + </ion-content> +</ion-view> diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html index 4cb76867..ca73ae9c 100644 --- a/www/templates/events-modal.html +++ b/www/templates/events-modal.html @@ -16,7 +16,7 @@ <div ng-if="!isSimulated()"> <ion-scroll has-bouncing=false min-zoom=1 zooming="true" direction="xy" style="width: 100%; "> - <img imageonload="finishedLoadingImage()" ng-src="{{loginData.streamingurl}}/cgi-bin/zms?source=event&mode=jpeg&event={{eventId}}&frame=1&maxfps=5&replay=single&user={{loginData.username}}&pass={{loginData.password}}&connkey={{connKey}}&rand={{rand}}" width="100%" /> + <img imageonload="finishedLoadingImage()" ng-src="{{loginData.streamingurl}}/cgi-bin/zms?source=event&mode=jpeg&event={{eventId}}&frame=1&maxfps={{loginData.maxFPS}}&replay=single&user={{loginData.username}}&pass={{loginData.password}}&connkey={{connKey}}&rand={{rand}}" width="100%" /> </ion-scroll> diff --git a/www/templates/help.html b/www/templates/help.html index c2c43947..55d22d9e 100644 --- a/www/templates/help.html +++ b/www/templates/help.html @@ -43,16 +43,6 @@ should be reloaded. </ion-item> - <ion-item class="item-text-wrap"> - <h2><b> What is this simulator mode?</b></h2> - It was really a way for me to test how the app behaves when there are 1000s of events and many monitors. - Practically, you won't have a need for it - </ion-item> - - <ion-item class="item-text-wrap"> - <h2><b>When I switch between Simulator to Real mode, the data does not change</b></h2> - Pull to refresh. - </ion-item> <ion-item class="item-text-wrap"> <h2><b>I want to contribute!</b></h2> diff --git a/www/templates/login.html b/www/templates/login.html index d5537641..3c074c99 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -27,19 +27,6 @@ <input autocapitalize="none" type="text" placeholder="ZM Api URL" ng-model="loginData.apiurl"> </label> </div> - <span style="color:rgb(100,100,100)"><i class="ion-android-settings" style="font-size:150%"></i> Developer Options</span> - <ion-toggle ng-model="loginData.simulationMode" ng-checked={{loginData.simulationMode}} toggle-class="toggle-energized">Simulation Mode</ion-toggle> - <div class="item item-input-inset"> - Max Monitors in Montage - <label class="item-input-wrapper"> - <input type="tel" placeholder="be careful" ng-model="loginData.maxMontage"> - </label> - - - - </div> - <button class="button button-block button-balanced icon ion-locked" ng-click="login()"> Save</button> - </ion-content> </ion-view> diff --git a/www/templates/monitors-modal.html b/www/templates/monitors-modal.html index f21beae4..23562a7a 100644 --- a/www/templates/monitors-modal.html +++ b/www/templates/monitors-modal.html @@ -17,7 +17,7 @@ <div ng-if="!isSimulated()"> <ion-scroll has-bouncing=false min-zoom=1 zooming="true" direction="xy" style="width: 100%; "> - <img imageonload="finishedLoadingImage()" ng-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=jpeg&monitor={{monitorId}}&maxfps=3&buffer=1000&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{rand}}" width="100%" /> + <img imageonload="finishedLoadingImage()" ng-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=jpeg&monitor={{monitorId}}&maxfps={{LoginData.maxfps}}&buffer=1000&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{rand}}" width="100%" /> <!-- <img imageonload="finishedLoadingImage()" ng-src="{{LoginData.streamingurl}}/cgi-bin/zms?mode=jpeg&monitor={{monitorId}}&maxfps=3&buffer=1000&rand={{rand}}" width="100%" />--> </ion-scroll> |
