@@ -94,6 +94,8 @@ function PagerDutyNotifier()
9494 // This will handle the event triggered from clicking one of the notification's buttons.
9595 self . handlerButtonClicked = function handlerButtonClicked ( notificationId , buttonIndex )
9696 {
97+ if ( notificationId == 'test' ) { return ; } // Ignore for test notifications.
98+
9799 switch ( buttonIndex )
98100 {
99101 case 0 : // Acknowledge
@@ -117,6 +119,7 @@ function PagerDutyNotifier()
117119 // This will handle the event triggered when clicking on the main notification area.
118120 self . handlerNotificationClicked = function handlerNotificationClicked ( notificationId )
119121 {
122+ if ( notificationId == 'test' ) { return ; } // Ignore for test notifications.
120123 window . open ( 'https://' + self . account + '.pagerduty.com/incidents/' + notificationId ) ;
121124 }
122125
@@ -252,7 +255,7 @@ function PagerDutyNotifier()
252255 title : incident . summary ,
253256 message : "Service: " + incident . service . summary ,
254257 contextMessage : incident . urgency . charAt ( 0 ) . toUpperCase ( ) + incident . urgency . slice ( 1 ) + " Urgency" ,
255- priority : 2 ,
258+ priority : 0 ,
256259 isClickable : true ,
257260 buttons : buttons ,
258261 requireInteraction : self . requireInteraction
@@ -335,6 +338,29 @@ chrome.contextMenus.onClicked.addListener(function(info, tab)
335338 }
336339} ) ;
337340
341+ // Add option to trigger a test notification popup.
342+ chrome . contextMenus . create ( {
343+ title : "Show test notification" ,
344+ id : "pd_test_notification" ,
345+ contexts : [ "browser_action" ] ,
346+ visible : true
347+ } ) ;
348+
349+ chrome . contextMenus . onClicked . addListener ( function ( info , tab )
350+ {
351+ if ( info . menuItemId === "pd_test_notification" )
352+ {
353+ _pdNotifier . triggerNotification ( {
354+ 'id' : 'test' ,
355+ 'summary' : 'Test Notification' ,
356+ 'service' : {
357+ 'summary' : 'Test Service'
358+ } ,
359+ 'urgency' : 'high'
360+ } )
361+ }
362+ } ) ;
363+
338364// Listen for Chrome Alarms and retrigger the notifier when one is caught.
339365chrome . alarms . onAlarm . addListener ( function ( alarm )
340366{
0 commit comments