Makes the page_size return default to all
This commit is contained in:
parent
610f19bea1
commit
e095767bc6
1 changed files with 14 additions and 6 deletions
|
@ -1801,20 +1801,28 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
sort = sort or 'rowid'
|
sort = sort or 'rowid'
|
||||||
comparison = comparison or 'eq'
|
comparison = comparison or 'eq'
|
||||||
|
|
||||||
file_list = self.stream_manager.get_filtered_streams(
|
items = self.stream_manager.get_filtered_streams(
|
||||||
sort, reverse, comparison, **kwargs
|
sort, reverse, comparison, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
total_items = len(items)
|
||||||
|
total_pages = 1
|
||||||
page = page or 1
|
page = page or 1
|
||||||
page_size = page_size or 10
|
|
||||||
total_items = len(file_list)
|
if page_size:
|
||||||
offset = page_size * (page-1)
|
offset = page_size * (page-1)
|
||||||
|
items = items[offset:offset+page_size]
|
||||||
|
total_pages = int((len(items) + (page_size-1)) / page_size)
|
||||||
|
|
||||||
|
else:
|
||||||
|
page_size = len(items)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'total_items': total_items,
|
'total_items': total_items,
|
||||||
'total_pages': int((total_items + (page_size-1)) / page_size),
|
'total_pages': total_pages,
|
||||||
'page': page,
|
'page': page,
|
||||||
'page_size': page_size,
|
'page_size': page_size,
|
||||||
'items': file_list[offset:offset+page_size]
|
'items': items
|
||||||
}
|
}
|
||||||
|
|
||||||
@requires(STREAM_MANAGER_COMPONENT)
|
@requires(STREAM_MANAGER_COMPONENT)
|
||||||
|
|
Loading…
Reference in a new issue