Skip to content

Commit

Permalink
Correctly hide/show quota notifications per project
Browse files Browse the repository at this point in the history
  • Loading branch information
dtaylor113 committed Oct 6, 2017
1 parent b642a34 commit 03a113e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
_.each(drawer.notificationGroups, function(group) {
_.remove(group.notifications, { uid: notification.uid, namespace: notification.namespace });
});
delete notificationsMap[$routeParams.project][notification.uid];
};

var formatAPIEvents = function(apiEvents) {
Expand Down Expand Up @@ -172,7 +173,7 @@
};

var notificationWatchCallback = function(event, notification) {
if(!notification.showInDrawer) {
if(!notification.showInDrawer || EventsService.isCleared(notification.id)) {
return;
}
var project = notification.namespace || $routeParams.project;
Expand All @@ -184,7 +185,7 @@
// using uid to match API events and have one filed to pass
// to EventsService for read/cleared, etc
trackByID: notification.trackByID,
uid: id,
uid: project + "/" + id,
type: notification.type,
// API events have both lastTimestamp & firstTimestamp,
// but we sort based on lastTimestamp first.
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/services/quota.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ angular.module("openshiftConsole")

if(hardValue <= usedValue) {
notifications.push({
id: "quota-limit-reached-" + quotaKey,
id: projectName + "/quota-limit-reached-" + quotaKey,
namespace: projectName,
type: (hardValue < usedValue ? 'warning' : 'info'),
message: getNotificaitonMessage(used, usedValue, hard, hardValue, quotaKey),
Expand Down
8 changes: 4 additions & 4 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3598,7 +3598,7 @@ var t = e.status.total || e.status;
_.each(t.hard, function(e, s) {
var c = m(e), l = _.get(t, [ "used", s ]), d = m(l);
"resourcequotas" !== s && c && d && c <= d && i.push({
id: "quota-limit-reached-" + s,
id: o + "/quota-limit-reached-" + s,
namespace: o,
type: c < d ? "warning" : "info",
message: I(0, d, e, c, s),
Expand Down Expand Up @@ -14418,7 +14418,7 @@ _.remove(t.notifications, {
uid: e.uid,
namespace: e.namespace
});
});
}), delete h[r.project][e.uid];
}, P = function(e) {
return _.map(e, function(e) {
return {
Expand Down Expand Up @@ -14456,13 +14456,13 @@ l && l(), l = null;
}, $ = function(e) {
g[r.project] = P(R(e.by("metadata.name"))), T();
}, B = function(e, t) {
if (t.showInDrawer) {
if (t.showInDrawer && !c.isCleared(t.id)) {
var n = t.namespace || r.project, a = t.id || _.uniqueId("notification_") + Date.now();
h[n] = h[n] || {}, h[n][a] = {
actions: t.actions,
unread: !c.isRead(a),
trackByID: t.trackByID,
uid: a,
uid: n + "/" + a,
type: t.type,
lastTimestamp: t.timestamp,
message: t.message,
Expand Down

0 comments on commit 03a113e

Please sign in to comment.