mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 21:21:21 -03:30
Merge pull request #4442 from mabashian/4271-add-user-organization
Fixed organization add user/admin save button functionality
This commit is contained in:
commit
462c548aee
@ -12,9 +12,9 @@
|
||||
*/
|
||||
|
||||
export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath',
|
||||
'SelectionInit', 'templateUrl', '$state', 'Rest', '$q', 'Wait',
|
||||
'SelectionInit', 'templateUrl', '$state', 'Rest', '$q', 'Wait', '$window',
|
||||
function($scope, $rootScope, ProcessErrors, GetBasePath,
|
||||
SelectionInit, templateUrl, $state, Rest, $q, Wait) {
|
||||
SelectionInit, templateUrl, $state, Rest, $q, Wait, $window) {
|
||||
$scope.$on("linkLists", function() {
|
||||
|
||||
if ($state.current.name.split(".")[1] === "users") {
|
||||
@ -32,8 +32,15 @@ function($scope, $rootScope, ProcessErrors, GetBasePath,
|
||||
$scope.add_users = $scope.$parent.add_user_dataset.results;
|
||||
|
||||
$scope.selectedItems = [];
|
||||
$scope.$on('selectedOrDeselected', ()=>{
|
||||
throw {name: 'NotYetImplemented'};
|
||||
$scope.$on('selectedOrDeselected', function(e, value) {
|
||||
let item = value.value;
|
||||
|
||||
if (item.isSelected) {
|
||||
$scope.selectedItems.push(item.id);
|
||||
}
|
||||
else {
|
||||
$scope.selectedItems = _.remove($scope.selectedItems, { id: item.id });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -42,7 +49,7 @@ function($scope, $rootScope, ProcessErrors, GetBasePath,
|
||||
var url, listToClose,
|
||||
|
||||
payloads = $scope.selectedItems.map(function(val) {
|
||||
return {id: val.id};
|
||||
return {id: val};
|
||||
});
|
||||
|
||||
url = $scope.$parent.orgRelatedUrls[$scope.addUsersType];
|
||||
@ -69,5 +76,11 @@ function($scope, $rootScope, ProcessErrors, GetBasePath,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.linkoutUser = function(userId) {
|
||||
// Open the edit user form in a new tab so as not to navigate the user
|
||||
// away from the modal
|
||||
$window.open('/#/users/' + userId,'_blank');
|
||||
};
|
||||
});
|
||||
}];
|
||||
|
||||
@ -37,7 +37,7 @@ export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state',
|
||||
}
|
||||
|
||||
$scope.addUsers = function() {
|
||||
$compile("<add-users add-users-type='admin' class='AddUsers'></add-users>")($scope);
|
||||
$compile("<add-users add-users-type='admins' class='AddUsers'></add-users>")($scope);
|
||||
};
|
||||
|
||||
$scope.editUser = function(id) {
|
||||
|
||||
@ -37,7 +37,7 @@ export default ['$stateParams', '$scope', 'OrgUserList', 'AddUserList','Rest', '
|
||||
}
|
||||
|
||||
$scope.addUsers = function() {
|
||||
$compile("<add-users add-users-type='user' class='AddUsers'></add-users>")($scope);
|
||||
$compile("<add-users add-users-type='users' class='AddUsers'></add-users>")($scope);
|
||||
};
|
||||
|
||||
$scope.editUser = function(id) {
|
||||
|
||||
@ -99,6 +99,7 @@ export default [{
|
||||
list.iterator = 'add_user';
|
||||
list.name = 'add_users';
|
||||
list.multiSelect = true;
|
||||
list.fields.username.ngClick = 'linkoutUser(add_user.id)';
|
||||
delete list.actions;
|
||||
delete list.fieldActions;
|
||||
return list;
|
||||
@ -386,6 +387,7 @@ export default [{
|
||||
}
|
||||
};
|
||||
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
|
||||
list.listTitle = 'Admins';
|
||||
return list;
|
||||
}],
|
||||
AddAdminList: ['UserList', function(UserList) {
|
||||
@ -394,6 +396,7 @@ export default [{
|
||||
list.iterator = 'add_user';
|
||||
list.name = 'add_users';
|
||||
list.multiSelect = true;
|
||||
list.fields.username.ngClick = 'linkoutUser(add_user.id)';
|
||||
delete list.actions;
|
||||
delete list.fieldActions;
|
||||
return list;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user