Skip to content

Commit

Permalink
Merge pull request #170 from benjaminapetersen/bpeterse/notification-…
Browse files Browse the repository at this point in the history
…update

Update notifications with id and timestamp
  • Loading branch information
spadgett authored Sep 6, 2017
2 parents 722e481 + 284898a commit d5ae6b4
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
16 changes: 14 additions & 2 deletions dist/origin-web-common-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -1260,6 +1262,9 @@ angular.module('openshiftCommonUI')
case 'success':
status = 'alert-success';
break;
case 'normal':
status = 'alert-info';
break;
default:
status = 'alert-info';
}
Expand All @@ -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;
Expand All @@ -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';
}
Expand Down Expand Up @@ -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;
}
Expand Down
16 changes: 14 additions & 2 deletions dist/origin-web-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -1431,6 +1433,9 @@ angular.module('openshiftCommonUI')
case 'success':
status = 'alert-success';
break;
case 'normal':
status = 'alert-info';
break;
default:
status = 'alert-info';
}
Expand All @@ -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;
Expand All @@ -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';
}
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 11 additions & 3 deletions dist/origin-web-common.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -501,6 +501,10 @@ case "success":
status = "alert-success";
break;

case "normal":
status = "alert-info";
break;

default:
status = "alert-info";
}
Expand All @@ -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;
Expand All @@ -522,6 +526,10 @@ case "success":
icon = "pficon pficon-ok";
break;

case "normal":
icon = "pficon pficon-info";
break;

default:
icon = "pficon pficon-info";
}
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 12 additions & 2 deletions src/filters/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,6 +17,9 @@ angular.module('openshiftCommonUI')
case 'success':
status = 'alert-success';
break;
case 'normal':
status = 'alert-info';
break;
default:
status = 'alert-info';
}
Expand All @@ -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;
Expand All @@ -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';
}
Expand Down
2 changes: 2 additions & 0 deletions src/ui-services/notificationsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d5ae6b4

Please sign in to comment.