mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Update URL params when sorting on projects list
This commit is contained in:
@@ -13,6 +13,7 @@ function projectsListController (
|
|||||||
) {
|
) {
|
||||||
const vm = this || {};
|
const vm = this || {};
|
||||||
const [ProjectModel] = resolvedModels;
|
const [ProjectModel] = resolvedModels;
|
||||||
|
let paginateQuerySet = null;
|
||||||
$scope.canAdd = ProjectModel.options('actions.POST');
|
$scope.canAdd = ProjectModel.options('actions.POST');
|
||||||
|
|
||||||
vm.strings = strings;
|
vm.strings = strings;
|
||||||
@@ -75,14 +76,28 @@ function projectsListController (
|
|||||||
|
|
||||||
vm.toolbarSortValue = toolbarSortDefault;
|
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.onToolbarSort = (sort) => {
|
||||||
vm.toolbarSortValue = sort;
|
vm.toolbarSortValue = sort;
|
||||||
|
|
||||||
const queryParams = Object.assign(
|
const queryParams = Object.assign(
|
||||||
|
{},
|
||||||
$state.params.project_search,
|
$state.params.project_search,
|
||||||
|
paginateQuerySet,
|
||||||
{ order_by: sort.value }
|
{ order_by: sort.value }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Update URL with params
|
||||||
|
$state.go('.', {
|
||||||
|
project_search: queryParams
|
||||||
|
}, { notify: false, location: 'replace' });
|
||||||
|
|
||||||
qs.search(GetBasePath(vm.list.basePath), queryParams)
|
qs.search(GetBasePath(vm.list.basePath), queryParams)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
vm.dataset = data;
|
vm.dataset = data;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
|
|||||||
}
|
}
|
||||||
$scope.dataset = res.data;
|
$scope.dataset = res.data;
|
||||||
$scope.collection = res.data.results;
|
$scope.collection = res.data.results;
|
||||||
$scope.$emit('updateDataset', res.data);
|
$scope.$emit('updateDataset', res.data, queryset);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default ['templateUrl',
|
|||||||
dataset: '=',
|
dataset: '=',
|
||||||
iterator: '@',
|
iterator: '@',
|
||||||
basePath: '@',
|
basePath: '@',
|
||||||
querySet: '=',
|
querySet: '=?',
|
||||||
maxVisiblePages: '@',
|
maxVisiblePages: '@',
|
||||||
hideViewPerPage: '='
|
hideViewPerPage: '='
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user