update manage projects page to use paging and search through new communities API

This commit is contained in:
argirok 2023-09-19 15:59:37 +03:00
parent 116ead698b
commit 82348a8a3b
1 changed files with 9 additions and 4 deletions

View File

@ -7,11 +7,16 @@ import {map} from "rxjs/operators";
export class SearchCommunityProjectsService {
constructor(private http: HttpClient ) {}
searchProjects (properties:EnvProperties, pid: string, page=0, size=500):any {
let url = properties.communityAPI+pid+"/projects/"+ page + "/" + size;
searchProjects (properties:EnvProperties, pid: string, page=1, size=500):any {
this.searchProjectsWithPaging(properties,pid,page, size, null, null);
}
searchProjectsWithPaging (properties:EnvProperties, pid: string, page=1, size=500, searchFilter, funder):any {
let params = funder ? ["funder="+ funder] :[];
if (searchFilter) {
params.push("searchFilter="+ searchFilter)
}
let url = properties.communityAPI+pid+"/projects/"+ (page-1) + "/" + size + (params.length > 0?"?" + params.join("&"):"");
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
//.map(res => <any> res.json())
}
countTotalProjects(properties:EnvProperties,pid:string) {
let url = properties.communityAPI+pid+"/projects/0/1";