Add a dropdown next to the entity search which shows all the user’s teams and robot accounts, and lets them create new ones on the fly
This commit is contained in:
parent
ecabcc3fc6
commit
9197a20a77
11 changed files with 223 additions and 53 deletions
|
@ -449,11 +449,7 @@ function RepoAdminCtrl($scope, Restangular, $routeParams, $rootScope) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Need the $scope.apply for both the permission stuff to change and for
|
||||
// the XHR call to be made.
|
||||
$scope.$apply(function() {
|
||||
$scope.addRole(entity.name, 'read', entity.kind);
|
||||
});
|
||||
$scope.addRole(entity.name, 'read', entity.kind);
|
||||
};
|
||||
|
||||
$scope.deleteRole = function(entityName, kind) {
|
||||
|
@ -1051,6 +1047,7 @@ function OrgViewCtrl($rootScope, $scope, Restangular, $routeParams) {
|
|||
'html': true
|
||||
});
|
||||
|
||||
$scope.TEAM_PATTERN = TEAM_PATTERN;
|
||||
$rootScope.title = 'Loading...';
|
||||
|
||||
var orgname = $routeParams.orgname;
|
||||
|
@ -1102,15 +1099,8 @@ function OrgViewCtrl($rootScope, $scope, Restangular, $routeParams) {
|
|||
return;
|
||||
}
|
||||
|
||||
var createTeam = Restangular.one(getRestUrl('organization', orgname, 'team', teamname));
|
||||
var data = {
|
||||
'name': teamname,
|
||||
'role': 'member'
|
||||
};
|
||||
createTeam.customPOST(data).then(function(resp) {
|
||||
$scope.organization.teams[teamname] = resp;
|
||||
}, function() {
|
||||
$('#cannotChangeTeamModal').modal({});
|
||||
createOrganizationTeam(Restangular, orgname, teamname, function(created) {
|
||||
$scope.organization.teams[teamname] = created;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1237,13 +1227,11 @@ function TeamViewCtrl($rootScope, $scope, Restangular, $routeParams) {
|
|||
$scope.addNewMember = function(member) {
|
||||
if ($scope.members[member.name]) { return; }
|
||||
|
||||
$scope.$apply(function() {
|
||||
var addMember = Restangular.one(getRestUrl('organization', $scope.orgname, 'team', teamname, 'members', member.name));
|
||||
addMember.customPOST().then(function(resp) {
|
||||
$scope.members[member.name] = resp;
|
||||
}, function() {
|
||||
$('#cannotChangeMembersModal').modal({});
|
||||
});
|
||||
var addMember = Restangular.one(getRestUrl('organization', $scope.orgname, 'team', teamname, 'members', member.name));
|
||||
addMember.customPOST().then(function(resp) {
|
||||
$scope.members[member.name] = resp;
|
||||
}, function() {
|
||||
$('#cannotChangeMembersModal').modal({});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue