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 033fe62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 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,11 +173,13 @@
};

var notificationWatchCallback = function(event, notification) {
if(!notification.showInDrawer) {
var project = notification.namespace || $routeParams.project;
var id = notification.id ? project + "/" + notification.id : _.uniqueId('notification_') + Date.now();

if(!notification.showInDrawer || EventsService.isCleared(id)) {
return;
}
var project = notification.namespace || $routeParams.project;
var id = notification.id || _.uniqueId('notification_') + Date.now();

notificationsMap[project] = notificationsMap[project] || {};
notificationsMap[project][id] = {
actions: notification.actions,
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
12 changes: 5 additions & 7 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,9 +14456,8 @@ l && l(), l = null;
}, $ = function(e) {
g[r.project] = P(R(e.by("metadata.name"))), T();
}, B = function(e, t) {
if (t.showInDrawer) {
var n = t.namespace || r.project, a = t.id || _.uniqueId("notification_") + Date.now();
h[n] = h[n] || {}, h[n][a] = {
var n = t.namespace || r.project, a = t.id ? n + "/" + t.id : _.uniqueId("notification_") + Date.now();
t.showInDrawer && !c.isCleared(a) && (h[n] = h[n] || {}, h[n][a] = {
actions: t.actions,
unread: !c.isRead(a),
trackByID: t.trackByID,
Expand All @@ -14470,8 +14469,7 @@ isHTML: t.isHTML,
details: t.details,
namespace: n,
links: t.links
}, T();
}
}, T());
}, L = function(e, t) {
D(), e && (u = s.watch("events", {
namespace: e
Expand Down

0 comments on commit 033fe62

Please sign in to comment.