diff --git a/static/css/quay.css b/static/css/quay.css index 9bb9435a0..c51a6c320 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -1369,22 +1369,30 @@ p.editable:hover i { font-size: 22px; } -#repository-usage-chart path.warning-0 { +#repository-usage-chart.limit-at path.arc-0 { fill: #c09853; } -#repository-usage-chart path.error-0 { +#repository-usage-chart.limit-over path.arc-0 { fill: #b94a48; } -#repository-usage-chart path.warning-1 { +#repository-usage-chart.limit-near path.arc-0 { + fill: #468847; +} + +#repository-usage-chart.limit-over path.arc-1 { fill: #fcf8e3; } -#repository-usage-chart path.error-1 { +#repository-usage-chart.limit-at path.arc-1 { fill: #f2dede; } +#repository-usage-chart.limit-near path.arc-1 { + fill: #dff0d8; +} + .plan-manager-element .usage-caption { display: inline-block; color: #aaa; @@ -1525,22 +1533,22 @@ p.editable:hover i { padding: 6px; } -.org-admin .plans-table thead td { +.plan-manager-element .plans-table thead td { color: #aaa; font-weight: bold; } -.org-admin .plans-table td { +.plan-manager-element .plans-table td { padding: 10px; font-size: 16px; vertical-align: middle; } -.org-admin .plans-table td.controls { +.plan-manager-element .plans-table td.controls { text-align: right; } -.org-admin .plans-table .plan-price { +.plan-manager-element .plans-table .plan-price { font-size: 16px; margin-bottom: 0px; } diff --git a/static/directives/plan-manager.html b/static/directives/plan-manager.html index 125c02efe..5e081761d 100644 --- a/static/directives/plan-manager.html +++ b/static/directives/plan-manager.html @@ -3,19 +3,23 @@ -
- You are using more private repositories than your plan allows, please - upgrade your subscription to avoid disruptions in your organization's service. +
+ You are using more private repositories than your plan allows. Please + upgrade your subscription to avoid disruptions in your organization's service.
-
+
+ You are at your current plan's number of allowed private repositories. Please upgrade your subscription to avoid future disruptions in your organization's service. +
+ +
You are nearing the number of allowed private repositories. It might be time to think about - upgrading your subscription to avoid future disruptions in your organization's service. + upgrading your subscription to avoid future disruptions in your organization's service.
-
+
Repository Usage
diff --git a/static/js/app.js b/static/js/app.js index a5f509c86..a00b286dd 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -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(); }); } }; diff --git a/static/js/controllers.js b/static/js/controllers.js index be9b3702f..304139652 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -667,91 +667,24 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) { } function UserAdminCtrl($scope, $timeout, Restangular, PlanService, UserService, KeyService, $routeParams) { - // Load the list of plans. - PlanService.getPlans(function(plans) { - $scope.plans = plans.user; - }); - $scope.$watch(function () { return UserService.currentUser(); }, function (currentUser) { $scope.askForPassword = currentUser.askForPassword; + if (!currentUser.anonymous) { + $scope.user = currentUser; + } + $scope.loading = false; }, true); - var subscribedToPlan = function(sub) { - $scope.subscription = sub; - PlanService.getPlan(sub.plan, function(subscribedPlan) { - $scope.subscribedPlan = subscribedPlan; - $scope.planUsagePercent = sub.usedPrivateRepos * 100 / $scope.subscribedPlan.privateRepos; - - if (sub.usedPrivateRepos > $scope.subscribedPlan.privateRepos) { - $scope.errorMessage = 'You are using more private repositories than your plan allows, please upgrade your subscription to avoid disruptions in your service.'; - } else { - $scope.errorMessage = null; - } - - $scope.planLoading = false; - $scope.planChanging = false; - - mixpanel.people.set({ - 'plan': sub.plan - }); - }); - }; - - $scope.planLoading = true; - UserService.getCurrentSubscription(subscribedToPlan, function() { - // User has no subscription - $scope.planChanging = false; - }); - - $scope.planChanging = false; - $scope.subscribe = function(planId) { - PlanService.showSubscribeDialog($scope, planId, null, function() { - // Subscribing. - $scope.planChanging = true; - }, function(plan) { - // Subscribed. - UserService.resetCurrentSubscription(); - subscribedToPlan(plan); - }, function() { - // Failure. - $scope.errorMessage = 'Unable to subscribe.'; - $scope.planChanging = false; - }); - }; - - $scope.changeSubscription = function(planId) { - $scope.planChanging = true; - $scope.errorMessage = undefined; - - var subscriptionDetails = { - plan: planId, - }; - - UserService.resetCurrentSubscription(); - var changeSubscriptionRequest = Restangular.one('user/plan'); - changeSubscriptionRequest.customPUT(subscriptionDetails).then(subscribedToPlan, function() { - // Failure - $scope.errorMessage = 'Unable to change subscription.'; - $scope.planChanging = false; - }); - }; - - $scope.cancelSubscription = function() { - $scope.changeSubscription('free'); - }; - // Show the subscribe dialog if a plan was requested. var requested = $routeParams['plan'] if (requested !== undefined && requested !== 'free') { - PlanService.getPlan(requested, function(found) { - if (found) { - $scope.subscribe(requested); - } - }); + // TODO: this. } + $scope.loading = true; $scope.updatingUser = false; $scope.changePasswordSuccess = false; + $('.form-change-pw').popover(); $scope.changePassword = function() { @@ -768,6 +701,7 @@ function UserAdminCtrl($scope, $timeout, Restangular, PlanService, UserService, $scope.user.repeatPassword = ''; $scope.changePasswordForm.$setPristine(); + // Reload the user. UserService.load(); }, function(result) { $scope.updatingUser = false; @@ -1176,6 +1110,7 @@ function OrgAdminCtrl($rootScope, $scope, Restangular, $routeParams, UserService }); var orgname = $routeParams.orgname; + $scope.orgname = orgname; var loadOrganization = function() { var getOrganization = Restangular.one(getRestUrl('organization', orgname)); diff --git a/static/js/graphing.js b/static/js/graphing.js index 274e72324..5ba91b879 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -1175,18 +1175,6 @@ RepositoryUsageChart.prototype.drawInternal_ = function() { var data = [count, Math.max(0, total - count)]; - var getClass = function(i) { - if (total > 0 && (count / total) >= 0.7) { - return 'warning-' + i; - } - - if (count >= total) { - return 'error-' + i; - } - - return 'normal'; - }; - var arcTween = function(a) { var i = d3.interpolate(this._current, a); this._current = i(0); @@ -1208,7 +1196,7 @@ RepositoryUsageChart.prototype.drawInternal_ = function() { .data(pie) .enter().append("path") .attr("fill", function(d, i) { return color(i); }) - .attr("class", function(d, i) { return getClass(i); }) + .attr("class", function(d, i) { return 'arc-' + i; }) .attr("d", arc) .each(function(d) { this._current = d; }); // store the initial angles @@ -1217,9 +1205,7 @@ RepositoryUsageChart.prototype.drawInternal_ = function() { } else { pie.value(function(d, i) { return data[i]; }); // change the value function this.path_ = this.path_.data(pie); // compute the new angles - this.path_.transition().duration(duration).attrTween("d", arcTween); // redraw the arcs - this.path_.attr("class", function(d, i) { return getClass(i); }); // Update the text. this.text_.text(this.count_ + ' / ' + this.total_); diff --git a/static/partials/org-admin.html b/static/partials/org-admin.html index f95aa361f..4f1a77210 100644 --- a/static/partials/org-admin.html +++ b/static/partials/org-admin.html @@ -23,7 +23,7 @@
-
+
diff --git a/static/partials/user-admin.html b/static/partials/user-admin.html index 8408863fb..ee8b343fb 100644 --- a/static/partials/user-admin.html +++ b/static/partials/user-admin.html @@ -1,80 +1,62 @@ -
-
- -
-
-
-
{{ errorMessage }}
+
+ +
+ +
+ No matching user found +
+ +
+
+
+ + + {{ user.username }} +
+
Your account does not currently have a password. You will need to create a password before you will be able to push or pull repositories.
-
-
-
-
- {{ plan.title }} - - - Subscribed - -
-
-
${{ plan.price / 100 }}
-
{{ plan.privateRepos }} Private Repositories
-
-
- -
-
- - - -
-
-
-
-
-
-
-
-
-
- Plan Usage -
-
-
- {{ subscription.usedPrivateRepos }} of {{ subscribedPlan.privateRepos }} private repositories used -
-
-
-
-
-
-
-
-
+
-
- + + -
-
-
- Change Password + + +
+
+ +
+
-
-
+ + +
+
+ +
+ + - - + + Password changed successfully
+