Start on new org view
This commit is contained in:
parent
a7a8571396
commit
2459b6b467
11 changed files with 442 additions and 103 deletions
|
@ -3,10 +3,94 @@
|
|||
* Page that displays details about an organization, such as its teams.
|
||||
*/
|
||||
angular.module('quayPages').config(['pages', function(pages) {
|
||||
pages.create('org-view', 'org-view.html', OrgViewCtrl);
|
||||
pages.create('org-view', 'org-view.html', OrgViewCtrl, {
|
||||
'newLayout': true,
|
||||
'title': 'Organization {{ organization.name }}',
|
||||
'description': 'Organization {{ organization.name }}'
|
||||
}, ['layout'])
|
||||
|
||||
pages.create('org-view', 'old-org-view.html', OldOrgViewCtrl, {
|
||||
}, ['old-layout']);
|
||||
}]);
|
||||
|
||||
function OrgViewCtrl($rootScope, $scope, ApiService, $routeParams, CreateService) {
|
||||
function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService) {
|
||||
var orgname = $routeParams.orgname;
|
||||
|
||||
$scope.showLogsCounter = 0;
|
||||
$scope.showApplicationsCounter = 0;
|
||||
$scope.showInvoicesCounter = 0;
|
||||
$scope.changingOrganization = false;
|
||||
|
||||
$scope.$watch('organizationEmail', function(e) {
|
||||
UIService.hidePopover('#changeEmailForm');
|
||||
});
|
||||
|
||||
var loadRepositories = function() {
|
||||
var options = {
|
||||
'public': false,
|
||||
'private': true,
|
||||
'sort': true,
|
||||
'namespace': orgname,
|
||||
};
|
||||
|
||||
$scope.repositoriesResource = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
|
||||
return resp.repositories;
|
||||
});
|
||||
};
|
||||
|
||||
var loadOrganization = function() {
|
||||
$scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) {
|
||||
$scope.organization = org;
|
||||
$scope.organizationEmail = org.email;
|
||||
$scope.isAdmin = org.is_admin;
|
||||
$scope.isMember = org.is_member;
|
||||
|
||||
// Load the repositories.
|
||||
$timeout(function() {
|
||||
loadRepositories();
|
||||
}, 10);
|
||||
});
|
||||
};
|
||||
|
||||
// Load the organization.
|
||||
loadOrganization();
|
||||
|
||||
$scope.showInvoices = function() {
|
||||
$scope.showInvoicesCounter++;
|
||||
};
|
||||
|
||||
$scope.showApplications = function() {
|
||||
$scope.showApplicationsCounter++;
|
||||
};
|
||||
|
||||
$scope.showLogs = function() {
|
||||
$scope.showLogsCounter++;
|
||||
};
|
||||
|
||||
$scope.changeEmail = function() {
|
||||
UIService.hidePopover('#changeEmailForm');
|
||||
|
||||
$scope.changingOrganization = true;
|
||||
var params = {
|
||||
'orgname': orgname
|
||||
};
|
||||
|
||||
var data = {
|
||||
'email': $scope.organizationEmail
|
||||
};
|
||||
|
||||
ApiService.changeOrganizationDetails(data, params).then(function(org) {
|
||||
$scope.changingOrganization = false;
|
||||
$scope.changeEmailForm.$setPristine();
|
||||
$scope.organization = org;
|
||||
}, function(result) {
|
||||
$scope.changingOrganization = false;
|
||||
UIService.showFormError('#changeEmailForm', result);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function OldOrgViewCtrl($rootScope, $scope, ApiService, $routeParams, CreateService) {
|
||||
var orgname = $routeParams.orgname;
|
||||
|
||||
$scope.TEAM_PATTERN = TEAM_PATTERN;
|
||||
|
|
Reference in a new issue