Skip to content

Commit 03a113e

Browse files
committed
Correctly hide/show quota notifications per project
1 parent b642a34 commit 03a113e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

app/scripts/directives/notifications/notificationDrawerWrapper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
_.each(drawer.notificationGroups, function(group) {
100100
_.remove(group.notifications, { uid: notification.uid, namespace: notification.namespace });
101101
});
102+
delete notificationsMap[$routeParams.project][notification.uid];
102103
};
103104

104105
var formatAPIEvents = function(apiEvents) {
@@ -172,7 +173,7 @@
172173
};
173174

174175
var notificationWatchCallback = function(event, notification) {
175-
if(!notification.showInDrawer) {
176+
if(!notification.showInDrawer || EventsService.isCleared(notification.id)) {
176177
return;
177178
}
178179
var project = notification.namespace || $routeParams.project;
@@ -184,7 +185,7 @@
184185
// using uid to match API events and have one filed to pass
185186
// to EventsService for read/cleared, etc
186187
trackByID: notification.trackByID,
187-
uid: id,
188+
uid: project + "/" + id,
188189
type: notification.type,
189190
// API events have both lastTimestamp & firstTimestamp,
190191
// but we sort based on lastTimestamp first.

app/scripts/services/quota.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ angular.module("openshiftConsole")
317317

318318
if(hardValue <= usedValue) {
319319
notifications.push({
320-
id: "quota-limit-reached-" + quotaKey,
320+
id: projectName + "/quota-limit-reached-" + quotaKey,
321321
namespace: projectName,
322322
type: (hardValue < usedValue ? 'warning' : 'info'),
323323
message: getNotificaitonMessage(used, usedValue, hard, hardValue, quotaKey),

dist/scripts/scripts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,7 +3598,7 @@ var t = e.status.total || e.status;
35983598
_.each(t.hard, function(e, s) {
35993599
var c = m(e), l = _.get(t, [ "used", s ]), d = m(l);
36003600
"resourcequotas" !== s && c && d && c <= d && i.push({
3601-
id: "quota-limit-reached-" + s,
3601+
id: o + "/quota-limit-reached-" + s,
36023602
namespace: o,
36033603
type: c < d ? "warning" : "info",
36043604
message: I(0, d, e, c, s),
@@ -14418,7 +14418,7 @@ _.remove(t.notifications, {
1441814418
uid: e.uid,
1441914419
namespace: e.namespace
1442014420
});
14421-
});
14421+
}), delete h[r.project][e.uid];
1442214422
}, P = function(e) {
1442314423
return _.map(e, function(e) {
1442414424
return {
@@ -14456,13 +14456,13 @@ l && l(), l = null;
1445614456
}, $ = function(e) {
1445714457
g[r.project] = P(R(e.by("metadata.name"))), T();
1445814458
}, B = function(e, t) {
14459-
if (t.showInDrawer) {
14459+
if (t.showInDrawer && !c.isCleared(t.id)) {
1446014460
var n = t.namespace || r.project, a = t.id || _.uniqueId("notification_") + Date.now();
1446114461
h[n] = h[n] || {}, h[n][a] = {
1446214462
actions: t.actions,
1446314463
unread: !c.isRead(a),
1446414464
trackByID: t.trackByID,
14465-
uid: a,
14465+
uid: n + "/" + a,
1446614466
type: t.type,
1446714467
lastTimestamp: t.timestamp,
1446814468
message: t.message,

0 commit comments

Comments
 (0)