2015-02-20 23:15:48 +00:00
|
|
|
(function() {
|
|
|
|
/**
|
|
|
|
* Page that displays details about an organization, such as its teams.
|
|
|
|
*/
|
|
|
|
angular.module('quayPages').config(['pages', function(pages) {
|
2015-03-25 19:31:05 +00:00
|
|
|
pages.create('org-view', 'org-view.html', OrgViewCtrl, {
|
|
|
|
'newLayout': true,
|
|
|
|
'title': 'Organization {{ organization.name }}',
|
|
|
|
'description': 'Organization {{ organization.name }}'
|
2015-06-29 09:33:00 +00:00
|
|
|
})
|
2015-02-20 23:15:48 +00:00
|
|
|
}]);
|
|
|
|
|
2015-03-30 22:44:23 +00:00
|
|
|
function OrgViewCtrl($scope, $routeParams, $timeout, ApiService, UIService, AvatarService) {
|
2015-03-25 19:31:05 +00:00
|
|
|
var orgname = $routeParams.orgname;
|
|
|
|
|
2015-12-28 21:29:17 +00:00
|
|
|
$scope.namespace = orgname;
|
2015-03-25 19:31:05 +00:00
|
|
|
$scope.showLogsCounter = 0;
|
|
|
|
$scope.showApplicationsCounter = 0;
|
2016-04-25 19:17:18 +00:00
|
|
|
$scope.showBillingCounter = 0;
|
2015-04-21 20:07:24 +00:00
|
|
|
$scope.showRobotsCounter = 0;
|
|
|
|
$scope.showTeamsCounter = 0;
|
2016-04-25 19:17:18 +00:00
|
|
|
$scope.changeEmailInfo = null;
|
2015-03-25 19:31:05 +00:00
|
|
|
|
2015-03-30 22:44:23 +00:00
|
|
|
$scope.orgScope = {
|
|
|
|
'changingOrganization': false,
|
|
|
|
'organizationEmail': ''
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.$watch('orgScope.organizationEmail', function(e) {
|
|
|
|
UIService.hidePopover('#changeEmailForm input');
|
2015-03-25 19:31:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var loadRepositories = function() {
|
|
|
|
var options = {
|
|
|
|
'namespace': orgname,
|
2015-12-28 21:29:17 +00:00
|
|
|
'public': true,
|
|
|
|
'last_modified': true,
|
|
|
|
'popularity': true
|
2015-03-25 19:31:05 +00:00
|
|
|
};
|
|
|
|
|
2015-12-28 21:29:17 +00:00
|
|
|
$scope.organization.repositories = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
|
2015-03-25 19:31:05 +00:00
|
|
|
return resp.repositories;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var loadOrganization = function() {
|
|
|
|
$scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) {
|
|
|
|
$scope.organization = org;
|
2015-03-30 22:44:23 +00:00
|
|
|
$scope.orgScope.organizationEmail = org.email;
|
2015-03-25 19:31:05 +00:00
|
|
|
$scope.isAdmin = org.is_admin;
|
|
|
|
$scope.isMember = org.is_member;
|
|
|
|
|
|
|
|
// Load the repositories.
|
|
|
|
$timeout(function() {
|
|
|
|
loadRepositories();
|
|
|
|
}, 10);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
// Load the organization.
|
|
|
|
loadOrganization();
|
|
|
|
|
2015-04-21 20:07:24 +00:00
|
|
|
$scope.showRobots = function() {
|
|
|
|
$scope.showRobotsCounter++;
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.showTeams = function() {
|
|
|
|
$scope.showTeamsCounter++;
|
|
|
|
};
|
|
|
|
|
2016-04-25 19:17:18 +00:00
|
|
|
$scope.showBilling = function() {
|
|
|
|
$scope.showBillingCounter = true;
|
2015-03-25 19:31:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
$scope.showApplications = function() {
|
|
|
|
$scope.showApplicationsCounter++;
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.showLogs = function() {
|
|
|
|
$scope.showLogsCounter++;
|
|
|
|
};
|
|
|
|
|
2016-04-25 19:17:18 +00:00
|
|
|
$scope.showChangeEmail = function() {
|
|
|
|
$scope.changeEmailInfo = {
|
|
|
|
'email': $scope.organization.email
|
|
|
|
};
|
|
|
|
};
|
2015-03-25 19:31:05 +00:00
|
|
|
|
2016-04-25 19:17:18 +00:00
|
|
|
$scope.changeEmail = function(info, callback) {
|
2015-03-25 19:31:05 +00:00
|
|
|
var params = {
|
|
|
|
'orgname': orgname
|
|
|
|
};
|
|
|
|
|
2016-04-25 19:17:18 +00:00
|
|
|
var details = {
|
|
|
|
'email': $scope.changeEmailInfo.email
|
2015-03-25 19:31:05 +00:00
|
|
|
};
|
|
|
|
|
2016-04-25 19:17:18 +00:00
|
|
|
var errorDisplay = ApiService.errorDisplay('Could not change email address', callback);
|
|
|
|
|
|
|
|
ApiService.changeOrganizationDetails(details, params).then(function() {
|
|
|
|
$scope.organization.email = $scope.changeEmailInfo.email;
|
|
|
|
callback(true);
|
|
|
|
}, errorDisplay);
|
2015-03-25 19:31:05 +00:00
|
|
|
};
|
|
|
|
}
|
2015-02-20 23:15:48 +00:00
|
|
|
})();
|