Merge pull request #2984 from coreos-inc/fix-api-error
Fix NPE when app specific tokens are not enabled
This commit is contained in:
commit
4e4faeb9ed
1 changed files with 10 additions and 9 deletions
|
@ -3,9 +3,9 @@
|
||||||
* in the sidebar) and provides helper methods for working with them.
|
* in the sidebar) and provides helper methods for working with them.
|
||||||
*/
|
*/
|
||||||
angular.module('quay').factory('NotificationService',
|
angular.module('quay').factory('NotificationService',
|
||||||
['$rootScope', '$interval', 'UserService', 'ApiService', 'StringBuilderService', 'PlanService', 'UserService', 'Config', '$location', 'VulnerabilityService',
|
['$rootScope', '$interval', 'UserService', 'ApiService', 'StringBuilderService', 'PlanService', 'UserService', 'Features', 'Config', '$location', 'VulnerabilityService',
|
||||||
|
|
||||||
function($rootScope, $interval, UserService, ApiService, StringBuilderService, PlanService, UserService, Config, $location, VulnerabilityService) {
|
function($rootScope, $interval, UserService, ApiService, StringBuilderService, PlanService, UserService, Features, Config, $location, VulnerabilityService) {
|
||||||
var notificationService = {
|
var notificationService = {
|
||||||
'user': null,
|
'user': null,
|
||||||
'notifications': [],
|
'notifications': [],
|
||||||
|
@ -274,14 +274,15 @@ function($rootScope, $interval, UserService, ApiService, StringBuilderService, P
|
||||||
notificationService.notificationClasses = notificationService.getClasses(notificationService.notifications);
|
notificationService.notificationClasses = notificationService.getClasses(notificationService.notifications);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Features.APP_SPECIFIC_TOKENS) {
|
||||||
var params = {
|
var params = {
|
||||||
'expiring': true
|
'expiring': true
|
||||||
};
|
};
|
||||||
ApiService.listAppTokens(null, params).then(function(resp) {
|
ApiService.listAppTokens(null, params).then(function(resp) {
|
||||||
notificationService.expiringAppTokens = resp['tokens'];
|
notificationService.expiringAppTokens = resp['tokens'];
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
notificationService.reset = function() {
|
notificationService.reset = function() {
|
||||||
$interval.cancel(pollTimerHandle);
|
$interval.cancel(pollTimerHandle);
|
||||||
pollTimerHandle = $interval(notificationService.update, 5 * 60 * 1000 /* five minutes */);
|
pollTimerHandle = $interval(notificationService.update, 5 * 60 * 1000 /* five minutes */);
|
||||||
|
|
Reference in a new issue