summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DataModel.js12
-rw-r--r--www/js/EventCtrl.js19
-rw-r--r--www/js/EventsGraphsCtrl.js2
-rw-r--r--www/js/MonitorCtrl.js19
-rw-r--r--www/js/app.js25
5 files changed, 43 insertions, 34 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 90830e73..b0ae8ca3 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -184,9 +184,10 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
getMonitors: function (forceReload) {
console.log("** Inside ZMData getMonitors with forceReload=" + forceReload);
$ionicLoading.show({
- template: 'Loading ZoneMinder Monitors...',
+ template: 'Loading Monitors...',
animation: 'fade-in',
showBackdrop: true,
+ duration:10000,
maxWidth: 200,
showDelay: 0
});
@@ -196,7 +197,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
console.log("ZMDataModel: Invoking HTTP get to load monitors");
var apiurl = loginData.apiurl;
var myurl = apiurl + "/monitors.json";
- $http.get(myurl)
+ $http.get(myurl, {timeout:10000})
.success(function (data) {
//console.log("HTTP success got " + JSON.stringify(data.monitors));
monitors = data.monitors;
@@ -250,11 +251,12 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
console.log("ZMData getEvents called with ID=" + monitorId);
$ionicLoading.show({
- template: 'Loading ZoneMinder Events...',
+ template: 'Loading Events...',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
- showDelay: 0
+ showDelay: 0,
+ duration:10000, //specifically for Android - http seems to get stuck at times
});
var d = $q.defer();
@@ -278,7 +280,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
return d.promise;
} else { // not simulated
- $http.get(myurl)
+ $http.get(myurl, {timeout:10000})
.success(function (data) {
$ionicLoading.hide();
myevents = data.events.reverse();
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index fadc9f65..963ef3d3 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -56,18 +56,12 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion
play: "2"
}
- $scope.initLoadingImage = function()
- {
- console.log ("***Loading***");
- /* $ionicLoading.show({
- template: "loading, please wait...",
- noBackdrop: true,
- });*/
- }
+
$scope.finishedLoadingImage = function()
{
+ console.log ("*** Events image FINISHED loading ***");
$ionicLoading.hide();
// alert ("IMAGE LOADED");
}
@@ -93,7 +87,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion
$ionicLoading.show({
template: "please wait...",
noBackdrop: true,
-
+ duration: 10000,
});
var loginData = ZMDataModel.getLogin();
@@ -123,13 +117,14 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion
break;
};
-
+ console.log ("** POST URL " +loginData.url+ 'zm/index.php');
var req = $http({
method: 'POST',
- url: loginData.url + 'zm/index.php',
+ timeout: 10000,
+ url: loginData.url + '/zm/index.php',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
- 'Accept': '*/*',
+ //'Accept': '*/*',
},
transformRequest: function (obj) {
var str = [];
diff --git a/www/js/EventsGraphsCtrl.js b/www/js/EventsGraphsCtrl.js
index 8523a5c7..5cd5e71a 100644
--- a/www/js/EventsGraphsCtrl.js
+++ b/www/js/EventsGraphsCtrl.js
@@ -87,7 +87,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', functio
console.log("Monitor event URL:" + url);
if (!ZMDataModel.isSimulated())
{
- $http.get(url)
+ $http.get(url, {timeout:10000})
.success(function (data) {
console.log("**** EVENT COUNT FOR MONITOR " +
monitors[j].Monitor.Id + " IS " + data.pagination.count);
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index def65266..4e217464 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -16,25 +16,26 @@ $scope.reloadView = function ()
$ionicLoading.show({
template: "refreshed view",
noBackdrop: true,
- duration: 3000
+ duration: 2000
});
}
-$scope.initLoadingImage = function()
+$scope.isSimulated = function () {
+ return ZMDataModel.isSimulated();
+ };
+
+
+$scope.finishedLoadingImage = function()
{
- console.log ("***Loading***");
+ console.log ("***Monitor image FINISHED Loading***");
+ $ionicLoading.hide();
/* $ionicLoading.show({
template: "loading, please wait...",
noBackdrop: true,
});*/
}
-
- $scope.finishedLoadingImage = function()
- {
- $ionicLoading.hide();
- // alert ("IMAGE LOADED");
- }
+
$scope.$on('$ionicView.loaded', function(){
console.log("**VIEW ** Monitor Ctrl Loaded");
diff --git a/www/js/app.js b/www/js/app.js
index d4059074..be83cd23 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -6,6 +6,10 @@ angular.module('zmApp', [
])
+// this directive will be load any time an image completes loading
+// via img tags where this directive is added (I am using this in
+// events and mionitor view to show a loader while the image is
+// downloading from ZM
.directive('imageonload', function() {
return {
restrict: 'A',
@@ -14,11 +18,14 @@ angular.module('zmApp', [
//call the function that was passed
scope.$apply(attrs.imageonload);
});
- }
+ },
+
+
};
})
-.directive('img', function () {
+/*
+ .directive('img', function () {
// element[0].src = 'img/demo.gif';
return {
@@ -34,14 +41,11 @@ angular.module('zmApp', [
// });
}
}
-})
+})*/
.run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel,$cordovaSplashscreen) {
- // generates and error in desktops but works fine
- setTimeout(function() {
- $cordovaSplashscreen.hide()
- }, 3000)
+
ZMDataModel.init();
var loginData = ZMDataModel.getLogin();
@@ -92,6 +96,13 @@ angular.module('zmApp', [
$ionicPlatform.ready(function () {
+
+ // generates and error in desktops but works fine
+ console.log ("**** DEVICE READY ***");
+ setTimeout(function() {
+ $cordovaSplashscreen.hide()
+ }, 3000)
+
var pixelRatio = window.devicePixelRatio || 1;
$rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width);
$rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height);