Merge pull request #1109 from coreos-inc/commonlistgrid
Create a common repo-list-view control and use it everywhere
This commit is contained in:
commit
4dfeb907c3
13 changed files with 115 additions and 77 deletions
|
@ -13,6 +13,7 @@
|
|||
function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService, AvatarService) {
|
||||
var orgname = $routeParams.orgname;
|
||||
|
||||
$scope.namespace = orgname;
|
||||
$scope.showLogsCounter = 0;
|
||||
$scope.showApplicationsCounter = 0;
|
||||
$scope.showInvoicesCounter = 0;
|
||||
|
@ -31,10 +32,12 @@
|
|||
var loadRepositories = function() {
|
||||
var options = {
|
||||
'namespace': orgname,
|
||||
'public': true
|
||||
'public': true,
|
||||
'last_modified': true,
|
||||
'popularity': true
|
||||
};
|
||||
|
||||
$scope.repositoriesResource = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
|
||||
$scope.organization.repositories = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
|
||||
return resp.repositories;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
}]);
|
||||
|
||||
|
||||
function RepoListCtrl($scope, $sanitize, $q, Restangular, UserService, ApiService, CookieService, Features) {
|
||||
function RepoListCtrl($scope, $sanitize, $q, Restangular, UserService, ApiService, Features) {
|
||||
$scope.namespace = null;
|
||||
$scope.page = 1;
|
||||
$scope.publicPageCount = null;
|
||||
$scope.allRepositories = {};
|
||||
$scope.loading = true;
|
||||
$scope.resources = [];
|
||||
$scope.showAsList = CookieService.get('quay.repoview') == 'list';
|
||||
$scope.Features = Features;
|
||||
|
||||
// When loading the UserService, if the user is logged in, create a list of
|
||||
|
@ -46,11 +45,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
$scope.setShowAsList = function(value) {
|
||||
$scope.showAsList = value;
|
||||
CookieService.putPermanent('quay.repoview', value ? 'list' : 'grid');
|
||||
};
|
||||
|
||||
$scope.isOrganization = function(namespace) {
|
||||
return !!UserService.getOrganization(namespace);
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
$scope.changeEmailInfo = {};
|
||||
$scope.changePasswordInfo = {};
|
||||
$scope.hasSingleSignin = ExternalLoginService.hasSingleSignin();
|
||||
$scope.context = {};
|
||||
|
||||
UserService.updateUserIn($scope);
|
||||
|
||||
|
@ -26,16 +27,18 @@
|
|||
var options = {
|
||||
'public': true,
|
||||
'namespace': username,
|
||||
'last_modified': true,
|
||||
'popularity': true
|
||||
};
|
||||
|
||||
$scope.repositoriesResource = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
|
||||
$scope.context.viewuser.repositories = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
|
||||
return resp.repositories;
|
||||
});
|
||||
};
|
||||
|
||||
var loadUser = function() {
|
||||
$scope.userResource = ApiService.getUserInformationAsResource({'username': username}).get(function(user) {
|
||||
$scope.viewuser = user;
|
||||
$scope.context.viewuser = user;
|
||||
|
||||
// Load the repositories.
|
||||
$timeout(function() {
|
||||
|
|
Reference in a new issue