Redo user admin page to match the style of the org admin page
This commit is contained in:
parent
dba806fd97
commit
10db2884ac
7 changed files with 91 additions and 176 deletions
|
@ -557,12 +557,13 @@ quayApp.directive('planManager', function () {
|
|||
$scope.planUsagePercent = sub.usedPrivateRepos * 100 / $scope.subscribedPlan.privateRepos;
|
||||
|
||||
if (sub.usedPrivateRepos > $scope.subscribedPlan.privateRepos) {
|
||||
$scope.overLimit = true;
|
||||
$scope.limit = 'over';
|
||||
} else if (sub.usedPrivateRepos == $scope.subscribedPlan.privateRepos) {
|
||||
$scope.limit = 'at';
|
||||
} else if (sub.usedPrivateRepos >= $scope.subscribedPlan.privateRepos * 0.7) {
|
||||
$scope.nearLimit = true;
|
||||
$scope.limit = 'near';
|
||||
} else {
|
||||
$scope.overLimit = false;
|
||||
$scope.nearLimit = false;
|
||||
$scope.limit = 'none';
|
||||
}
|
||||
|
||||
if (!$scope.chart) {
|
||||
|
@ -588,9 +589,7 @@ quayApp.directive('planManager', function () {
|
|||
|
||||
var update = function() {
|
||||
$scope.planLoading = true;
|
||||
|
||||
if (!$scope.plans) { return; }
|
||||
if (!$scope.user && !$scope.organization) { return; }
|
||||
|
||||
PlanService.getSubscription($scope.organization, subscribedToPlan, function() {
|
||||
// User/Organization has no subscription.
|
||||
|
@ -599,6 +598,7 @@ quayApp.directive('planManager', function () {
|
|||
};
|
||||
|
||||
var loadPlans = function() {
|
||||
if (!$scope.user && !$scope.organization) { return; }
|
||||
PlanService.getPlans(function(plans) {
|
||||
$scope.plans = plans[$scope.organization ? 'business' : 'user'];
|
||||
update();
|
||||
|
@ -606,15 +606,15 @@ quayApp.directive('planManager', function () {
|
|||
};
|
||||
|
||||
// Start the initial download.
|
||||
loadPlans();
|
||||
update();
|
||||
$scope.planLoading = true;
|
||||
loadPlans();
|
||||
|
||||
$scope.$watch('organization', function() {
|
||||
update();
|
||||
loadPlans();
|
||||
});
|
||||
|
||||
$scope.$watch('user', function() {
|
||||
update();
|
||||
loadPlans();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Reference in a new issue