From 0e5779874010cd8730ee4f788ff4420f70dd2ad2 Mon Sep 17 00:00:00 2001 From: lucas_nz Date: Sat, 29 Aug 2020 21:29:07 +1200 Subject: when click notification in montage, filter event view to only display events since last notification click --- www/js/MontageCtrl.js | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'www/js/MontageCtrl.js') diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 967decfe..3da303a5 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -592,6 +592,7 @@ angular.module('zmApp.controllers') // now is server TZ time var now = ld.lastEventCheckTimes[monitor.Monitor.Id]; + NVR.debug ("ld.lastEventCheckTimes[id]:" + ld.lastEventCheckTimes[monitor.Monitor.Id]); apiurl += "/StartTime >:" + now; } @@ -615,7 +616,7 @@ angular.module('zmApp.controllers') apiurl += '.json?sort=StartTime&direction=desc&limit=1'+$rootScope.authSession; - NVR.debug ("Getting event count "); + NVR.debug ("Getting event count for monitor.Monitor.Id: " + monitor.Monitor.Id); $http.get(apiurl) .then (function (data) { // console.log ("EVENTS GOT: "+JSON.stringify(data)); @@ -1706,7 +1707,7 @@ angular.module('zmApp.controllers') function onResume() { // we should be going to portal login so no need here - //NVR.debug ("Montage resume called, regenerating all connkeys"); + NVR.debug ("Montage resume called, regenerating all connkeys"); //NVR.regenConnKeys(); // $scope.MontageMonitors = NVR.getMonitorsNow(); @@ -2290,9 +2291,29 @@ angular.module('zmApp.controllers') var stream; var fps = NVR.getLogin().montageliveFPS; + if (!monitor.Monitor.streamingURL) { + NVR.debug("monitor.Monitor.streamingURL: " + monitor.Monitor.streamingURL ); + NVR.debug("monitor.Monitor.MonitorId: " + monitor.Monitor.MonitorId ); + /*for (var key in monitor.Monitor) { + console.log(key + ": " + monitor.Monitor[key]); + } + return; + NVR.log("Reloading view for montage view, recomputing rand"); + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); + $scope.monitors = []; + //imageLoadingDataShare.set(0); + + var refresh = NVR.getMonitors(1); + + refresh.then(function (data) { + $scope.monitors = data; + }); + return;*/ + } if (currentStreamState == streamState.STOPPED || monitor.Monitor.listDisplay == 'noshow' ) { //console.log ("STREAM=empty and auth="+$rootScope.authSession); //sconsole.log ('EMPTY STREAM'); + NVR.log("currentStreamState: " + currentStreamState + ", monitor.Monitor.listDisplay: " + monitor.Monitor.listDisplay); return ""; } @@ -2300,6 +2321,7 @@ angular.module('zmApp.controllers') stream = monitor.Monitor.streamingURL + "/nph-zms?mode=single&scale=10&monitor="+ monitor.Monitor.Id + "&rand=" + randToAvoidCacheMem + monitor.Monitor.Id ; // console.log(stream); + NVR.log("currentStreamState: " + currentStreamState); } else { stream = monitor.Monitor.streamingURL + @@ -2328,6 +2350,7 @@ angular.module('zmApp.controllers') //console.log("STREAM=" + stream); + //NVR.log("STREAM=" + stream); return stream; }; @@ -2611,15 +2634,20 @@ angular.module('zmApp.controllers') var ld = NVR.getLogin(); mid = monitor.Monitor.Id; // always use server tz to avoid confusion + var lastCheckTime = ld.lastEventCheckTimes[mid]; ld.lastEventCheckTimes[mid] = (new moment()).tz(NVR.getTimeZoneNow()).format('YYYY-MM-DD HH:mm:ss'); - NVR.debug ("Updating monitor:"+mid+" event check time (server tz) to " + ld.lastEventCheckTimes[mid] ); + NVR.debug ("Updating monitor:"+mid+" event check time (server tz) to " + lastCheckTime); NVR.setLogin(ld); + if (!monitor.Monitor.lastEvent) { + lastCheckTime = ""; + } monitor.Monitor.lastEvent = undefined; monitor.Monitor.showSidebar = false; if (!showEvents) return; $state.go("app.events", { "id": monitor.Monitor.Id, - "playEvent": false + "playEvent": false, + "lastCheckTime": lastCheckTime }); return; -- cgit v1.2.3