apply initial changes base odn new community API

This commit is contained in:
argirok 2023-07-14 11:43:27 +03:00
parent 500dd61f9b
commit 662b514ab5
11 changed files with 31 additions and 35 deletions

@ -1 +1 @@
Subproject commit 8d8eda416b4873c50f689db54444f135396db56d Subproject commit 3ee4129c7e76cc7f4c8dcfcf27c135ce873f8f0d

View File

@ -113,6 +113,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
deleteAffiliationOpen(index: number) { deleteAffiliationOpen(index: number) {
this.index = index; this.index = index;
let affiliation: Affiliation = this.affiliations[index]; let affiliation: Affiliation = this.affiliations[index];
console.log(index, affiliation)
this.removeAffiliationModal.alertTitle = 'Delete Organization'; this.removeAffiliationModal.alertTitle = 'Delete Organization';
this.removeAffiliationModal.message = 'Do you want to remove <b>' + this.removeAffiliationModal.message = 'Do you want to remove <b>' +
affiliation.name + '</b> from Organizations?'; affiliation.name + '</b> from Organizations?';
@ -164,7 +165,8 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
removeAffiliation() { removeAffiliation() {
this.loading = true; this.loading = true;
this.affiliationService.deleteAffiliation(this.properties.communityAPI + this.community.communityId + '/organizations', console.log(this.index, this.affiliations[this.index].id)
this.affiliationService.deleteAffiliation(this.properties.communityAPI + this.community.communityId + '/organizations?organizationName='+this.affiliations[this.index].name,
this.affiliations[this.index].id).subscribe((deleteOK) => { this.affiliations[this.index].id).subscribe((deleteOK) => {
this.affiliations.splice(this.index, 1); this.affiliations.splice(this.index, 1);
if (this.currentPage.length === 0) { if (this.currentPage.length === 0) {

View File

@ -81,7 +81,8 @@ export class RemoveContentProvidersComponent implements OnInit {
} }
public confirmedDeleteContentProvider() { public confirmedDeleteContentProvider() {
this.subscriptions.push(this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, this.selectedCommunityContentProvider.id).subscribe( console.log(this.selectedCommunityContentProvider)
this.subscriptions.push(this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, this.selectedCommunityContentProvider.openaireId).subscribe(
() => { () => {
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider); let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider);
this.communityContentProviders.splice(index, 1); this.communityContentProviders.splice(index, 1);

View File

@ -133,7 +133,7 @@ export class RemoveProjectsComponent implements OnInit {
} }
public confirmedDeleteProject(data: any) { public confirmedDeleteProject(data: any) {
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.id).subscribe( this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.openaireId).subscribe(
data => { data => {
let index = this.communityProjects.indexOf(this.selectedCommunityProject); let index = this.communityProjects.indexOf(this.selectedCommunityProject);
this.communityProjects.splice(index, 1); this.communityProjects.splice(index, 1);
@ -189,7 +189,7 @@ export class RemoveProjectsComponent implements OnInit {
this.subscriptions.push(this._searchCommunityProjectsService.searchProjects(this.properties, this.community.communityId).subscribe( this.subscriptions.push(this._searchCommunityProjectsService.searchProjects(this.properties, this.community.communityId).subscribe(
data => { data => {
this.communityProjects = data; this.communityProjects = data.content;
this.previewCommunityProjects = this.communityProjects; this.previewCommunityProjects = this.communityProjects;
this.sort(); this.sort();

View File

@ -88,7 +88,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit, OnDestroy {
} }
public confirmedDeleteCommunity(data: any) { public confirmedDeleteCommunity(data: any) {
this.subscriptions.push(this._manageZenodoCommunitiesService.removeZCommunity(this.properties, this.community.communityId, this.selectedToDelete.openaireId).subscribe( this.subscriptions.push(this._manageZenodoCommunitiesService.removeZCommunity(this.properties, this.community.communityId, this.selectedToDelete.id).subscribe(
data => { data => {
var pos = -1; var pos = -1;
for (var i = 0; i < this.selectedCommunities.length; i++) { for (var i = 0; i < this.selectedCommunities.length; i++) {

View File

@ -65,8 +65,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
this.masterZenodoCommunityId = this.community.zenodoCommunity; this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (this.masterZenodoCommunityId) { if (this.masterZenodoCommunityId) {
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
this.properties.zenodoCommunities + this.masterZenodoCommunityId, this.properties.zenodoCommunities + this.masterZenodoCommunityId).subscribe(
null).subscribe(
result => { result => {
this.masterZenodoCommunity = result; this.masterZenodoCommunity = result;
this.selectedCommunities.unshift(this.masterZenodoCommunity); this.selectedCommunities.unshift(this.masterZenodoCommunity);
@ -81,25 +80,24 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
} }
this.zenodoSearchUtils.status = this.errorCodes.LOADING; this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.zenodoSearchUtils.status = this.errorCodes.LOADING; this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.community.communityId).subscribe( // this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.community.communityId).subscribe(
result => { // result => {
this.selectedCommunityIds = result; this.selectedCommunityIds = this.community.otherZenodoCommunities;
this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length; this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length;
if (this.selectedCommunityIds.length === 0) { if (this.selectedCommunityIds.length === 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE; this.zenodoSearchUtils.status = this.errorCodes.NONE;
} }
for (let i = 0; i < this.selectedCommunityIds.length; i++) { for (let i = 0; i < this.selectedCommunityIds.length; i++) {
this.getZenodoCommunityById( this.getZenodoCommunityById(
this.selectedCommunityIds[i]['zenodoid'], this.selectedCommunityIds[i]);
this.selectedCommunityIds[i]['id']);
} }
}, // },
error => { // error => {
console.log('list of zenodo communities couldn\'t be loaded'); // console.log('list of zenodo communities couldn\'t be loaded');
this.zenodoSearchUtils.status = this.errorCodes.DONE; // this.zenodoSearchUtils.status = this.errorCodes.DONE;
} // }
); // );
}) })
); );
@ -116,9 +114,9 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
}); });
} }
getZenodoCommunityById(zenodoid, openaireId) { getZenodoCommunityById(zenodoid) {
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
this.properties.zenodoCommunities + zenodoid, openaireId).subscribe( this.properties.zenodoCommunities + zenodoid).subscribe(
result => { result => {
this.selectedCommunities.push(result); this.selectedCommunities.push(result);
this.zenodocommunitiesloadedCount++; this.zenodocommunitiesloadedCount++;
@ -131,7 +129,6 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
error => { error => {
const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo(); const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo();
emptyCommunity.id = zenodoid; emptyCommunity.id = zenodoid;
emptyCommunity.openaireId = openaireId;
emptyCommunity.title = zenodoid; emptyCommunity.title = zenodoid;
this.selectedCommunities.push(emptyCommunity); this.selectedCommunities.push(emptyCommunity);
this.zenodocommunitiesloadedCount++; this.zenodocommunitiesloadedCount++;

View File

@ -11,7 +11,7 @@ export class ManageCommunityContentProvidersService {
removeContentProvider(properties: EnvProperties, pid: string, id: string): any { removeContentProvider(properties: EnvProperties, pid: string, id: string): any {
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI + pid + '/contentproviders'; let url = properties.communityAPI + pid + '/contentproviders?contentproviderId=' +id;
return this.http.request('delete', url, {body: id, headers: headers}); return this.http.request('delete', url, {body: id, headers: headers});
} }

View File

@ -12,9 +12,9 @@ export class ManageCommunityProjectsService {
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI+pid+"/projects"; let url = properties.communityAPI+pid+"/projects?projectId="+id;
//return this.http.delete(url, options) //return this.http.delete(url, options)
return this.http.request('delete', url, { body: id, headers: headers}) return this.http.request('delete', url, { headers: headers})
} }
addProject(properties:EnvProperties, pid: string, project: any) { addProject(properties:EnvProperties, pid: string, project: any) {

View File

@ -11,10 +11,10 @@ export class ManageZenodoCommunitiesService {
//let options = new RequestOptions({headers: headers, body: id}); //let options = new RequestOptions({headers: headers, body: id});
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI + pid + "/zenodocommunities"; let url = properties.communityAPI + pid + "/zenodocommunities?zenodocommunity="+id;
//return this.http.delete(url, options); //return this.http.delete(url, options);
return this.http.request('delete', url, { body: id, headers: headers}) return this.http.request('delete', url, { headers: headers})
} }
addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) { addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) {
@ -23,13 +23,9 @@ export class ManageZenodoCommunitiesService {
let headers = new HttpHeaders({'Content-Type': 'application/json'}); let headers = new HttpHeaders({'Content-Type': 'application/json'});
let url = properties.communityAPI+pid+"/zenodocommunities"; let url = properties.communityAPI+pid+"/zenodocommunities?zenodocommunity="+zenodoid;
var zCommunity: any = {
"communityId": pid,
"zenodoid": zenodoid return this.http.post<any>(url, headers);
};
return this.http.post<any>(url, JSON.stringify(zCommunity), {headers: headers});
//.map(res => <any> res.json()) //.map(res => <any> res.json())
} }

@ -1 +1 @@
Subproject commit 39cb4e56d0320975fbd08fb5e9c68b87b0c82a10 Subproject commit 2fd57843f85125e54adfb95b35776755037ea359

@ -1 +1 @@
Subproject commit 1e06310b8b2b56f131754eaded615b6cf32c5848 Subproject commit 2fffe0fa672adcf5577461d10c30e34b00308c85