Skip to content

Commit

Permalink
ZoneMinder#848 fix time filter logic, also make object detection filt…
Browse files Browse the repository at this point in the history
…er selectable in timeline, just like in Events
  • Loading branch information
pliablepixels committed Aug 23, 2019
1 parent f437793 commit 9e8c42b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion www/js/EventsGraphsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni

var dateString = "";
if (hrs) {
dateString = "/StartTime >=:" + startDate + "/EndTime <=:" + endDate;
dateString = "/StartTime <=:" + endDate + "/EndTime >=:" + startDate;
}
var url = loginData.apiurl +
"/events/index/MonitorId:" + monitors[j].Monitor.Id + dateString +
Expand Down
2 changes: 1 addition & 1 deletion www/js/MomentCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ angular.module('zmApp.controllers').controller('zmApp.MomentCtrl', ['$scope', '$
var ld = NVR.getLogin();

// in API, always sort by StartTime so all monitors are represented
var myurl = ld.apiurl + "/events/index/AlarmFrames >=:1" + excludeMonitorsFilter + "/StartTime >=:" + timeFrom + "/StartTime <=:" + timeTo + ".json?sort=" + "StartTime" + "&direction=desc"+$rootScope.authSession;
var myurl = ld.apiurl + "/events/index/AlarmFrames >=:1" + excludeMonitorsFilter + "/StartTime <=:" + timeTo + "/EndTime >=:" + timeFrom + ".json?sort=" + "StartTime" + "&direction=desc"+$rootScope.authSession;
NVR.debug("Retrieving " + myurl);


Expand Down
10 changes: 6 additions & 4 deletions www/js/NVR.js
Original file line number Diff line number Diff line change
Expand Up @@ -3265,9 +3265,9 @@ angular.module('zmApp.controllers')
if (monitorId != 0)
myurl = myurl + "/MonitorId:" + monitorId;
if (startTime)
myurl = myurl + "/StartTime >=:" + startTime;
myurl = myurl + "/StartTime <=:" + endTime;
if (endTime)
myurl = myurl + "/EndTime <=:" + endTime;
myurl = myurl + "/EndTime >=:" + startTime;

myurl = myurl + "/AlarmFrames >=:" + (loginData.enableAlarmCount ? loginData.minAlarmCount : 0);

Expand Down Expand Up @@ -3354,9 +3354,9 @@ angular.module('zmApp.controllers')
if (monitorId != 0)
myurl = myurl + "/MonitorId:" + monitorId;
if (startTime)
myurl = myurl + "/StartTime >=:" + startTime;
myurl = myurl + "/StartTime <=:" + endTime;
if (endTime)
myurl = myurl + "/EndTime <=:" + endTime;
myurl = myurl + "/EndTime >=:" + startTime;

myurl = myurl + "/AlarmFrames >=:" + (loginData.enableAlarmCount ? loginData.minAlarmCount : 0);

Expand All @@ -3374,6 +3374,7 @@ angular.module('zmApp.controllers')


debug("getEvents:" + myurl);
//console.log ("LOG: "+myurl);
// Simulated data

// myurl = "https://api.myjson.com/bins/4jx44.json";
Expand All @@ -3388,6 +3389,7 @@ angular.module('zmApp.controllers')


myevents = data;
console.log (myevents);


d.resolve(myevents);
Expand Down
16 changes: 16 additions & 0 deletions www/js/TimelineCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
notes: ''
};

$scope.lastVideoStateTime = {
'time':''
};
$scope.newEvents = '';


Expand Down Expand Up @@ -664,6 +667,19 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
loginData.followTimeLine = $scope.follow.time;
NVR.setLogin(loginData);
};

$scope.toggleObjectDetectionFilter = function () {

var ld = NVR.getLogin();
ld.objectDetectionFilter = !ld.objectDetectionFilter;
NVR.setLogin(ld);
NVR.debug ("object detection filter: "+ld.objectDetectionFilter);
$scope.loginData = NVR.getLogin();
drawGraph(fromDate, toDate, maxItems);

};


//-------------------------------------------------
// Called with day/week/month
// so we can redraw the graph
Expand Down
4 changes: 4 additions & 0 deletions www/templates/timeline-popover.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
| translate}}</a>
<a class="item" ng-href="" ng-click="popover.hide();toggleMinAlarmFrameCount();" ng-if="!loginData.enableAlarmCount">
{{'kShowAlarmedEvents' | translate}}</a>

<a class="item" ng-href="" ng-click="popover.hide();toggleObjectDetectionFilter();" > <i ng-if="loginData.objectDetectionFilter" class="ion-record" style="color:green;">&nbsp;</i> {{'kShowObjectDetectionEvents'
| translate}}</a>

<a class="item" ng-href="" ng-click="popover.hide();buttonClicked(0);">{{'kMonth' | translate}}</a>
<a class="item" ng-href="" ng-click=" popover.hide();buttonClicked(1);">
{{'kWeek' | translate}}
Expand Down

0 comments on commit 9e8c42b

Please sign in to comment.