diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-12 20:15:20 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-12 20:15:20 -0400 |
| commit | b2ad62461c8993c33068d1b0215f36deba0e1c9f (patch) | |
| tree | 605ed1945cd2a55b10437b037fd465bade7e6a0f /www/js | |
| parent | 7025aa4ec599593a80e2d3c2249b49eae7ef9f6a (diff) | |
#704 chaining fixes
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 4 | ||||
| -rw-r--r-- | www/js/MenuController.js | 16 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 3 | ||||
| -rwxr-xr-x | www/js/app.js | 19 |
4 files changed, 31 insertions, 11 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 78135987..673740ff 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -1707,15 +1707,17 @@ angular.module('zmApp.controllers') // returns API version or none //------------------------------------------------------- getAPIversion: function () { - debug("getAPIversion called"); + var d = $q.defer(); var apiurl = loginData.apiurl + '/host/getVersion.json'; + debug("getAPIversion called with "+apiurl); $http.get(apiurl) .then(function (success) { if (success.data.version) { // console.log ("API VERSION RETURNED: " + JSON.stringify(success)); $rootScope.apiValid = true; setCurrentServerVersion(success.data.version); + debug("getAPI version succeded with "+success.data.version); d.resolve(success.data.version); } else { debug("Setting APIValid to false as API version was not retrieved"); diff --git a/www/js/MenuController.js b/www/js/MenuController.js index c221aebe..18cd5989 100644 --- a/www/js/MenuController.js +++ b/www/js/MenuController.js @@ -135,6 +135,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io disableBack: true }); + console.log ("+++ state go after getMonitors force"); $state.go('app.refresh', { "view": $state.current.name }); @@ -145,7 +146,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io }, function (error) { var refresh = NVRDataModel.getMonitors(1); - + console.log ("+++ state go after API version error: "+error); $rootScope.apiVersion = "0.0.0"; NVRDataModel.debug("Error, failed API version, setting to " + $rootScope.apiVersion); @@ -153,6 +154,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io disableBack: true }); + $state.go('app.refresh', { "view": $state.current.name }); @@ -174,15 +176,20 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io NVRDataModel.debug("refreshing API version..."); NVRDataModel.getAPIversion() .then(function (data) { - var refresh = NVRDataModel.getMonitors(1); - $rootScope.apiVersion = data; + var refresh = NVRDataModel.getMonitors(1) + .then (function () { + $rootScope.apiVersion = data; $ionicHistory.nextViewOptions({ disableBack: true }); + + console.log ("+++ state go after 5xx"); $state.go('app.refresh', { "view": $state.current.name }); return; + }); + }, function (error) { var refresh = NVRDataModel.getMonitors(1); @@ -191,6 +198,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io $ionicHistory.nextViewOptions({ disableBack: true }); + console.log ("+++ state go after API version force"); $state.go('app.refresh', { "view": $state.current.name }); @@ -234,7 +242,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io scope: $scope, template: '<ion-radio-fix ng-if="item" ng-repeat="item in avs" ng-value="item" ng-model="newServer.val"> {{item}} </ion-radio-fix>', - title: $translate.instant('kSelectLanguage'), + title: $translate.instant('kSelect'), buttons: [{ text: $translate.instant('kButtonCancel'), diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 894f139c..3a0a1726 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -1804,6 +1804,9 @@ angular.module('zmApp.controllers') currentStreamState = streamState.SNAPSHOT; // NVRDataModel.regenConnKeys(); $scope.monitors = NVRDataModel.getMonitorsNow(); + + console.log ("MONITORS:"+JSON.stringify($scope.monitors)); + $scope.MontageMonitors = angular.copy($scope.monitors); diff --git a/www/js/app.js b/www/js/app.js index abe2b0bd..f0ca9ffe 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1751,15 +1751,22 @@ angular.module('zmApp', [ - if ((NVRDataModel.hasLoginInfo() || toState.data.requireLogin == false) && toState.name != "app.invalidapi" && toState.name != "app.refresh") { + if ((NVRDataModel.hasLoginInfo() || toState.data.requireLogin == false) && toState.name != "app.invalidapi" ) { //console.log("State transition is authorized"); - NVRDataModel.debug ("Setting last-desktop-state to:"+JSON.stringify(toState)); - localforage.setItem('last-desktop-state', { - 'name': toState.name, - 'params': toState.params - }); + + if (toState.name != "app.refresh") { + + NVRDataModel.debug ("Setting last-desktop-state to:"+JSON.stringify(toState)); + localforage.setItem('last-desktop-state', { + 'name': toState.name, + 'params': toState.params + }); + + + } $rootScope.dpadState = toState.name.replace("app.", ""); return; + } else { NVRDataModel.log("In Auth State trans: Not logged in, requested to go to " + JSON.stringify(toState)); // event.preventDefault(); |
