@@ -38,9 +38,6 @@ angular
38
38
var notificationListener ;
39
39
40
40
var eventsWatcher ;
41
- // TODO: decide if we cache these or no
42
- var eventsFromWatch = [ ] ;
43
- // TODO: decide if we cache these or no
44
41
var eventsFromNotifications = [ ] ;
45
42
46
43
// TODO:
@@ -96,7 +93,7 @@ angular
96
93
return _ . filter ( notifications , 'unread' ) ;
97
94
} ;
98
95
99
- // returns a count for each type of notification:
96
+ // returns a count for each type of notification, example :
100
97
// {Normal: 1, Warning: 5}
101
98
var countUnreadNotificationsForGroup = function ( group ) {
102
99
return _ . countBy ( unread ( group . notifications ) , function ( notification ) {
@@ -159,26 +156,27 @@ angular
159
156
return filtered ;
160
157
} ;
161
158
162
- // notificationGroups[projectName]
163
159
var eventWatchCallback = function ( eventData ) {
164
160
var eventsByName = eventData . by ( 'metadata.name' ) ;
165
161
166
162
notificationGroupsMap = formatFilteredEvents ( eventsByName ) ;
167
163
notificationGroups = sortNotificationGroups ( notificationGroupsMap ) ;
168
164
169
165
$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.
172
169
// 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.
174
172
drawer . notificationGroups = _ . filter ( notificationGroups , function ( group ) {
175
173
return group . project . metadata . name === $routeParams . project ;
176
174
} ) ;
177
175
} ) ;
178
176
} ;
179
177
178
+ // TODO: atm these are not being added to the notificationGroups
180
179
var notificationWatchCallback = function ( event , notification ) {
181
- // TODO: decide how to work these in....
182
180
if ( ! notification . lastTimestamp ) {
183
181
notification . lastTimestamp = new Date ( ) ;
184
182
}
@@ -204,7 +202,6 @@ angular
204
202
ok : 'pficon pficon-ok'
205
203
} ;
206
204
207
- // there are only 2 statuses, surprisingly
208
205
var statuses = {
209
206
Normal : statusClasses . info ,
210
207
Warning : statusClasses . warning
@@ -274,7 +271,7 @@ angular
274
271
reset ( ) ;
275
272
} ) ) ;
276
273
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
278
275
rootScopeWatches . push ( $rootScope . $on ( 'notification-drawer:show' , function ( evt , data ) {
279
276
drawer . drawerHidden = data . drawerHidden ;
280
277
} ) ) ;
0 commit comments