@@ -14582,44 +14582,48 @@ _.remove(t.notifications, {
14582
14582
uid: e.uid,
14583
14583
namespace: e.namespace
14584
14584
});
14585
- }), delete v[r.project][e.uid] ;
14585
+ });
14586
14586
}, P = function(e) {
14587
- return _.map(e, function(e) {
14588
- return {
14587
+ v[r.project] && delete v[r.project][e.uid], g[r.project] && delete g[r.project][e.uid], j(e);
14588
+ }, R = function() {
14589
+ g[r.project] = {}, v[r.project] = {};
14590
+ }, I = function(e) {
14591
+ return _.reduce(e, function(e, t) {
14592
+ return e[t.metadata.uid] = {
14589
14593
actions: null,
14590
- uid: e .metadata.uid,
14591
- trackByID: e .metadata.uid,
14592
- unread: !c.isRead(e .metadata.uid),
14593
- type: e .type,
14594
- lastTimestamp: e .lastTimestamp,
14595
- firstTimestamp: e .firstTimestamp,
14596
- event: e
14597
- };
14598
- });
14599
- }, R = function(e) {
14594
+ uid: t .metadata.uid,
14595
+ trackByID: t .metadata.uid,
14596
+ unread: !c.isRead(t .metadata.uid),
14597
+ type: t .type,
14598
+ lastTimestamp: t .lastTimestamp,
14599
+ firstTimestamp: t .firstTimestamp,
14600
+ event: t
14601
+ }, e ;
14602
+ }, {} );
14603
+ }, E = function(e) {
14600
14604
return _.reduce(e, function(e, t) {
14601
14605
return c.isImportantAPIEvent(t) && !c.isCleared(t.metadata.uid) && (e[t.metadata.uid] = t), e;
14602
14606
}, {});
14603
- }, I = function(e, t) {
14607
+ }, T = function(e, t) {
14604
14608
var n = r.project;
14605
14609
return _.assign({}, e[n], t[n]);
14606
- }, E = function(e) {
14610
+ }, N = function(e) {
14607
14611
return _.orderBy(e, [ "event.lastTimestamp", "event.firstTimestamp" ], [ "desc", "desc" ]);
14608
- }, T = function() {
14612
+ }, D = function() {
14609
14613
o.$evalAsync(function() {
14610
- p.notificationGroups = [ C(r.project, E(I (g, v))) ], k();
14614
+ p.notificationGroups = [ C(r.project, N(T (g, v))) ], k();
14611
14615
});
14612
- }, N = function() {
14616
+ }, A = function() {
14613
14617
_.each(f, function(e) {
14614
14618
e();
14615
14619
}), f = [];
14616
- }, D = function() {
14620
+ }, $ = function() {
14617
14621
u && (s.unwatch(u), u = null);
14618
- }, A = function() {
14622
+ }, B = function() {
14619
14623
l && l(), l = null;
14620
- }, $ = function(e) {
14621
- g[r.project] = P(R (e.by("metadata.name"))), T ();
14622
- }, B = function(e, t) {
14624
+ }, L = function(e) {
14625
+ g[r.project] = I(E (e.by("metadata.name"))), D ();
14626
+ }, U = function(e, t) {
14623
14627
var n = t.namespace || r.project, a = t.id ? n + "/" + t.id : _.uniqueId("notification_") + Date.now();
14624
14628
t.showInDrawer && !c.isCleared(a) && (v[n] = v[n] || {}, v[n][a] = {
14625
14629
actions: t.actions,
@@ -14633,18 +14637,18 @@ isHTML: t.isHTML,
14633
14637
details: t.details,
14634
14638
namespace: n,
14635
14639
links: t.links
14636
- }, T ());
14637
- }, L = function(e, t) {
14638
- D (), e && (u = s.watch("events", {
14640
+ }, D ());
14641
+ }, O = function(e, t) {
14642
+ $ (), e && (u = s.watch("events", {
14639
14643
namespace: e
14640
14644
}, _.debounce(t, 400), {
14641
14645
skipDigest: !0
14642
14646
}));
14643
- }, U = _.once(function(e, t) {
14644
- A (), l = o.$on("NotificationsService.onNotificationAdded", t);
14645
- }), O = function() {
14647
+ }, F = _.once(function(e, t) {
14648
+ B (), l = o.$on("NotificationsService.onNotificationAdded", t);
14649
+ }), x = function() {
14646
14650
S(r.project).then(function() {
14647
- L (r.project, $ ), U (r.project, B ), y(r.project), T ();
14651
+ O (r.project, L ), F (r.project, U ), y(r.project), D ();
14648
14652
});
14649
14653
};
14650
14654
angular.extend(p, {
@@ -14661,22 +14665,22 @@ p.drawerHidden = !0;
14661
14665
onMarkAllRead: function(e) {
14662
14666
_.each(e.notifications, function(e) {
14663
14667
e.unread = !1, c.markRead(e.uid);
14664
- }), T (), o.$emit("NotificationDrawerWrapper.onMarkAllRead");
14668
+ }), D (), o.$emit("NotificationDrawerWrapper.onMarkAllRead");
14665
14669
},
14666
14670
onClearAll: function(e) {
14667
14671
_.each(e.notifications, function(e) {
14668
14672
e.unread = !1, c.markRead(e.uid), c.markCleared(e.uid);
14669
- }), g[r.project] = {}, v[r.project] = {}, T (), o.$emit("NotificationDrawerWrapper.onMarkAllRead");
14673
+ }), R(), D (), o.$emit("NotificationDrawerWrapper.onMarkAllRead");
14670
14674
},
14671
14675
notificationGroups: [],
14672
14676
headingInclude: "views/directives/notifications/header.html",
14673
14677
notificationBodyInclude: "views/directives/notifications/notification-body.html",
14674
14678
customScope: {
14675
14679
clear: function(e, t, n) {
14676
- c.markCleared(e.uid), n.notifications.splice(t, 1), k ();
14680
+ c.markRead(e.uid), c. markCleared(e.uid), n.notifications.splice(t, 1), P(e), D ();
14677
14681
},
14678
14682
markRead: function(e) {
14679
- e.unread = !1, c.markRead(e.uid), k ();
14683
+ e.unread = !1, c.markRead(e.uid), D ();
14680
14684
},
14681
14685
close: function() {
14682
14686
p.drawerHidden = !0;
@@ -14687,21 +14691,21 @@ e.onClick(), p.drawerHidden = !0;
14687
14691
countUnreadNotifications: k
14688
14692
}
14689
14693
});
14690
- var F = function() {
14691
- r.project && O (), f.push(o.$on("$routeChangeSuccess", function(e, t, n) {
14692
- b(t, n) && (p.customScope.projectName = r.project, O ());
14694
+ var V = function() {
14695
+ r.project && x (), f.push(o.$on("$routeChangeSuccess", function(e, t, n) {
14696
+ b(t, n) && (p.customScope.projectName = r.project, x ());
14693
14697
})), f.push(o.$on("NotificationDrawerWrapper.toggle", function() {
14694
14698
p.drawerHidden = !p.drawerHidden;
14695
14699
})), f.push(o.$on("NotificationDrawerWrapper.hide", function() {
14696
14700
p.drawerHidden = !0;
14697
14701
})), f.push(o.$on("NotificationDrawerWrapper.clear", function(e, t) {
14698
- c.markCleared(t.uid), j (t), p.countUnreadNotifications();
14702
+ c.markCleared(t.uid), P (t), p.countUnreadNotifications();
14699
14703
}));
14700
14704
};
14701
14705
p.$onInit = function() {
14702
- d || m || F ();
14706
+ d || m || V ();
14703
14707
}, p.$onDestroy = function() {
14704
- A (), D (), N ();
14708
+ B (), $ (), A ();
14705
14709
};
14706
14710
} ]
14707
14711
});
0 commit comments