Add a banner to the Quay UI when an app specific token is about to expire

This commit is contained in:
Joseph Schorr 2017-12-12 17:51:54 -05:00
parent 5b4f5f9859
commit 888b564a9b
9 changed files with 60 additions and 9 deletions

View file

@ -9,8 +9,10 @@ angular.module('quay').directive('quayMessageBar', function () {
transclude: false,
restrict: 'C',
scope: {},
controller: function ($scope, $element, ApiService) {
controller: function ($scope, $element, ApiService, NotificationService) {
$scope.messages = [];
$scope.NotificationService = NotificationService;
ApiService.getGlobalMessages().then(function (data) {
$scope.messages = data['messages'] || [];
}, function (resp) {

View file

@ -14,7 +14,8 @@ export class AppSpecificTokenManagerComponent {
private tokenCredentials: any;
private revokeTokenInfo: any;
constructor(@Inject('ApiService') private ApiService: any, @Inject('UserService') private UserService: any) {
constructor(@Inject('ApiService') private ApiService: any, @Inject('UserService') private UserService: any,
@Inject('NotificationService') private NotificationService: any) {
this.loadTokens();
}
@ -49,6 +50,9 @@ export class AppSpecificTokenManagerComponent {
this.ApiService.revokeAppToken(null, params).then((resp) => {
this.loadTokens();
// Update the notification service so it hides any banners if we revoked an expiring token.
this.NotificationService.update();
callback(true);
}, errorHandler);
}