diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-28 08:37:24 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-28 08:37:24 -0400 |
| commit | d8fea09d65e5207ef8c4fafcddd5fc74a7f7be00 (patch) | |
| tree | 40d9528aa2e694624eec48da4eccec7c95aee057 /www/js/MonitorModalCtrl.js | |
| parent | 776d0d1a52622d5c84411ec3e3d9303ab117a696 (diff) | |
#709 implement native/XHR wrapper, convert all success/error to "then" construct
Diffstat (limited to 'www/js/MonitorModalCtrl.js')
| -rw-r--r-- | www/js/MonitorModalCtrl.js | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js index fe8f822d..5bb8952a 100644 --- a/www/js/MonitorModalCtrl.js +++ b/www/js/MonitorModalCtrl.js @@ -853,17 +853,18 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ }); - req.success(function (resp) { + req.then(function (resp) { //console.log("SUCCESS: " + JSON.stringify(resp)); $ionicLoading.hide(); - }); - - req.error(function (resp) { + }, + function (resp) { $ionicLoading.hide(); //console.log("ERROR: " + JSON.stringify(resp)); NVRDataModel.log("Error sending PTZ:" + JSON.stringify(resp), "error"); }); + + } $scope.getZoomLevel = function () { @@ -1446,14 +1447,16 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ } }); - req.success(function (resp) { + req.then(function (resp) { + resp = resp.data; if (resp.result == "Ok" && ndx != -1) { var ld = NVRDataModel.getLogin(); var apiurl = ld.apiurl + "/events/" + resp.status.event + ".json"; //console.log ("API " + apiurl); $http.get(apiurl) - .success(function (data) { + .then(function (data) { + data = data.data; if ($scope.MontageMonitors[ndx].eventUrlTime != data.event.Event.StartTime) { var element = angular.element(document.getElementById($scope.MontageMonitors[ndx].Monitor.Id + "-timeline")); @@ -1467,19 +1470,21 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ } - }) - .error(function (data) { + }, + function (data) { $scope.MontageMonitors[ndx].eventUrlTime = "-"; }); } - }); + }, - req.error(function (resp) { + function (resp) { //console.log("ERROR: " + JSON.stringify(resp)); NVRDataModel.log("Error sending event command " + JSON.stringify(resp), "error"); }); + + } $scope.toggleListMenu = function () { @@ -1544,7 +1549,8 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ var ld = NVRDataModel.getLogin(); var url = ld.apiurl + "/monitors/" + mid + ".json"; $http.get(url) - .success(function (data) { + .then(function (data) { + data = data.data; $scope.isControllable = data.monitor.Monitor.Controllable; // *** Only for testing - comment out // @@ -1559,8 +1565,8 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ NVRDataModel.debug("configurePTZ : getting controllable data " + myurl); $http.get(myurl) - .success(function (data) { - + .then(function (data) { + data = data.data; // *** Only for testing - comment out - start// /*data.Control.Control.CanSleep = '1'; data.Control.Control.CanWake = '1'; @@ -1722,8 +1728,8 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ } NVRDataModel.log("ConfigurePTZ Modal: ControlDB reports PTZ command to be " + $scope.ptzMoveCommand); - }) - .error(function (data) { + }, + function (data) { // console.log("** Error retrieving move PTZ command"); NVRDataModel.log("ConfigurePTZ : Error retrieving PTZ command " + JSON.stringify(data), "error"); }); @@ -1731,8 +1737,8 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ } else { NVRDataModel.log("configurePTZ " + mid + " is not PTZ controllable"); } - }) - .error(function (data) { + }, + function (data) { // console.log("** Error retrieving move PTZ command"); NVRDataModel.log("configurePTZ : Error retrieving PTZ command " + JSON.stringify(data), "error"); }); |
