- Add API for returning the user’s used private repos and available private repos
- Fix the same API for orgs - Change the chosen plan in the create repo view to use the API - Add an account indicator if the user is over their plan
This commit is contained in:
parent
95a8915546
commit
ed82d65dd1
5 changed files with 74 additions and 14 deletions
|
@ -1493,10 +1493,26 @@ quayApp.directive('headerBar', function () {
|
|||
restrict: 'C',
|
||||
scope: {
|
||||
},
|
||||
controller: function($scope, $element, $location, UserService, Restangular) {
|
||||
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
|
||||
$scope.user = currentUser;
|
||||
}, true);
|
||||
controller: function($scope, $element, $location, UserService, PlanService, Restangular) {
|
||||
$scope.overPlan = false;
|
||||
|
||||
var checkOverPlan = function() {
|
||||
if ($scope.user.anonymous) {
|
||||
$scope.overPlan = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var checkPrivate = Restangular.one('user/private');
|
||||
checkPrivate.customGET().then(function(resp) {
|
||||
$scope.overPlan = resp.privateCount >= resp.reposAllowed;
|
||||
});
|
||||
};
|
||||
|
||||
// Monitor any user changes and place the current user into the scope.
|
||||
UserService.updateUserIn($scope, checkOverPlan);
|
||||
|
||||
// Monitor any plan changes.
|
||||
PlanService.registerListener(this, checkOverPlan);
|
||||
|
||||
$scope.signout = function() {
|
||||
var signoutPost = Restangular.one('signout');
|
||||
|
@ -1511,7 +1527,7 @@ quayApp.directive('headerBar', function () {
|
|||
return "_self";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
|
|
Reference in a new issue