[ACA-3672] - added server order for document -list (#5899)

* [ACA-3672] - added sorting server side for document-list

* [ACA-3672] - added and fixed unit tests for backend order

* [ACA-3672] - fixed failing test

* [ACA-3672] - regenerated doc and renamed variable

Co-authored-by: Vito Albano <vitoalbano@Vitos-MacBook-Pro.local>
This commit is contained in:
Vito
2020-07-23 14:04:05 +01:00
committed by GitHub
parent a5972e753a
commit 30c5c58d40
57 changed files with 132 additions and 81 deletions

View File

@@ -110,6 +110,9 @@ export class DocumentListService implements DocumentListLoader {
if (opts.where) {
params.where = opts.where;
}
if (opts.orderBy) {
params.orderBy = opts.orderBy;
}
}
return from(this.apiService.getInstance().nodes.getNodeChildren(rootNodeId, params)).pipe(
@@ -169,22 +172,23 @@ export class DocumentListService implements DocumentListLoader {
* @param where Optionally filter the list
* @returns Details of the folder
*/
loadFolderByNodeId(nodeId: string, pagination: PaginationModel, includeFields: string[], where?: string): Observable<DocumentLoaderNode> {
loadFolderByNodeId(nodeId: string, pagination: PaginationModel, includeFields: string[], where?: string, orderBy?: string[]): Observable<DocumentLoaderNode> {
if (this.customResourcesService.isCustomSource(nodeId)) {
return this.customResourcesService.loadFolderByNodeId(nodeId, pagination, includeFields, where).pipe(
map((result: any) => new DocumentLoaderNode(null, result))
);
} else {
return this.retrieveDocumentNode(nodeId, pagination, includeFields, where);
return this.retrieveDocumentNode(nodeId, pagination, includeFields, where, orderBy);
}
}
private retrieveDocumentNode(nodeId: string, pagination: PaginationModel, includeFields: string[], where?: string): Observable<DocumentLoaderNode> {
private retrieveDocumentNode(nodeId: string, pagination: PaginationModel, includeFields: string[], where?: string, orderBy?: string[]): Observable<DocumentLoaderNode> {
return forkJoin(
this.getFolderNode(nodeId, includeFields),
this.getFolder(null, {
maxItems: pagination.maxItems,
skipCount: pagination.skipCount,
orderBy: orderBy,
rootFolderId: nodeId,
where: where
}, includeFields)).pipe(