[Trunk | Admin]:

1. community-edit-form.component.ts & manage-subscribers.component.ts &curator.component.ts & customization.component.ts & manage-user-notifications.component.ts & manage-user-notifications.service.ts: 
	create request path in service and "properties" as first parameter in methods (curator.service.ts, layout.service.ts, subscribe.service.ts).
2. manageContentProviders.service.ts & manageProjects.service.ts & manageZenodoCommunities.service.ts: Rename "communityId" to "pid".


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@58444 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-04-08 11:59:20 +00:00
parent 79654f5e8f
commit 856025a795
9 changed files with 29 additions and 37 deletions

View File

@ -166,9 +166,7 @@ export class CommunityEditFormComponent implements OnInit{
this.sendMailToNewManagers(newManagers);
this.informOldManagersForTheNewOnes();
for (let i = 0; i < newManagers.length; i++) {
this._subscribeService.subscribeToCommunity(
this.communityId, newManagers[i], this.properties.adminToolsAPIURL).
subscribe(
this._subscribeService.subscribeToCommunity(this.properties, this.communityId, newManagers[i]).subscribe(
res => {
// console.log(res);
}

View File

@ -72,8 +72,7 @@ export class CuratorComponent implements OnInit {
this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
this.curatorId = this.user.id;
this.curatorService.getCurator(this.properties,
this.properties.adminToolsAPIURL + 'curator/' + this.curatorId).subscribe(
this.curatorService.getCurator(this.properties, this.curatorId).subscribe(
curator => {
if (curator && Object.keys(curator).length > 0) {
this.curator = curator;
@ -120,8 +119,7 @@ export class CuratorComponent implements OnInit {
if (this.curatorId != null && this.curatorId !== '') {
this.showLoading = true;
this.updateErrorMessage = '';
this.curatorService.getCurator(this.properties,
this.properties.adminToolsAPIURL + 'curator/' + this.curatorId).subscribe(
this.curatorService.getCurator(this.properties, this.curatorId).subscribe(
curator => {
if (curator) {
this.curator = curator;
@ -238,8 +236,7 @@ export class CuratorComponent implements OnInit {
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe();
}
this.curator.photo = res.filename;
this.curatorService.updateCurator(this.properties.adminToolsAPIURL + 'curator',
this.curator).subscribe((curator) => {
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => {
if (curator) {
this.handleSuccessfulSave('Your data has been saved successfully!');
this.newCurator = false;
@ -259,8 +256,7 @@ export class CuratorComponent implements OnInit {
this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe();
this.curator.photo = '';
}
this.curatorService.updateCurator(this.properties.adminToolsAPIURL + 'curator',
this.curator).subscribe((curator) => {
this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => {
if (curator) {
this.handleSuccessfulSave('Your data has been saved successfully!');
this.resetChange();

View File

@ -67,7 +67,7 @@ export class CustomizationComponent implements OnInit {
this.showLoading = true;
this.errorMessage = '';
this.successfulSaveMessage = '';
this.layoutService.getLayout(this.communityId, this.properties.adminToolsAPIURL + 'community/').subscribe(layout => {
this.layoutService.getLayout(this.properties, this.communityId).subscribe(layout => {
this.publishedCustomizationOptions = (layout?layout:new CustomizationOptions());
this.initializeCustomizationOptions(true);
}, error => {
@ -89,7 +89,7 @@ export class CustomizationComponent implements OnInit {
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
});
}
this.layoutService.saveLayout(this.communityId, this.properties.adminToolsAPIURL + 'community/', this.draftCustomizationOptions).subscribe(layout => {
this.layoutService.saveLayout(this.properties, this.communityId, this.draftCustomizationOptions).subscribe(layout => {
this.publishedCustomizationOptions = layout;
this.initializeCustomizationOptions(JSON.stringify(this.publishedCustomizationOptions) != this.previewCustomization);
this.successfulSaveMessage = "Customization Options saved!"

View File

@ -229,7 +229,7 @@ export class ManageSubscribersComponent implements OnInit {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.subRemove = this._subscribeService.unSubscribeToCommunity(this.communityId, this.selectedSubscriberEmail, this.properties.adminToolsAPIURL).subscribe(
this.subRemove = this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId, this.selectedSubscriberEmail).subscribe(
result => {
this.communitySubscribers = result;
},

View File

@ -67,8 +67,7 @@ export class ManageUserNotificationsComponent implements OnInit {
this.user = user;
if (this.user) {
this.userEmail = this.user.email;
this._manageUserNotificationsService.getUserNotifications(
this.properties.adminToolsAPIURL + 'community/' + this.communityId + '/notifications', this.userEmail).subscribe(
this._manageUserNotificationsService.getUserNotifications(this.properties, this.communityId, this.userEmail).subscribe(
userNotifications => {
this.initialUserNotifications = userNotifications;
if (this.initialUserNotifications['notifyForNewManagers'] == null ||
@ -120,9 +119,7 @@ export class ManageUserNotificationsComponent implements OnInit {
this.successfulSaveMessage = '';
this.showLoading = true;
const userNotifications = this.parseUpdatedUserNotifications();
this._manageUserNotificationsService.updateUserNotifications(
this.properties.adminToolsAPIURL + 'community/' + this.communityId + '/notifications',
userNotifications).subscribe(
this._manageUserNotificationsService.updateUserNotifications(this.properties, this.communityId, userNotifications).subscribe(
userNotifications => {
this.initialUserNotifications = JSON.parse(JSON.stringify(this.userNotifications));
this.handleSuccessfulSave('Notification settings saved!');

View File

@ -12,16 +12,17 @@ export class ManageUserNotificationsService {
constructor(private http: HttpClient) {
}
getUserNotifications(url: string, email: string) {
getUserNotifications(properties: EnvProperties, pid: string, email: string) {
let url: string = properties.adminToolsAPIURL + 'community/'+ pid + '/notifications';
return this.http.get(url)//.map(res => <any> res.json())
.pipe(map(res => this.parseUserNotifications(res, email)));
}
updateUserNotifications(url: string, userNotificationsRights: any) {
updateUserNotifications(properties: EnvProperties, pid: string, userNotificationsRights: any) {
//let headers = new Headers({'Content-Type': 'application/json'});
//let options = new RequestOptions({headers: headers});
let body = JSON.stringify(userNotificationsRights);
let url: string = properties.adminToolsAPIURL + 'community/' + pid + '/notifications';
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody());
//.do(request => console.log("Insert Response:"+request.status));
}

View File

@ -9,15 +9,15 @@ export class ManageCommunityContentProvidersService {
constructor(private http: HttpClient) {
}
removeContentProvider(properties: EnvProperties, communityId: string, id: string): any {
removeContentProvider(properties: EnvProperties, pid: string, id: string): any {
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI + communityId + '/contentproviders';
let url = properties.communityAPI + pid + '/contentproviders';
return this.http.request('delete', url, {body: id, headers: headers});
}
addContentProvider(properties: EnvProperties, communityId: string, contentProvider: any): Observable<ContentProvider> {
let url = properties.communityAPI + communityId + '/contentproviders';
let communityContentProvider = this.convertSearchContentProviderToCommunityContentProvider(contentProvider, communityId);
addContentProvider(properties: EnvProperties, pid: string, contentProvider: any): Observable<ContentProvider> {
let url = properties.communityAPI + pid + '/contentproviders';
let communityContentProvider = this.convertSearchContentProviderToCommunityContentProvider(contentProvider, pid);
return this.http.post<ContentProvider>(url, communityContentProvider);
}

View File

@ -6,26 +6,26 @@ import {HttpClient, HttpHeaders} from '@angular/common/http';
export class ManageCommunityProjectsService {
constructor(private http: HttpClient ) {}
removeProject (properties:EnvProperties, communityId: string, id: string):any {
removeProject (properties:EnvProperties, pid: string, id: string):any {
//let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'});
//let options = new RequestOptions({headers: headers, body: id});
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI+communityId+"/projects";
let url = properties.communityAPI+pid+"/projects";
//return this.http.delete(url, options)
return this.http.request('delete', url, { body: id, headers: headers})
}
addProject(properties:EnvProperties, communityId: string, project: any) {
addProject(properties:EnvProperties, pid: string, project: any) {
//let headers = new Headers({'Content-Type': 'application/json'});
//let options = new RequestOptions({headers: headers});
let headers = new HttpHeaders({'Content-Type': 'application/json'});
let url = properties.communityAPI+communityId+"/projects";
let url = properties.communityAPI+pid+"/projects";
let communityProject = this.convertSearchProjectToCommunityProject(project, communityId);
let communityProject = this.convertSearchProjectToCommunityProject(project, pid);
let testProject: any = {
"acronym": "test",
"communityId": "egi",

View File

@ -6,26 +6,26 @@ import{EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
export class ManageZenodoCommunitiesService {
constructor(private http: HttpClient ) {}
removeZCommunity (properties: EnvProperties, communityId: string,id: string):any {
removeZCommunity (properties: EnvProperties, pid: string,id: string):any {
//let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'});
//let options = new RequestOptions({headers: headers, body: id});
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI + communityId + "/zenodocommunities";
let url = properties.communityAPI + pid + "/zenodocommunities";
//return this.http.delete(url, options);
return this.http.request('delete', url, { body: id, headers: headers})
}
addZCommunity(properties:EnvProperties, communityId: string,zenodoid: string) {
addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) {
//let headers = new Headers({'Content-Type': 'application/json'});
//let options = new RequestOptions({headers: headers});
let headers = new HttpHeaders({'Content-Type': 'application/json'});
let url = properties.communityAPI+communityId+"/zenodocommunities";
let url = properties.communityAPI+pid+"/zenodocommunities";
var zCommunity: any = {
"communityId": communityId,
"communityId": pid,
"zenodoid": zenodoid
};