diff options
| -rw-r--r-- | www/js/EventCtrl.js | 42 | ||||
| -rw-r--r-- | www/templates/events.html | 2 |
2 files changed, 41 insertions, 3 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index d50addcf..de8bdbfb 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -7,7 +7,7 @@ // and whether the new API has a better mechanism angular.module('zmApp.controllers') - .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', function ($scope, $rootScope, zm, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover) { + .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup',function ($scope, $rootScope, zm, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup) { // events in last 5 minutes // TODO https://server/zm/api/events/consoleEvents/5%20minute.json @@ -236,6 +236,39 @@ angular.module('zmApp.controllers') $state.go("events", {"id":monitorId}); }; + //------------------------------------------------ + // Tapping on the filter sign lets you reset it + //------------------------------------------------- + + $scope.filterTapped = function() + { + console.log ("FILTER TAPPED"); + + var confirmPopup = $ionicPopup.confirm({ + title: 'Filter settings', + template: 'You are viewing Events between:<br/> ' + $rootScope.fromString + " to " + $rootScope.toString +'<br/>Do you want me to reset this filter?' + }); + confirmPopup.then(function(res) { + if(res) { + ZMDataModel.zmLog("Filter reset requested in popup"); + $rootScope.isEventFilterOn = false; + $rootScope.fromDate = ""; + $rootScope.fromTime= ""; + $rootScope.toDate = ""; + $rootScope.toTime=""; + $rootScope.fromString=""; + $rootScope.toString=""; + $ionicHistory.nextViewOptions({ + disableBack: true + }); + $state.go("events", {"id":0}); + } else { + ZMDataModel.zmLog("Filter reset cancelled in popup"); + } + }); + + }; + $scope.footerExpand = function() { //https://server/zm/api/events/consoleEvents/5%20minute.json @@ -1199,6 +1232,11 @@ angular.module('zmApp.controllers') }; $scope.doRefresh = function () { + doRefresh(); + }; //dorefresh + + function doRefresh() + { console.log("***Pull to Refresh"); $scope.events = []; moreEvents = true; @@ -1255,6 +1293,6 @@ angular.module('zmApp.controllers') }); }); - }; //dorefresh + } }]);
\ No newline at end of file diff --git a/www/templates/events.html b/www/templates/events.html index 722bd8f1..7d96d8cb 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -185,7 +185,7 @@ </ion-infinite-scroll> </div> </ion-content> - <div class="events-float-filter" ng-if="isEventFilterOn">Filter On</div> + <div class="events-float-filter" ng-if="isEventFilterOn" on-tap="filterTapped();">Filter On</div> <ion-pull-up-footer class="bar-energized" on-expand="footerExpand()" on-collapse="footerCollapse()" initial-state="minimized" default-behavior="expand" > |
