[ADF-2010] Move/copy, when searching for folder multiple results are returned (#2727)

* adding debounce time in object picker
unify search api
fix multiples duplicate result
remove limit of 4 character to search

* remove three.min.js

* remove unused import

* tlsint fix and remove file

* rename sitesApiService to sitesService as all the other services

* fix test timeout async
This commit is contained in:
Eugenio Romano
2017-11-26 22:06:05 +00:00
committed by GitHub
parent 4549dbf1f5
commit 197fab4da8
23 changed files with 380 additions and 323 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { SearchOptions, SearchService } from '@alfresco/adf-core';
import { SearchService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { NodePaging } from 'alfresco-js-api';
import { Observable } from 'rxjs/Observable';
@@ -26,7 +26,8 @@ import { Observable } from 'rxjs/Observable';
@Injectable()
export class ContentNodeSelectorService {
constructor(private searchService: SearchService) {}
constructor(private searchService: SearchService) {
}
/**
* Performs a search for content node selection
@@ -36,19 +37,26 @@ 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, maxItems: number): Observable<NodePaging> {
public search(searchTerm: string, rootNodeId: string, skipCount: number = 0, maxItems: number = 25): Observable<NodePaging> {
searchTerm = searchTerm + '*';
let searchOpts: SearchOptions = {
let defaultSearchNode: any = {
query: {
query: `${searchTerm}* OR name:${searchTerm}*`
},
include: ['path', 'allowableOperations'],
skipCount,
rootNodeId,
nodeType: 'cm:folder',
maxItems,
orderBy: null
paging: {
maxItems: `${maxItems}`,
skipCount: `${skipCount}`
},
filterQueries: [
{ query: "TYPE:'cm:folder'" },
{ query: 'NOT cm:creator:System' }]
};
return this.searchService.getNodeQueryResults(searchTerm, searchOpts);
if (rootNodeId) {
defaultSearchNode.scope = rootNodeId;
}
return this.searchService.search(defaultSearchNode);
}
}