mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
fix order_by parameter not being applied to page 2+ of list results (#2786)
* fix order_by parameter not being applied to page 2+ of list results, resolves #2730 * remove silliness
This commit is contained in:
@@ -83,6 +83,9 @@ export default
|
|||||||
if (scope[iterator + 'SearchFilters']){
|
if (scope[iterator + 'SearchFilters']){
|
||||||
new_url += _.reduce(scope[iterator+'SearchFilters'], (result, filter) => result + '&' + filter.url, '');
|
new_url += _.reduce(scope[iterator+'SearchFilters'], (result, filter) => result + '&' + filter.url, '');
|
||||||
}
|
}
|
||||||
|
if (scope[iterator + 'SearchParams']){
|
||||||
|
new_url += '&' + scope[iterator + 'SearchParams'];
|
||||||
|
}
|
||||||
new_url += '&page_size=' + scope[iterator + '_page_size'];
|
new_url += '&page_size=' + scope[iterator + '_page_size'];
|
||||||
Wait('start');
|
Wait('start');
|
||||||
RefreshRelated({ scope: scope, set: set, iterator: iterator, url: new_url });
|
RefreshRelated({ scope: scope, set: set, iterator: iterator, url: new_url });
|
||||||
@@ -149,6 +152,9 @@ export default
|
|||||||
if (scope[iterator + 'SearchFilters']){
|
if (scope[iterator + 'SearchFilters']){
|
||||||
new_url += _.reduce(scope[iterator+'SearchFilters'], (result, filter) => result + '&' + filter.url, '');
|
new_url += _.reduce(scope[iterator+'SearchFilters'], (result, filter) => result + '&' + filter.url, '');
|
||||||
}
|
}
|
||||||
|
if (scope[iterator + 'SearchParams']){
|
||||||
|
new_url += '&' + scope[iterator + 'SearchParams'];
|
||||||
|
}
|
||||||
new_url += '&page_size=' + scope[iterator + '_page_size'];
|
new_url += '&page_size=' + scope[iterator + '_page_size'];
|
||||||
Wait('start');
|
Wait('start');
|
||||||
scope.getNewPage = true;
|
scope.getNewPage = true;
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ export default
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scope[iterator + 'SearchType' + modifier] = 'icontains';
|
scope[iterator + 'SearchType' + modifier] = 'icontains';
|
||||||
scope[iterator + 'SearchTypeLabel' + modifier] = 'Contains';
|
scope[iterator + 'SearchTypeLabel' + modifier] = 'Contains';
|
||||||
scope[iterator + 'SearchParams' + modifier] = '';
|
scope[iterator + 'SearchParams' + modifier] = '';
|
||||||
@@ -428,8 +429,7 @@ export default
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sort_order) {
|
if (sort_order) {
|
||||||
scope[iterator + 'SearchParams'] += (scope[iterator + 'SearchParams']) ? '&' : '';
|
scope[iterator + 'SearchParams'] = 'order_by=' + encodeURI(sort_order);
|
||||||
scope[iterator + 'SearchParams'] += 'order_by=' + encodeURI(sort_order);
|
|
||||||
}
|
}
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
scope.$emit('doSearch', iterator, page, load, calcOnly, deferWaitStop);
|
scope.$emit('doSearch', iterator, page, load, calcOnly, deferWaitStop);
|
||||||
@@ -475,6 +475,12 @@ export default
|
|||||||
|
|
||||||
|
|
||||||
scope.sort = function (iterator, fld) {
|
scope.sort = function (iterator, fld) {
|
||||||
|
// resets any existing order_by parameters in $scope.current_url;
|
||||||
|
var resetOrderBy = function(){
|
||||||
|
var url = _.filter(scope.current_url.split('&'), (o) => !o.includes('order_by'));
|
||||||
|
scope.current_url = url.join('&');
|
||||||
|
};
|
||||||
|
resetOrderBy();
|
||||||
// Reset sort icons back to 'icon-sort' on all columns
|
// Reset sort icons back to 'icon-sort' on all columns
|
||||||
// except the one clicked.
|
// except the one clicked.
|
||||||
$('.list-header').each(function () {
|
$('.list-header').each(function () {
|
||||||
@@ -515,7 +521,6 @@ export default
|
|||||||
|
|
||||||
scope[list.iterator + '_current_search_params'].sort_order = sort_order;
|
scope[list.iterator + '_current_search_params'].sort_order = sort_order;
|
||||||
Store(iterator + '_current_search_params', scope[iterator + '_current_search_params']);
|
Store(iterator + '_current_search_params', scope[iterator + '_current_search_params']);
|
||||||
|
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user