summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-08-21 11:09:08 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-08-21 11:09:08 -0400
commit05638adb21a0f13715e2f1390c4b85e972779e9a (patch)
tree85c6a68f06616181edff3b5f580dfe507552ff27 /www/js
parent26fa7692c30e1887079d067c782984f745edf750 (diff)
ionic content banner is being used for useful status displays
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DataModel.js28
-rw-r--r--www/js/EventCtrl.js2
-rw-r--r--www/js/MontageCtrl.js12
-rw-r--r--www/js/TimelineCtrl.js12
-rw-r--r--www/js/app.js32
-rw-r--r--www/js/controllers.js2
6 files changed, 76 insertions, 12 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 94f231bc..d85c4a5c 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -7,7 +7,7 @@
// that many other controllers use
// It's grown over time. I guess I may have to split this into multiple services in the future
-angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ionicLoading', '$ionicBackdrop', '$fileLogger', 'zm','$rootScope',function ($http, $q, $ionicLoading, $ionicBackdrop,$fileLogger,zm, $rootScope) {
+angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ionicLoading', '$ionicBackdrop', '$fileLogger', 'zm','$rootScope','$ionicContentBanner', '$timeout',function ($http, $q, $ionicLoading, $ionicBackdrop,$fileLogger,zm, $rootScope,$ionicContentBanner, $timeout) {
var zmAppVersion="unknown";
var monitorsLoaded = 0;
@@ -38,6 +38,21 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
{
$fileLogger.log(logtype, val);
}
+
+ function displayBanner (mytype, mytext, myinterval, mytimer)
+ {
+ var contentBannerInstance = $ionicContentBanner.show({
+ text: mytext || 'no text',
+ interval: myinterval || 2000,
+ type: mytype || 'info',
+ transition: 'vertical'
+ });
+
+ $timeout (function() {
+ contentBannerInstance();
+ },mytimer || 6000);
+ }
+
return {
@@ -253,7 +268,12 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
loginData.maxMontage = 1;
}
},
-
+
+
+ displayBanner: function (mytype, mytext, myinterval, mytimer)
+ {
+ displayBanner (mytype, mytext, myinterval, mytimer);
+ },
//-----------------------------------------------------------------------------
// This function returns the numdigits for padding capture images
//-----------------------------------------------------------------------------
@@ -350,6 +370,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
// to imply no monitors could be loaded. FIXME: conver to proper error
monitors = [];
console.log("promise resolved inside HTTP fail");
+ displayBanner ('error', ['error retrieving monitor list', 'please try again']);
d.resolve(monitors);
$ionicLoading.hide();
monitorsLoaded = 0 ;
@@ -421,6 +442,8 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
$ionicLoading.hide();
console.log("*** ERROR GETTING TOTAL PAGES ***");
zmLog ("Error retrieving page count of events " + JSON.stringify(error), "error");
+ displayBanner ('error', ['error retrieving event page count', 'please try again']);
+
d.reject(error);
return d.promise;
});
@@ -493,6 +516,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
})
.error(function (err) {
if (loadingStr != 'none') $ionicLoading.hide();
+ displayBanner ('error', ['error retrieving event list', 'please try again']);
console.log("HTTP Events error " + err);
zmLog("Error fetching events for page " + pageId + " Err: " + JSON.stringify(err), "error");
// I need to reject this as I have infinite scrolling
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index 761bf9ec..562cbc1d 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -366,6 +366,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', {
})
.error(function(err) {
ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err));
+ ZMDataModel.displayBanner ('error', ['could not retrieve frame details', 'please try again']);
});
@@ -803,6 +804,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', {
})
.error(function(err) {
ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err));
+ ZMDataModel.displayBanner ('error', ['could not retrieve frame details', 'please try again']);
});
$scope.totalEventTime = Math.round(parseFloat(edur)) - 1;
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 1620472d..c8490627 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -13,6 +13,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
console.log("******** HAVE ALL MONITORS");
$scope.monitors = message;
+ ZMDataModel.zmLog ("Inside Montage Ctrl:We found " + $scope.monitors.length + " monitors");
document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
@@ -595,7 +596,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
}
else // modal is active
{
- $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
+ // $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
}
@@ -706,9 +707,16 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
// $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
});
-
+ $scope.reloadView = function()
+ {
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ ZMDataModel.zmLog ("User action: image reload " + $rootScope.rand);
+ };
$scope.doRefresh = function () {
+
+
+
console.log("***Pull to Refresh, recomputing Rand");
ZMDataModel.zmLog ("Reloading view for montage view, recomputing rand");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js
index 448a35db..1d1f8e9d 100644
--- a/www/js/TimelineCtrl.js
+++ b/www/js/TimelineCtrl.js
@@ -9,7 +9,7 @@
// I've disabled pan and zoom and used buttons instead
// also limits # of items to maxItems (currently 200)
-angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPlatform', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$rootScope', '$http', '$q', 'message', '$state', '$ionicLoading', '$ionicPopover', '$ionicScrollDelegate', '$ionicModal', '$timeout', function ($ionicPlatform, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $rootScope, $http, $q, message, $state, $ionicLoading, $ionicPopover, $ionicScrollDelegate, $ionicModal, $timeout) {
+angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPlatform', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$rootScope', '$http', '$q', 'message', '$state', '$ionicLoading', '$ionicPopover', '$ionicScrollDelegate', '$ionicModal', '$timeout', '$ionicContentBanner', function ($ionicPlatform, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $rootScope, $http, $q, message, $state, $ionicLoading, $ionicPopover, $ionicScrollDelegate, $ionicModal, $timeout, $ionicContentBanner) {
console.log("Inside Timeline controller");
$scope.openMenu = function () {
@@ -188,6 +188,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
})
.error(function (err) {
ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err));
+ ZMDataModel.displayBanner ('error', ['error retrieving event details', 'please try again']);
});
$scope.totalEventTime = Math.round(parseFloat(edur)) - 1;
@@ -607,7 +608,14 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
}
});
- }); // get Events
+ },
+ function (error) {
+ ZMDataModel.displayBanner ('error', 'Timeline error', 'Please try again');
+
+ }
+
+
+ ); // get Events
});
}
diff --git a/www/js/app.js b/www/js/app.js
index 3d6c7f48..da984cac 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -242,7 +242,7 @@ angular.module('zmApp', [
// This service automatically logs into ZM at periodic intervals
//------------------------------------------------------------------
-.factory('zmAutoLogin', function($interval, ZMDataModel, $http,zm, $browser,$timeout,$q, $rootScope, $ionicLoading, $ionicPopup, $state) {
+.factory('zmAutoLogin', function($interval, ZMDataModel, $http,zm, $browser,$timeout,$q, $rootScope, $ionicLoading, $ionicPopup, $state, $ionicContentBanner) {
var zmAutoLoginHandle;
//------------------------------------------------------------------
@@ -253,7 +253,19 @@ angular.module('zmApp', [
{
console.log ("**** ZM LOGIN ERROR INTERCEPT");
- var alertPopup = $ionicPopup.alert(
+ var contentBannerInstance = $ionicContentBanner.show({
+ text: ['ZoneMinder authentication failed', 'Please check settings'],
+ interval: 2000,
+ type: 'error',
+ transition: 'vertical'
+ });
+
+ $timeout (function() {
+ contentBannerInstance();
+ },6000);
+
+
+ /*var alertPopup = $ionicPopup.alert(
{
title: 'Zoneminder authentication failed',
template: 'This might be a temporary situation and may result in zmNinja not working properly. Please try to log in again.'
@@ -263,7 +275,7 @@ angular.module('zmApp', [
$timeout(function() {
ZMDataModel.zmLog("Hiding auth error dialog box");
alertPopup.close();
- },5000);
+ },5000);*/
@@ -276,6 +288,16 @@ angular.module('zmApp', [
$rootScope.$on ("auth-success", function()
{
+ var contentBannerInstance = $ionicContentBanner.show({
+ text: ['ZoneMinder authentication success'],
+ interval: 2000,
+ type: 'info',
+ transition: 'vertical'
+ });
+
+ $timeout (function() {
+ contentBannerInstance();
+ },2000);
console.log ("**** ZM LOGIN SUCCESS INTERCEPT");
});
@@ -385,8 +407,8 @@ angular.module('zmApp', [
console.log ("**** ZM Login FAILED");
ZMDataModel.zmLog ("zmAutologin Error " + JSON.stringify(error), "error, but not calling auth-error emit");
// FIXME should I really emit here? This usually does not mean bad login
- // that is handled in success
- // $rootScope.$emit('auth-error', error);
+ // that is handled in success. But looks like bad urls etc come here
+ $rootScope.$emit('auth-error', error);
d.reject("Login Error");
return d.promise;
diff --git a/www/js/controllers.js b/www/js/controllers.js
index 416549ee..8ea39044 100644
--- a/www/js/controllers.js
+++ b/www/js/controllers.js
@@ -4,7 +4,7 @@
-angular.module('zmApp.controllers', ['ionic', 'ngCordova', 'ng-mfb','angularCircularNavigation' ])
+angular.module('zmApp.controllers', ['ionic', 'ngCordova', 'ng-mfb','angularCircularNavigation', 'jett.ionic.content.banner' ])
.controller('zmApp.BaseController', function($scope, $ionicSideMenuDelegate, $ionicPlatform, $timeout, $rootScope) {
$scope.openMenu = function () {