mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2595] use pagination settings with search filter (#3139)
* use pagination settings * unit tests
This commit is contained in:
@@ -64,6 +64,12 @@ export class SearchResultComponent implements OnInit {
|
||||
onRefreshPagination(pagination: Pagination) {
|
||||
this.maxItems = pagination.maxItems;
|
||||
this.skipCount = pagination.skipCount;
|
||||
|
||||
this.queryBuilder.paging = {
|
||||
maxItems: pagination.maxItems,
|
||||
skipCount: pagination.skipCount
|
||||
};
|
||||
this.queryBuilder.update();
|
||||
}
|
||||
|
||||
onDeleteElementSuccess(element: any) {
|
||||
|
@@ -363,7 +363,25 @@ describe('SearchQueryBuilder', () => {
|
||||
|
||||
const compiled = builder.buildQuery();
|
||||
expect(compiled.scope.locations).toEqual('custom');
|
||||
});
|
||||
|
||||
it('should use pagination settings', () => {
|
||||
const config: SearchConfiguration = {
|
||||
query: {
|
||||
categories: [
|
||||
<any> { id: 'cat1', enabled: true }
|
||||
]
|
||||
}
|
||||
};
|
||||
const builder = new SearchQueryBuilderService(buildConfig(config), null);
|
||||
builder.queryFragments['cat1'] = 'cm:name:test';
|
||||
builder.paging = { maxItems: 5, skipCount: 5 };
|
||||
|
||||
const compiled = builder.buildQuery();
|
||||
expect(compiled.paging).toEqual({
|
||||
maxItems: 5,
|
||||
skipCount: 5
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -37,6 +37,7 @@ export class SearchQueryBuilderService {
|
||||
scope: { locations?: string };
|
||||
filterQueries: FilterQuery[] = [];
|
||||
ranges: { [id: string]: SearchRange } = {};
|
||||
paging: { maxItems?: number; skipCount?: number } = null;
|
||||
|
||||
config: SearchConfiguration;
|
||||
|
||||
@@ -122,12 +123,7 @@ export class SearchQueryBuilderService {
|
||||
},
|
||||
include: ['path', 'allowableOperations'],
|
||||
fields: fields,
|
||||
/*
|
||||
paging: {
|
||||
maxItems: maxResults,
|
||||
skipCount: skipCount
|
||||
},
|
||||
*/
|
||||
paging: this.paging,
|
||||
filterQueries: this.filterQueries,
|
||||
facetQueries: this.config.facetQueries,
|
||||
facetFields: this.config.facetFields,
|
||||
|
Reference in New Issue
Block a user