[ADF-2061] Fix content node selector search (#2772)

* Fix content node selector search

* Fix tests
This commit is contained in:
Popovics András
2017-12-07 19:23:38 +00:00
committed by Eugenio Romano
parent 19b1507251
commit 3e52127b5c
3 changed files with 125 additions and 13 deletions

View File

@@ -26,8 +26,7 @@ import { Observable } from 'rxjs/Observable';
@Injectable()
export class ContentNodeSelectorService {
constructor(private searchService: SearchService) {
}
constructor(private searchService: SearchService) {}
/**
* Performs a search for content node selection
@@ -37,7 +36,9 @@ export class ContentNodeSelectorService {
* @param rootNodeId The root is to start the search from
* @param maxItems How many items to load
*/
public search(searchTerm: string, rootNodeId: string, skipCount: number = 0, maxItems: number = 25): Observable<NodePaging> {
public search(searchTerm: string, rootNodeId: string = null, skipCount: number = 0, maxItems: number = 25): Observable<NodePaging> {
const parentFiltering = rootNodeId ? [ { query: `ANCESTOR:'workspace://SpacesStore/${rootNodeId}'` } ] : [];
let defaultSearchNode: any = {
query: {
@@ -50,13 +51,14 @@ export class ContentNodeSelectorService {
},
filterQueries: [
{ query: "TYPE:'cm:folder'" },
{ query: 'NOT cm:creator:System' }]
{ query: 'NOT cm:creator:System' },
...parentFiltering
],
scope: {
locations: ['nodes']
}
};
if (rootNodeId) {
defaultSearchNode.scope = rootNodeId;
}
return this.searchService.search(defaultSearchNode);
}
}