Added highest severity calculation in NotifiationService

This commit is contained in:
Henry 2015-10-13 11:14:28 -07:00
parent c0ff6de27b
commit 11264759ec
2 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,5 @@
<span ng-show="notifications.length > 0" class="status block caution" ng-controller="NotificationIndicatorController">
<span ng-show="notifications.length > 0" class="status block caution"
ng-controller="NotificationIndicatorController">
<span class="ui-symbol status-indicator">&#x21;</span>
<span class="label">
<a ng-click="showNotificationsList()">{{notifications.length}} Notifications</a>

View File

@ -87,6 +87,7 @@ define(
function NotificationService($timeout, DEFAULT_AUTO_DISMISS, FORCE_AUTO_DISMISS) {
this.notifications = [];
this.$timeout = $timeout;
this.highest ={ severity: MessageSeverity.INFO };
this.DEFAULT_AUTO_DISMISS = DEFAULT_AUTO_DISMISS;
this.FORCE_AUTO_DISMISS = FORCE_AUTO_DISMISS;
@ -198,12 +199,18 @@ define(
NotificationService.prototype.selectNextNotification = function () {
var notification,
i=0;
this.highest.severity = MessageSeverity.INFO;
/*
Loop through the notifications queue and find the first one self
has not already been minimized (manually or otherwise).
*/
for (; i< this.notifications.length; i++) {
notification = this.notifications[i];
if (notification.severity > this.highest.severity){
this.highest.severity = notification.severity;
}
if (!notification.minimized
&& notification!== this.active.notification) {