diff --git a/data/model/legacy.py b/data/model/legacy.py index f0d0c32fe..4a4f4ca46 100644 --- a/data/model/legacy.py +++ b/data/model/legacy.py @@ -832,7 +832,7 @@ def get_visible_repository_count(username=None, include_public=True, def get_visible_repositories(username=None, include_public=True, page=None, - limit=None, sort=False, namespace=None): + limit=None, sort=False, namespace=None, namespace_only=False): query = _visible_repository_query(username=username, include_public=include_public, page=page, limit=limit, namespace=namespace, select_models=[Repository, Namespace, Visibility]) @@ -843,6 +843,9 @@ def get_visible_repositories(username=None, include_public=True, page=None, if limit: query = query.limit(limit) + if namespace and namespace_only: + query = query.where(Namespace.username == namespace) + return query diff --git a/endpoints/api/repository.py b/endpoints/api/repository.py index 9d610e686..aa7453554 100644 --- a/endpoints/api/repository.py +++ b/endpoints/api/repository.py @@ -109,6 +109,8 @@ class RepositoryList(ApiResource): @query_param('sort', 'Whether to sort the results.', type=truthy_bool, default=False) @query_param('count', 'Whether to include a count of the total number of results available.', type=truthy_bool, default=False) + @query_param('namespace_only', 'Whether to limit only to the given namespace.', + type=truthy_bool, default=False) def get(self, args): """Fetch the list of repositories under a variety of situations.""" username = None @@ -129,7 +131,8 @@ class RepositoryList(ApiResource): repo_query = model.get_visible_repositories(username, limit=args['limit'], page=args['page'], include_public=args['public'], sort=args['sort'], - namespace=args['namespace']) + namespace=args['namespace'], + namespace_only=args['namespace_only']) def repo_view(repo_obj): repo = { 'namespace': repo_obj.namespace_user.username, diff --git a/static/css/pages/user-view.css b/static/css/pages/user-view.css index 56c2b0a68..1c50e1c90 100644 --- a/static/css/pages/user-view.css +++ b/static/css/pages/user-view.css @@ -3,6 +3,10 @@ margin-left: 6px; } +.user-view .user-repo-list { + padding: 20px; +} + .user-view h3 { margin-bottom: 20px; margin-top: 0px; diff --git a/static/js/pages/org-view.js b/static/js/pages/org-view.js index 1238f75e9..3e825d783 100644 --- a/static/js/pages/org-view.js +++ b/static/js/pages/org-view.js @@ -31,9 +31,7 @@ var loadRepositories = function() { var options = { - 'public': false, - 'private': true, - 'sort': true, + 'namespace_only': true, 'namespace': orgname, }; diff --git a/static/js/pages/user-view.js b/static/js/pages/user-view.js index 99f5ec948..5f02b48f1 100644 --- a/static/js/pages/user-view.js +++ b/static/js/pages/user-view.js @@ -22,9 +22,8 @@ var loadRepositories = function() { var options = { - 'public': false, - 'private': true, 'sort': true, + 'namespace_only': true, 'namespace': username, }; diff --git a/static/partials/user-view.html b/static/partials/user-view.html index 3453e4d76..ed68b9870 100644 --- a/static/partials/user-view.html +++ b/static/partials/user-view.html @@ -10,7 +10,15 @@ -