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