Commit d5ae6b45 by Sam Padgett Committed by GitHub

Merge pull request #170 from benjaminapetersen/bpeterse/notification-update

Update notifications with id and timestamp
parents 722e481c 284898a5
......@@ -1250,7 +1250,9 @@ angular.module('openshiftCommonUI')
return function (type) {
var status;
switch(type) {
// API events have just two types: Normal, Warning
// our notifications have four: info, success, error, and warning
switch(type.toLowerCase()) {
case 'error':
status = 'alert-danger';
break;
......@@ -1260,6 +1262,9 @@ angular.module('openshiftCommonUI')
case 'success':
status = 'alert-success';
break;
case 'normal':
status = 'alert-info';
break;
default:
status = 'alert-info';
}
......@@ -1271,7 +1276,9 @@ angular.module('openshiftCommonUI')
return function (type) {
var icon;
switch(type) {
// API events have just two types: Normal, Warning
// our notifications have four: info, success, error, and warning
switch(type.toLowerCase()) {
case 'error':
icon = 'pficon pficon-error-circle-o';
break;
......@@ -1281,6 +1288,9 @@ angular.module('openshiftCommonUI')
case 'success':
icon = 'pficon pficon-ok';
break;
case 'normal':
icon = 'pficon pficon-info';
break;
default:
icon = 'pficon pficon-info';
}
......@@ -2139,6 +2149,8 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
};
var addNotification = function (notification) {
notification.id = notification.id || _.uniqueId('notification-');
notification.timestamp = new Date().toISOString();
if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) {
return;
}
......
......@@ -1421,7 +1421,9 @@ angular.module('openshiftCommonUI')
return function (type) {
var status;
switch(type) {
// API events have just two types: Normal, Warning
// our notifications have four: info, success, error, and warning
switch(type.toLowerCase()) {
case 'error':
status = 'alert-danger';
break;
......@@ -1431,6 +1433,9 @@ angular.module('openshiftCommonUI')
case 'success':
status = 'alert-success';
break;
case 'normal':
status = 'alert-info';
break;
default:
status = 'alert-info';
}
......@@ -1442,7 +1447,9 @@ angular.module('openshiftCommonUI')
return function (type) {
var icon;
switch(type) {
// API events have just two types: Normal, Warning
// our notifications have four: info, success, error, and warning
switch(type.toLowerCase()) {
case 'error':
icon = 'pficon pficon-error-circle-o';
break;
......@@ -1452,6 +1459,9 @@ angular.module('openshiftCommonUI')
case 'success':
icon = 'pficon pficon-ok';
break;
case 'normal':
icon = 'pficon pficon-info';
break;
default:
icon = 'pficon pficon-info';
}
......@@ -5660,6 +5670,8 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
};
var addNotification = function (notification) {
notification.id = notification.id || _.uniqueId('notification-');
notification.timestamp = new Date().toISOString();
if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) {
return;
}
......
......@@ -488,7 +488,7 @@ content ? (scope.truncatedContent = truncateFilter(content, scope.limit, scope.u
} ]), angular.module("openshiftCommonUI").filter("alertStatus", function() {
return function(type) {
var status;
switch (type) {
switch (type.toLowerCase()) {
case "error":
status = "alert-danger";
break;
......@@ -501,6 +501,10 @@ case "success":
status = "alert-success";
break;
case "normal":
status = "alert-info";
break;
default:
status = "alert-info";
}
......@@ -509,7 +513,7 @@ return status;
}).filter("alertIcon", function() {
return function(type) {
var icon;
switch (type) {
switch (type.toLowerCase()) {
case "error":
icon = "pficon pficon-error-circle-o";
break;
......@@ -522,6 +526,10 @@ case "success":
icon = "pficon pficon-ok";
break;
case "normal":
icon = "pficon pficon-info";
break;
default:
icon = "pficon pficon-info";
}
......@@ -2378,7 +2386,7 @@ this.dismissDelay = 8e3, this.autoDismissTypes = [ "info", "success" ], this.$ge
var notifications = [], dismissDelay = this.dismissDelay, autoDismissTypes = this.autoDismissTypes, notificationHiddenKey = function(notificationID, namespace) {
return namespace ? "hide/notification/" + namespace + "/" + notificationID :"hide/notification/" + notificationID;
}, addNotification = function(notification) {
isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification) || (notifications.push(notification), $rootScope.$emit("NotificationsService.onNotificationAdded", notification));
notification.id = notification.id || _.uniqueId("notification-"), notification.timestamp = new Date().toISOString(), isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification) || (notifications.push(notification), $rootScope.$emit("NotificationsService.onNotificationAdded", notification));
}, hideNotification = function(notificationID) {
notificationID && _.each(notifications, function(notification) {
notification.id === notificationID && (notification.hidden = !0);
......
......@@ -5,7 +5,9 @@ angular.module('openshiftCommonUI')
return function (type) {
var status;
switch(type) {
// API events have just two types: Normal, Warning
// our notifications have four: info, success, error, and warning
switch(type.toLowerCase()) {
case 'error':
status = 'alert-danger';
break;
......@@ -15,6 +17,9 @@ angular.module('openshiftCommonUI')
case 'success':
status = 'alert-success';
break;
case 'normal':
status = 'alert-info';
break;
default:
status = 'alert-info';
}
......@@ -26,7 +31,9 @@ angular.module('openshiftCommonUI')
return function (type) {
var icon;
switch(type) {
// API events have just two types: Normal, Warning
// our notifications have four: info, success, error, and warning
switch(type.toLowerCase()) {
case 'error':
icon = 'pficon pficon-error-circle-o';
break;
......@@ -36,6 +43,9 @@ angular.module('openshiftCommonUI')
case 'success':
icon = 'pficon pficon-ok';
break;
case 'normal':
icon = 'pficon pficon-info';
break;
default:
icon = 'pficon pficon-info';
}
......
......@@ -18,6 +18,8 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
};
var addNotification = function (notification) {
notification.id = notification.id || _.uniqueId('notification-');
notification.timestamp = new Date().toISOString();
if (isNotificationPermanentlyHidden(notification) || isNotificationVisible(notification)) {
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment