mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
[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:
@@ -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(
|
||||
|
Reference in New Issue
Block a user