[Trunk | Library]:

1. searchDataproviders.service.ts & searchProjects.service.ts & searchZenodoCommunities.service.ts & email.service.ts: Rename "communityId" to "pid".
2. curator.service.ts: create request path in service.
3. help-content.service.ts: Added method "statisticsIsActiveToggle()" (already added in help-content.service.ts in Admin portal).
4. layout.service.ts: "properties" as first parameter in methods | build request path in service.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58443 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-04-08 11:25:41 +00:00
parent f2fc747a8b
commit 6331a47039
7 changed files with 26 additions and 19 deletions

View File

@ -6,13 +6,13 @@ import {map} from "rxjs/operators";
@Injectable()
export class SearchCommunityDataprovidersService {
constructor(private http: HttpClient ) {}
searchDataproviders (properties:EnvProperties, communityId: string):any {
let url = properties.communityAPI+communityId+"/contentproviders";
searchDataproviders (properties:EnvProperties, pid: string):any {
let url = properties.communityAPI+pid+"/contentproviders";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
}
countTotalDataproviders(properties:EnvProperties,communityId:string) {
let url = properties.communityAPI+communityId+"/contentproviders";
countTotalDataproviders(properties:EnvProperties,pid:string) {
let url = properties.communityAPI+pid+"/contentproviders";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['length']));
}

View File

@ -16,11 +16,13 @@ export class CuratorService {
return this.http.get<Curator[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
}
public updateCurator(url: string, curator: Curator) {
public updateCurator(properties: EnvProperties, curator: Curator) {
let url: string = properties.adminToolsAPIURL + "curator";
return this.http.post<Curator>(url, curator, CustomOptions.getAuthOptions());
}
public getCurator(properties: EnvProperties, url: string): Observable<Curator> {
public getCurator(properties: EnvProperties, curatorId: string): Observable<Curator> {
let url: string = properties.adminToolsAPIURL + 'curator/'+curatorId;
return this.http.get<Curator>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
}

View File

@ -8,14 +8,14 @@ import {map} from "rxjs/operators";
export class SearchCommunityProjectsService {
constructor(private http: HttpClient ) {}
searchProjects (properties:EnvProperties, communityId: string):any {
let url = properties.communityAPI+communityId+"/projects";
searchProjects (properties:EnvProperties, pid: string):any {
let url = properties.communityAPI+pid+"/projects";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
//.map(res => <any> res.json())
}
countTotalProjects(properties:EnvProperties,communityId:string) {
let url = properties.communityAPI+communityId+"/projects";
countTotalProjects(properties:EnvProperties,pid:string) {
let url = properties.communityAPI+pid+"/projects";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['length']));
}

View File

@ -7,8 +7,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class SearchZenodoCommunitiesService {
constructor(private http: HttpClient ) {}
searchZCommunities (properties:EnvProperties, communityId: string):any {
let url = properties.communityAPI+communityId+"/zenodocommunities";
searchZCommunities (properties:EnvProperties, pid: string):any {
let url = properties.communityAPI+pid+"/zenodocommunities";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
//.map(res => <any> res.json())

View File

@ -393,4 +393,9 @@ export class HelpContentService {
//.map(stats => <any>stats.json())
.pipe(catchError(this.handleError));
}
statisticsIsActiveToggle(apiURL: string, id: string): Observable<boolean> {
const url = apiURL + '/statistics/' + encodeURIComponent(id) + '/toggle';
return this.http.post<boolean>(url, {}, CustomOptions.getAuthOptionsWithBody()).pipe(catchError(this.handleError));
}
}

View File

@ -21,14 +21,14 @@ export class LayoutService {
}
}
saveLayout(communityId: string, url: string, layout: CustomizationOptions): Observable<CustomizationOptions> {
saveLayout(properties: EnvProperties, pid: string, layout: CustomizationOptions): Observable<CustomizationOptions> {
LayoutService.removeNulls(layout);
return this.http.post<CustomizationOptions>(url
+ communityId + '/layout', layout, CustomOptions.getAuthOptionsWithBody());
return this.http.post<CustomizationOptions>(properties.adminToolsAPIURL + 'community/'
+ pid + '/layout', layout, CustomOptions.getAuthOptionsWithBody());
}
getLayout(properties: EnvProperties, communityId: string): Observable<CustomizationOptions> {
return this.http.get<CustomizationOptions>(properties.adminToolsAPIURL+"/community/" + communityId + '/layout');
getLayout(properties: EnvProperties, pid: string): Observable<CustomizationOptions> {
return this.http.get<CustomizationOptions>(properties.adminToolsAPIURL+"/community/" + pid + '/layout');
}
mockLayout(): any {

View File

@ -13,10 +13,10 @@ export class EmailService {
constructor(private http:HttpClient) {
}
notifyForNewManagers(properties: EnvProperties, communityId: string, email: Email) {
notifyForNewManagers(properties: EnvProperties, pid: string, email: Email) {
let body = JSON.stringify(email);
return this.http.post(properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + communityId, body, CustomOptions.getAuthOptionsWithBody());
return this.http.post(properties.adminToolsAPIURL + "/notifyForNewSubscribers/" + pid, body, CustomOptions.getAuthOptionsWithBody());
//.map(request => request.json());
}