diff --git a/data/model.py b/data/model.py index 176fe3851..533984428 100644 --- a/data/model.py +++ b/data/model.py @@ -276,6 +276,13 @@ def get_organization_team_members(teamid): query = joined.where(Team.id == teamid) return query + + +def get_teams_within_org(organization): + joined = Team.select().join(TeamMember) + return joined.where(Team.organization == organization) + + def get_user_teams_within_org(username, organization): joined = Team.select().join(TeamMember).join(User) return joined.where(Team.organization == organization, diff --git a/endpoints/api.py b/endpoints/api.py index d0641fa41..5d9628df0 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -241,10 +241,13 @@ user_files = UserRequestFiles(app.config['AWS_ACCESS_KEY'], @app.route('/api/organization/', methods=['GET']) def get_organization(orgname): + user = current_user.db_user() + def team_view(t): return { 'id': t.id, - 'name': t.name + 'name': t.name, + 'is_member': False } def org_view(o, teams): @@ -257,12 +260,11 @@ def get_organization(orgname): if current_user.is_anonymous(): abort(404) - user = current_user.db_user() org = model.get_organization(orgname) if not org: abort(404) - teams = model.get_user_teams_within_org(user.username, org) + teams = model.get_teams_within_org(org) return jsonify(org_view(org, teams)) diff --git a/static/js/app.js b/static/js/app.js index c167a33c2..7b607a8a5 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -204,7 +204,6 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment', 'angulartics', when('/organization/:orgname', {templateUrl: '/static/partials/org-view.html', controller: OrgViewCtrl}). when('/organization/:orgname/admin', {templateUrl: '/static/partials/org-admin.html', controller: OrgAdminCtrl}). - when('/organization/:orgname/teams', {templateUrl: '/static/partials/org-teams.html', controller: OrgTeamsCtrl}). when('/organization/:orgname/teams/:teamname', {templateUrl: '/static/partials/team-view.html', controller: TeamViewCtrl}). when('/v1/', {title: 'Activation information', templateUrl: '/static/partials/v1-page.html', controller: V1Ctrl}). diff --git a/static/js/controllers.js b/static/js/controllers.js index f04edb261..cd7eb74b8 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1197,10 +1197,6 @@ function OrgAdminCtrl($scope, Restangular, $routeParams) { var orgname = $routeParams.orgname; } -function OrgTeamsCtrl($scope, Restangular, $routeParams) { - var orgname = $routeParams.orgname; -} - function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) { $('.info-icon').popover({ 'trigger': 'hover', diff --git a/static/partials/org-view.html b/static/partials/org-view.html index 83a2b8160..ca4e63f14 100644 --- a/static/partials/org-view.html +++ b/static/partials/org-view.html @@ -8,4 +8,9 @@
+ +
+ + {{ team.name }} +