mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
Merge pull request #4442 from mabashian/4271-add-user-organization
Fixed organization add user/admin save button functionality
This commit is contained in:
@@ -12,9 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath',
|
export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath',
|
||||||
'SelectionInit', 'templateUrl', '$state', 'Rest', '$q', 'Wait',
|
'SelectionInit', 'templateUrl', '$state', 'Rest', '$q', 'Wait', '$window',
|
||||||
function($scope, $rootScope, ProcessErrors, GetBasePath,
|
function($scope, $rootScope, ProcessErrors, GetBasePath,
|
||||||
SelectionInit, templateUrl, $state, Rest, $q, Wait) {
|
SelectionInit, templateUrl, $state, Rest, $q, Wait, $window) {
|
||||||
$scope.$on("linkLists", function() {
|
$scope.$on("linkLists", function() {
|
||||||
|
|
||||||
if ($state.current.name.split(".")[1] === "users") {
|
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.add_users = $scope.$parent.add_user_dataset.results;
|
||||||
|
|
||||||
$scope.selectedItems = [];
|
$scope.selectedItems = [];
|
||||||
$scope.$on('selectedOrDeselected', ()=>{
|
$scope.$on('selectedOrDeselected', function(e, value) {
|
||||||
throw {name: 'NotYetImplemented'};
|
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,
|
var url, listToClose,
|
||||||
|
|
||||||
payloads = $scope.selectedItems.map(function(val) {
|
payloads = $scope.selectedItems.map(function(val) {
|
||||||
return {id: val.id};
|
return {id: val};
|
||||||
});
|
});
|
||||||
|
|
||||||
url = $scope.$parent.orgRelatedUrls[$scope.addUsersType];
|
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() {
|
$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) {
|
$scope.editUser = function(id) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default ['$stateParams', '$scope', 'OrgUserList', 'AddUserList','Rest', '
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.addUsers = function() {
|
$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) {
|
$scope.editUser = function(id) {
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export default [{
|
|||||||
list.iterator = 'add_user';
|
list.iterator = 'add_user';
|
||||||
list.name = 'add_users';
|
list.name = 'add_users';
|
||||||
list.multiSelect = true;
|
list.multiSelect = true;
|
||||||
|
list.fields.username.ngClick = 'linkoutUser(add_user.id)';
|
||||||
delete list.actions;
|
delete list.actions;
|
||||||
delete list.fieldActions;
|
delete list.fieldActions;
|
||||||
return list;
|
return list;
|
||||||
@@ -386,6 +387,7 @@ export default [{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
|
list.searchSize = "col-lg-12 col-md-12 col-sm-12 col-xs-12";
|
||||||
|
list.listTitle = 'Admins';
|
||||||
return list;
|
return list;
|
||||||
}],
|
}],
|
||||||
AddAdminList: ['UserList', function(UserList) {
|
AddAdminList: ['UserList', function(UserList) {
|
||||||
@@ -394,6 +396,7 @@ export default [{
|
|||||||
list.iterator = 'add_user';
|
list.iterator = 'add_user';
|
||||||
list.name = 'add_users';
|
list.name = 'add_users';
|
||||||
list.multiSelect = true;
|
list.multiSelect = true;
|
||||||
|
list.fields.username.ngClick = 'linkoutUser(add_user.id)';
|
||||||
delete list.actions;
|
delete list.actions;
|
||||||
delete list.fieldActions;
|
delete list.fieldActions;
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
Reference in New Issue
Block a user