mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02:30
fixed user and team edit/add indicator and auto-pagination
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
export function TeamsList($scope, $rootScope, $location, $log, $stateParams,
|
export function TeamsList($scope, $rootScope, $location, $log, $stateParams,
|
||||||
Rest, Alert, TeamList, GenerateList, Prompt, SearchInit, PaginateInit,
|
Rest, Alert, TeamList, GenerateList, Prompt, SearchInit, PaginateInit,
|
||||||
ReturnToCaller, ClearScope, ProcessErrors, SetTeamListeners, GetBasePath,
|
ReturnToCaller, ClearScope, ProcessErrors, SetTeamListeners, GetBasePath,
|
||||||
SelectionInit, Wait, Stream, $state) {
|
SelectionInit, Wait, Stream, $state, Refresh) {
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@@ -25,7 +25,22 @@ export function TeamsList($scope, $rootScope, $location, $log, $stateParams,
|
|||||||
mode = (paths[0] === 'teams') ? 'edit' : 'select',
|
mode = (paths[0] === 'teams') ? 'edit' : 'select',
|
||||||
url;
|
url;
|
||||||
|
|
||||||
generator.inject(list, { mode: mode, scope: $scope });
|
var injectForm = function() {
|
||||||
|
generator.inject(list, { mode: mode, scope: $scope });
|
||||||
|
};
|
||||||
|
|
||||||
|
injectForm();
|
||||||
|
|
||||||
|
$scope.$on("RefreshTeamsList", function() {
|
||||||
|
injectForm();
|
||||||
|
Refresh({
|
||||||
|
scope: $scope,
|
||||||
|
set: 'teams',
|
||||||
|
iterator: 'team',
|
||||||
|
url: GetBasePath('teams') + "?order_by=name&page_size=" + $scope.team_page_size
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$scope.selected = [];
|
$scope.selected = [];
|
||||||
|
|
||||||
url = GetBasePath('base') + $location.path() + '/';
|
url = GetBasePath('base') + $location.path() + '/';
|
||||||
@@ -111,7 +126,7 @@ TeamsList.$inject = ['$scope', '$rootScope', '$location', '$log',
|
|||||||
'$stateParams', 'Rest', 'Alert', 'TeamList', 'generateList', 'Prompt',
|
'$stateParams', 'Rest', 'Alert', 'TeamList', 'generateList', 'Prompt',
|
||||||
'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
|
'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
|
||||||
'ProcessErrors', 'SetTeamListeners', 'GetBasePath', 'SelectionInit', 'Wait',
|
'ProcessErrors', 'SetTeamListeners', 'GetBasePath', 'SelectionInit', 'Wait',
|
||||||
'Stream', '$state'
|
'Stream', '$state', 'Refresh'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -154,6 +169,7 @@ export function TeamsAdd($scope, $rootScope, $compile, $location, $log,
|
|||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
$rootScope.flashMessage = "New team successfully created!";
|
$rootScope.flashMessage = "New team successfully created!";
|
||||||
|
$rootScope.$broadcast("EditIndicatorChange", "users", data.id);
|
||||||
$location.path('/teams/' + data.id);
|
$location.path('/teams/' + data.id);
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
@@ -195,6 +211,8 @@ export function TeamsEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
$scope.permission_label = {};
|
$scope.permission_label = {};
|
||||||
$scope.permission_search_select = [];
|
$scope.permission_search_select = [];
|
||||||
|
|
||||||
|
$scope.$emit("RefreshTeamsList");
|
||||||
|
|
||||||
// return a promise from the options request with the permission type choices (including adhoc) as a param
|
// return a promise from the options request with the permission type choices (including adhoc) as a param
|
||||||
var permissionsChoice = fieldChoices({
|
var permissionsChoice = fieldChoices({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
export function UsersList($scope, $rootScope, $location, $log, $stateParams,
|
export function UsersList($scope, $rootScope, $location, $log, $stateParams,
|
||||||
Rest, Alert, UserList, GenerateList, Prompt, SearchInit, PaginateInit,
|
Rest, Alert, UserList, GenerateList, Prompt, SearchInit, PaginateInit,
|
||||||
ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit,
|
ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit,
|
||||||
Wait, Stream, $state) {
|
Wait, Stream, $state, Refresh) {
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@@ -26,7 +26,21 @@ export function UsersList($scope, $rootScope, $location, $log, $stateParams,
|
|||||||
url = (base === 'organizations') ? GetBasePath('organizations') + $stateParams.organization_id + '/users/' :
|
url = (base === 'organizations') ? GetBasePath('organizations') + $stateParams.organization_id + '/users/' :
|
||||||
GetBasePath('teams') + $stateParams.team_id + '/users/';
|
GetBasePath('teams') + $stateParams.team_id + '/users/';
|
||||||
|
|
||||||
generator.inject(UserList, { mode: mode, scope: $scope });
|
var injectForm = function() {
|
||||||
|
generator.inject(UserList, { mode: mode, scope: $scope });
|
||||||
|
};
|
||||||
|
|
||||||
|
injectForm();
|
||||||
|
|
||||||
|
$scope.$on("RefreshUsersList", function() {
|
||||||
|
injectForm();
|
||||||
|
Refresh({
|
||||||
|
scope: $scope,
|
||||||
|
set: 'users',
|
||||||
|
iterator: 'user',
|
||||||
|
url: GetBasePath('users') + "?order_by=username&page_size=" + $scope.user_page_size
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$scope.selected = [];
|
$scope.selected = [];
|
||||||
|
|
||||||
@@ -101,7 +115,8 @@ export function UsersList($scope, $rootScope, $location, $log, $stateParams,
|
|||||||
UsersList.$inject = ['$scope', '$rootScope', '$location', '$log',
|
UsersList.$inject = ['$scope', '$rootScope', '$location', '$log',
|
||||||
'$stateParams', 'Rest', 'Alert', 'UserList', 'generateList', 'Prompt',
|
'$stateParams', 'Rest', 'Alert', 'UserList', 'generateList', 'Prompt',
|
||||||
'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
|
'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
|
||||||
'ProcessErrors', 'GetBasePath', 'SelectionInit', 'Wait', 'Stream', '$state'
|
'ProcessErrors', 'GetBasePath', 'SelectionInit', 'Wait', 'Stream', '$state',
|
||||||
|
'Refresh'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -173,6 +188,7 @@ export function UsersAdd($scope, $rootScope, $compile, $location, $log,
|
|||||||
var base = $location.path().replace(/^\//, '').split('/')[0];
|
var base = $location.path().replace(/^\//, '').split('/')[0];
|
||||||
if (base === 'users') {
|
if (base === 'users') {
|
||||||
$rootScope.flashMessage = 'New user successfully created!';
|
$rootScope.flashMessage = 'New user successfully created!';
|
||||||
|
$rootScope.$broadcast("EditIndicatorChange", "users", data.id);
|
||||||
$location.path('/users/' + data.id);
|
$location.path('/users/' + data.id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -226,6 +242,8 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
$scope.permission_label = {};
|
$scope.permission_label = {};
|
||||||
$scope.permission_search_select = [];
|
$scope.permission_search_select = [];
|
||||||
|
|
||||||
|
$scope.$emit("RefreshUsersList");
|
||||||
|
|
||||||
// return a promise from the options request with the permission type choices (including adhoc) as a param
|
// return a promise from the options request with the permission type choices (including adhoc) as a param
|
||||||
var permissionsChoice = fieldChoices({
|
var permissionsChoice = fieldChoices({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default ['$http', function($http) {
|
|||||||
// divide by the page size to get what
|
// divide by the page size to get what
|
||||||
// page the data should be on
|
// page the data should be on
|
||||||
var count = data.data.count;
|
var count = data.data.count;
|
||||||
return Math.ceil(count/pageSize);
|
return Math.ceil(count/parseInt(pageSize));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user