Work in progress: Start on org view
This commit is contained in:
parent
0175bd91bf
commit
ba7360f2a9
5 changed files with 17 additions and 8 deletions
|
@ -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,
|
||||
|
|
|
@ -241,10 +241,13 @@ user_files = UserRequestFiles(app.config['AWS_ACCESS_KEY'],
|
|||
|
||||
@app.route('/api/organization/<orgname>', 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))
|
||||
|
||||
|
||||
|
|
|
@ -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}).
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -8,4 +8,9 @@
|
|||
|
||||
<div class="org-view container" ng-show="!loading && organization">
|
||||
<div class="organization-header" organization="organization"></div>
|
||||
|
||||
<div ng-repeat="team in organization.teams">
|
||||
<i class="fa fa-group"></i>
|
||||
<span><a href="/organization/{{ organization.name }}/teams/{{ team.name }}">{{ team.name }}</a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue