From 4e5e7d28a94106dab8ecf8ff08acfdf5589fe4c6 Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Thu, 12 Nov 2015 17:02:18 -0500 Subject: #82 - initial commits towards showing monitor specific alarm notitications in montage Former-commit-id: 278d0c8fb24ef38e607caf66f1f6279b2e36f70b --- www/js/EventServer.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'www/js/EventServer.js') diff --git a/www/js/EventServer.js b/www/js/EventServer.js index 8b43fa1d..a9b44a8f 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -83,10 +83,6 @@ angular.module('zmApp.controllers') - - - - //-------------------------------------------------------------------------- // Called once at app start. Does a lazy definition of websockets open //-------------------------------------------------------------------------- @@ -171,6 +167,8 @@ angular.module('zmApp.controllers') if (str.status == 'Success' && str.event == 'alarm') // new events { + + new Audio('sounds/blop.mp3').play(); var localNotText = "Latest Alarms: "; $rootScope.isAlarm = 1; @@ -186,10 +184,12 @@ angular.module('zmApp.controllers') var eventsToDisplay = []; + var listOfMonitors=[]; for (var iter = 0; iter < str.events.length; iter++) { // lets stack the display so they don't overwrite eventsToDisplay.push(str.events[iter].Name + ": latest new alarm (" + str.events[iter].EventId + ")"); localNotText = localNotText + str.events[iter].Name + ","; + listOfMonitors.push(str.events[iter].MonitorId); } @@ -197,6 +197,9 @@ angular.module('zmApp.controllers') // if we are in background, do a local notification, else do an in app display if (!ZMDataModel.isBackground()) { + + //emit alarm details - this is when received over websockets + $rootScope.$emit('alarm',{message:listOfMonitors}); ZMDataModel.zmDebug("App is in foreground, displaying banner"); if (eventsToDisplay.length > 0) { -- cgit v1.2.3