mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Update URL params when sorting on projects list
This commit is contained in:
parent
aad185e785
commit
970a714291
@ -13,6 +13,7 @@ function projectsListController (
|
||||
) {
|
||||
const vm = this || {};
|
||||
const [ProjectModel] = resolvedModels;
|
||||
let paginateQuerySet = null;
|
||||
$scope.canAdd = ProjectModel.options('actions.POST');
|
||||
|
||||
vm.strings = strings;
|
||||
@ -75,14 +76,28 @@ function projectsListController (
|
||||
|
||||
vm.toolbarSortValue = toolbarSortDefault;
|
||||
|
||||
// Temporary hack to retrieve $scope.querySet from the paginate directive.
|
||||
// Remove this event listener once the page and page_size params
|
||||
// are represented in the url.
|
||||
$scope.$on('updateDataset', (event, dataset, queryset) => {
|
||||
paginateQuerySet = queryset;
|
||||
});
|
||||
|
||||
vm.onToolbarSort = (sort) => {
|
||||
vm.toolbarSortValue = sort;
|
||||
|
||||
const queryParams = Object.assign(
|
||||
{},
|
||||
$state.params.project_search,
|
||||
paginateQuerySet,
|
||||
{ order_by: sort.value }
|
||||
);
|
||||
|
||||
// Update URL with params
|
||||
$state.go('.', {
|
||||
project_search: queryParams
|
||||
}, { notify: false, location: 'replace' });
|
||||
|
||||
qs.search(GetBasePath(vm.list.basePath), queryParams)
|
||||
.then(({ data }) => {
|
||||
vm.dataset = data;
|
||||
|
||||
@ -55,7 +55,7 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
|
||||
}
|
||||
$scope.dataset = res.data;
|
||||
$scope.collection = res.data.results;
|
||||
$scope.$emit('updateDataset', res.data);
|
||||
$scope.$emit('updateDataset', res.data, queryset);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ export default ['templateUrl',
|
||||
dataset: '=',
|
||||
iterator: '@',
|
||||
basePath: '@',
|
||||
querySet: '=',
|
||||
querySet: '=?',
|
||||
maxVisiblePages: '@',
|
||||
hideViewPerPage: '='
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user