diff --git a/endpoints/api.py b/endpoints/api.py index de89b4b7c..6c9e6c43f 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -240,25 +240,25 @@ user_files = UserRequestFiles(app.config['AWS_ACCESS_KEY'], app.config['REGISTRY_S3_BUCKET']) +def team_view(orgname, t): + view_permission = ViewTeamPermission(orgname, t.name) + return { + 'id': t.id, + 'name': t.name, + 'description': t.description, + 'can_view': view_permission.can() + } + @app.route('/api/organization/', methods=['GET']) def get_organization(orgname): user = current_user.db_user() - def team_view(t): - view_permission = ViewTeamPermission(orgname, t.name) - return { - 'id': t.id, - 'name': t.name, - 'description': t.description, - 'can_view': view_permission.can() - } - def org_view(o, teams): admin_org = AdministerOrganizationPermission(orgname) return { 'name': o.username, 'gravatar': compute_hash(o.email), - 'teams': [team_view(t) for t in teams], + 'teams': {t.name : team_view(orgname, t) for t in teams}, 'is_admin': admin_org.can() } @@ -305,6 +305,26 @@ def member_view(m): 'username': m.username } + +@app.route('/api/organization//team/', + methods=['PUT', 'POST']) +def update_organization_team(orgname, teamname): + edit_permission = AdministerOrganizationPermission(orgname) + if edit_permission.can(): + team = None + + try: + team = model.get_organization_team(orgname, teamname) + except: + abort(404) + + team.description = request.get_json()['description'] + team.save() + return jsonify(team_view(orgname, team)) + + abort(403) + + @app.route('/api/organization//team//members', methods=['GET']) def get_organization_team_members(orgname, teamname): diff --git a/static/css/quay.css b/static/css/quay.css index a5b115374..6ef3d3b18 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -1404,6 +1404,12 @@ p.editable:hover i { text-transform: capitalize; } +.org-view .team-listing .team-description { + margin-top: 6px; + margin-left: 37px; + font-size: 16px; +} + /* Overrides for typeahead to work with bootstrap 3. */ .twitter-typeahead .tt-query, diff --git a/static/js/controllers.js b/static/js/controllers.js index 1faffb0ca..dcdcb2c24 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -688,7 +688,7 @@ function UserAdminCtrl($scope, $timeout, Restangular, PlanService, UserService, $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 upgrate your subscription to avoid disruptions in your service.'; + $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; } @@ -1131,10 +1131,22 @@ function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) { }); }; + $scope.updateForDescription = function(content) { + $scope.organization.teams[teamname].description = content; + + var updateTeam = Restangular.one(getRestUrl('organization', orgname, 'team', teamname)); + var data = $scope.organization.teams[teamname]; + updateTeam.customPUT(data).then(function(resp) { + }, function() { + $('#cannotChangeTeamModal').modal({}); + }); + }; + var loadOrganization = function() { var getOrganization = Restangular.one(getRestUrl('organization', orgname)) getOrganization.get().then(function(resp) { $scope.organization = resp; + $scope.team = $scope.organization.teams[teamname]; $scope.loading = !$scope.organization || !$scope.members; }, function() { $scope.organization = null; diff --git a/static/partials/org-view.html b/static/partials/org-view.html index 197e7f262..dc0a56573 100644 --- a/static/partials/org-view.html +++ b/static/partials/org-view.html @@ -9,7 +9,7 @@
-
+
@@ -19,6 +19,6 @@ {{ team.name }}
-
+
diff --git a/static/partials/team-view.html b/static/partials/team-view.html index f9a4f5e58..6d7084b3e 100644 --- a/static/partials/team-view.html +++ b/static/partials/team-view.html @@ -9,6 +9,9 @@
+
+
Team Members @@ -39,6 +42,24 @@
+ + +