Support specifying `sort_dir
` key in packages.search call
Required to implement 'Previous Page' button at App Catalog page in dashboard. Change-Id: I9dc110be02e3aaf47c4c876569d01029da48359e Targets: blueprint normalize-dashboard-pagination
This commit is contained in:
parent
fe6dec9da7
commit
75f778ac30
@ -19,7 +19,7 @@ stats = None
|
||||
|
||||
SUPPORTED_PARAMS = ('order_by', 'category', 'marker', 'tag', 'class_name',
|
||||
'limit', 'type', 'fqn', 'category', 'owned', 'search',
|
||||
'include_disabled')
|
||||
'include_disabled', 'sort_dir')
|
||||
LIST_PARAMS = ('category', 'tag', 'class', 'order_by')
|
||||
ORDER_VALUES = ('fqn', 'name', 'created')
|
||||
PKG_PARAMS_MAP = {'display_name': 'name',
|
||||
|
@ -317,9 +317,11 @@ def package_search(filters, context, limit=None):
|
||||
sort_keys = [SEARCH_MAPPING[sort_key] for sort_key in
|
||||
filters.get('order_by', []) or ['created']]
|
||||
marker = filters.get('marker')
|
||||
sort_dir = filters.get('sort_dir')
|
||||
if marker is not None: # set marker to real object instead of its id
|
||||
marker = _package_get(marker, session)
|
||||
query = utils.paginate_query(query, pkg, limit, sort_keys, marker)
|
||||
query = utils.paginate_query(
|
||||
query, pkg, limit, sort_keys, marker, sort_dir)
|
||||
|
||||
return query.all()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user