Skip to content

Commit ac16065

Browse files
cleanup
1 parent a4869a0 commit ac16065

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Diff for: app/scripts/directives/notifications/notificationDrawerWrapper.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ angular
3838
var notificationListener;
3939

4040
var eventsWatcher;
41-
// TODO: decide if we cache these or no
42-
var eventsFromWatch = [];
43-
// TODO: decide if we cache these or no
4441
var eventsFromNotifications = [];
4542

4643
// TODO:
@@ -96,7 +93,7 @@ angular
9693
return _.filter(notifications, 'unread');
9794
};
9895

99-
// returns a count for each type of notification:
96+
// returns a count for each type of notification, example:
10097
// {Normal: 1, Warning: 5}
10198
var countUnreadNotificationsForGroup = function(group) {
10299
return _.countBy(unread(group.notifications), function(notification) {
@@ -159,26 +156,27 @@ angular
159156
return filtered;
160157
};
161158

162-
// notificationGroups[projectName]
163159
var eventWatchCallback = function(eventData) {
164160
var eventsByName = eventData.by('metadata.name');
165161

166162
notificationGroupsMap = formatFilteredEvents(eventsByName);
167163
notificationGroups = sortNotificationGroups(notificationGroupsMap);
168164

169165
$rootScope.$apply(function () {
170-
// if we go back to multiple projects, we can eliminate the filter here
171-
// and just pass the whole array.
166+
// NOTE: we are currently only showing one project in the drawer at a
167+
// time. If we go back to multiple projects, we can eliminate the filter here
168+
// and just pass the whole array as notificationGroups.
172169
// if we do, we will have to handle group.open to keep track of what the
173-
// user is viewing at the time.
170+
// user is viewing at the time & indicate to the user that the non-active
171+
// project is "asleep"/not being watched.
174172
drawer.notificationGroups = _.filter(notificationGroups, function(group) {
175173
return group.project.metadata.name === $routeParams.project;
176174
});
177175
});
178176
};
179177

178+
// TODO: atm these are not being added to the notificationGroups
180179
var notificationWatchCallback = function(event, notification) {
181-
// TODO: decide how to work these in....
182180
if(!notification.lastTimestamp) {
183181
notification.lastTimestamp = new Date();
184182
}
@@ -204,7 +202,6 @@ angular
204202
ok: 'pficon pficon-ok'
205203
};
206204

207-
// there are only 2 statuses, surprisingly
208205
var statuses = {
209206
Normal: statusClasses.info,
210207
Warning: statusClasses.warning
@@ -274,7 +271,7 @@ angular
274271
reset();
275272
}));
276273

277-
// event from other nodes (counter) to signal the drawer to open/close
274+
// event from the counter to signal the drawer to open/close
278275
rootScopeWatches.push($rootScope.$on('notification-drawer:show', function(evt, data) {
279276
drawer.drawerHidden = data.drawerHidden;
280277
}));

0 commit comments

Comments
 (0)