From 662b514ab5154358c730164aec4101687ad3f1ed Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 14 Jul 2023 11:43:27 +0300 Subject: [PATCH 01/11] apply initial changes base odn new community API --- src/app/openaireLibrary | 2 +- .../affiliations/affiliations.component.ts | 4 ++- .../remove-content-providers.component.ts | 3 +- .../projects/remove-projects.component.ts | 4 +-- .../manage-zenodo-communities.component.ts | 2 +- .../zenodo-communities.component.ts | 29 +++++++++---------- .../manageContentProviders.service.ts | 2 +- src/app/services/manageProjects.service.ts | 4 +-- .../manageZenodoCommunities.service.ts | 12 +++----- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 11 files changed, 31 insertions(+), 35 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 8d8eda4..3ee4129 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 8d8eda416b4873c50f689db54444f135396db56d +Subproject commit 3ee4129c7e76cc7f4c8dcfcf27c135ce873f8f0d diff --git a/src/app/pages/affiliations/affiliations.component.ts b/src/app/pages/affiliations/affiliations.component.ts index 8cba66c..2fd937e 100644 --- a/src/app/pages/affiliations/affiliations.component.ts +++ b/src/app/pages/affiliations/affiliations.component.ts @@ -113,6 +113,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy { deleteAffiliationOpen(index: number) { this.index = index; let affiliation: Affiliation = this.affiliations[index]; + console.log(index, affiliation) this.removeAffiliationModal.alertTitle = 'Delete Organization'; this.removeAffiliationModal.message = 'Do you want to remove ' + affiliation.name + ' from Organizations?'; @@ -164,7 +165,8 @@ export class AffiliationsComponent implements OnInit, OnDestroy { removeAffiliation() { 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.splice(this.index, 1); if (this.currentPage.length === 0) { diff --git a/src/app/pages/content-providers/remove-content-providers.component.ts b/src/app/pages/content-providers/remove-content-providers.component.ts index 8fce21e..068add6 100644 --- a/src/app/pages/content-providers/remove-content-providers.component.ts +++ b/src/app/pages/content-providers/remove-content-providers.component.ts @@ -81,7 +81,8 @@ export class RemoveContentProvidersComponent implements OnInit { } 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); this.communityContentProviders.splice(index, 1); diff --git a/src/app/pages/projects/remove-projects.component.ts b/src/app/pages/projects/remove-projects.component.ts index b48f89b..5723030 100644 --- a/src/app/pages/projects/remove-projects.component.ts +++ b/src/app/pages/projects/remove-projects.component.ts @@ -133,7 +133,7 @@ export class RemoveProjectsComponent implements OnInit { } 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 => { let index = this.communityProjects.indexOf(this.selectedCommunityProject); 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( data => { - this.communityProjects = data; + this.communityProjects = data.content; this.previewCommunityProjects = this.communityProjects; this.sort(); diff --git a/src/app/pages/zenodo-communities/manage-zenodo-communities.component.ts b/src/app/pages/zenodo-communities/manage-zenodo-communities.component.ts index c7c8a82..205e18c 100644 --- a/src/app/pages/zenodo-communities/manage-zenodo-communities.component.ts +++ b/src/app/pages/zenodo-communities/manage-zenodo-communities.component.ts @@ -88,7 +88,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit, OnDestroy { } 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 => { var pos = -1; for (var i = 0; i < this.selectedCommunities.length; i++) { diff --git a/src/app/pages/zenodo-communities/zenodo-communities.component.ts b/src/app/pages/zenodo-communities/zenodo-communities.component.ts index da2d348..4c1cbc9 100644 --- a/src/app/pages/zenodo-communities/zenodo-communities.component.ts +++ b/src/app/pages/zenodo-communities/zenodo-communities.component.ts @@ -65,8 +65,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy { this.masterZenodoCommunityId = this.community.zenodoCommunity; if (this.masterZenodoCommunityId) { this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, - this.properties.zenodoCommunities + this.masterZenodoCommunityId, - null).subscribe( + this.properties.zenodoCommunities + this.masterZenodoCommunityId).subscribe( result => { this.masterZenodoCommunity = result; 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._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.community.communityId).subscribe( - result => { - this.selectedCommunityIds = result; + // this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.community.communityId).subscribe( + // result => { + this.selectedCommunityIds = this.community.otherZenodoCommunities; this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length; if (this.selectedCommunityIds.length === 0) { this.zenodoSearchUtils.status = this.errorCodes.NONE; } for (let i = 0; i < this.selectedCommunityIds.length; i++) { this.getZenodoCommunityById( - this.selectedCommunityIds[i]['zenodoid'], - this.selectedCommunityIds[i]['id']); + this.selectedCommunityIds[i]); } - }, - error => { - console.log('list of zenodo communities couldn\'t be loaded'); - this.zenodoSearchUtils.status = this.errorCodes.DONE; - } - ); + // }, + // error => { + // console.log('list of zenodo communities couldn\'t be loaded'); + // 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.properties.zenodoCommunities + zenodoid, openaireId).subscribe( + this.properties.zenodoCommunities + zenodoid).subscribe( result => { this.selectedCommunities.push(result); this.zenodocommunitiesloadedCount++; @@ -131,7 +129,6 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy { error => { const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo(); emptyCommunity.id = zenodoid; - emptyCommunity.openaireId = openaireId; emptyCommunity.title = zenodoid; this.selectedCommunities.push(emptyCommunity); this.zenodocommunitiesloadedCount++; diff --git a/src/app/services/manageContentProviders.service.ts b/src/app/services/manageContentProviders.service.ts index 7be4c2f..0f4eacd 100644 --- a/src/app/services/manageContentProviders.service.ts +++ b/src/app/services/manageContentProviders.service.ts @@ -11,7 +11,7 @@ export class ManageCommunityContentProvidersService { removeContentProvider(properties: EnvProperties, pid: string, id: string): any { 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}); } diff --git a/src/app/services/manageProjects.service.ts b/src/app/services/manageProjects.service.ts index 6f99db7..ba5f146 100644 --- a/src/app/services/manageProjects.service.ts +++ b/src/app/services/manageProjects.service.ts @@ -12,9 +12,9 @@ export class ManageCommunityProjectsService { 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.request('delete', url, { body: id, headers: headers}) + return this.http.request('delete', url, { headers: headers}) } addProject(properties:EnvProperties, pid: string, project: any) { diff --git a/src/app/services/manageZenodoCommunities.service.ts b/src/app/services/manageZenodoCommunities.service.ts index 0cdd3a0..8a07c69 100644 --- a/src/app/services/manageZenodoCommunities.service.ts +++ b/src/app/services/manageZenodoCommunities.service.ts @@ -11,10 +11,10 @@ export class ManageZenodoCommunitiesService { //let options = new RequestOptions({headers: headers, body: id}); 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.request('delete', url, { body: id, headers: headers}) + return this.http.request('delete', url, { headers: headers}) } addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) { @@ -23,13 +23,9 @@ export class ManageZenodoCommunitiesService { let headers = new HttpHeaders({'Content-Type': 'application/json'}); - let url = properties.communityAPI+pid+"/zenodocommunities"; - var zCommunity: any = { - "communityId": pid, + let url = properties.communityAPI+pid+"/zenodocommunities?zenodocommunity="+zenodoid; - "zenodoid": zenodoid - }; - return this.http.post(url, JSON.stringify(zCommunity), {headers: headers}); + return this.http.post(url, headers); //.map(res => res.json()) } diff --git a/src/assets/common-assets b/src/assets/common-assets index 39cb4e5..2fd5784 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 39cb4e56d0320975fbd08fb5e9c68b87b0c82a10 +Subproject commit 2fd57843f85125e54adfb95b35776755037ea359 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 1e06310..2fffe0f 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 1e06310b8b2b56f131754eaded615b6cf32c5848 +Subproject commit 2fffe0fa672adcf5577461d10c30e34b00308c85 From d9b0365a1d42dd94599cb4d7c497adf4cfd1e3be Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 14 Jul 2023 15:00:01 +0300 Subject: [PATCH 02/11] clean up imports for deleted SearchZenodoCommunitiesService --- .../pages/zenodo-communities/zenodo-communities.component.ts | 5 +---- .../pages/zenodo-communities/zenodo-communities.module.ts | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/app/pages/zenodo-communities/zenodo-communities.component.ts b/src/app/pages/zenodo-communities/zenodo-communities.component.ts index 4c1cbc9..717c259 100644 --- a/src/app/pages/zenodo-communities/zenodo-communities.component.ts +++ b/src/app/pages/zenodo-communities/zenodo-communities.component.ts @@ -3,8 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; -import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service'; - import {CommunityService} from '../../openaireLibrary/connect/community/community.service'; import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo'; import {ZenodoCommunityInfo} from '../../openaireLibrary/connect/zenodoCommunities/zenodoCommunityInfo'; @@ -50,8 +48,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy { constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _zenodoCommunitieService: ZenodoCommunitiesService, private title: Title, - private _communityService: CommunityService, - private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) { + private _communityService: CommunityService) { } ngOnInit() { diff --git a/src/app/pages/zenodo-communities/zenodo-communities.module.ts b/src/app/pages/zenodo-communities/zenodo-communities.module.ts index 59f1ed6..ebfdd50 100644 --- a/src/app/pages/zenodo-communities/zenodo-communities.module.ts +++ b/src/app/pages/zenodo-communities/zenodo-communities.module.ts @@ -5,7 +5,6 @@ import {RouterModule} from '@angular/router'; import {ManageZenodoCommunitiesComponent} from './manage-zenodo-communities.component'; import {AddZenodoCommunitiesComponent} from './add-zenodo-communities.component'; import {ZenodoCommunitiesComponent} from './zenodo-communities.component'; -import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module'; import {ManageZenodoCommunitiesService} from '../../services/manageZenodoCommunities.service'; import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module'; @@ -22,7 +21,7 @@ import {PagingModule} from "../../openaireLibrary/utils/paging.module"; @NgModule({ imports: [ - CommonModule, FormsModule, RouterModule, SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, + CommonModule, FormsModule, RouterModule, ZenodoCommunitiesServiceModule, AlertModalModule, ZenodoCommunitiesRoutingModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule ], declarations: [ From f63cd1ec600f0a0ce38a3eed89d2a8b9472749f0 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 19 Jul 2023 14:26:16 +0300 Subject: [PATCH 03/11] add fields claim and membership in edit form --- .../edit-community.component.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/app/pages/community-info/profile/edit-community/edit-community.component.ts b/src/app/pages/community-info/profile/edit-community/edit-community.component.ts index 24c0046..69265fc 100644 --- a/src/app/pages/community-info/profile/edit-community/edit-community.component.ts +++ b/src/app/pages/community-info/profile/edit-community/edit-community.component.ts @@ -82,6 +82,16 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach placeholder="Visibility status for your community's profile." [options]="statuses" type="select"> +
+
+
+
+
+
`, @@ -91,9 +101,23 @@ export class EditCommunityComponent { public communityFb: UntypedFormGroup; public statuses: Option[] = [ {label: 'Visible', value: 'all'}, + {label: 'Visible [Public*]', value: 'PUBLIC'}, {label: 'Visible to managers', value: 'manager'}, + {label: 'Visible to managers [Restricted*]', value: 'RESTRICTED'}, +/* + {label: 'Hidden [Private*]', value: 'PRIVATE'}, +*/ {label: 'Hidden', value: 'hidden'} ] + public claimOptions: Option[] = [ + {label: 'Anyone can claim', value: 'all'}, + {label: 'Managers only', value: 'managersOnly'}, + {label: 'membersOnly', value: 'membersOnly'} + ] + public membershipOptions: Option[] = [ + {label: 'Anyone can join', value: 'open'}, + {label: 'By invitation', value: 'byInvitation'} + ] public community: CommunityInfo; public isNew: boolean; public properties: EnvProperties = properties @@ -133,6 +157,8 @@ export class EditCommunityComponent { shortName: this.fb.control(this.community.shortTitle, Validators.required), description: this.fb.control(this.community.description), status: this.fb.control(this.community.status), + claim: this.fb.control(this.community.claim), + membership: this.fb.control(this.community.membership), managers: this.fb.control(this.community.managers), isUpload: this.fb.control(this.community.isUpload), logoUrl: this.fb.control(this.community.logoUrl) From 7568c668b71919ba6f7e4161f4714924e97c94ea Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 13 Sep 2023 12:13:06 +0300 Subject: [PATCH 04/11] hide membership in edit form until the functionality is ready --- .../profile/edit-community/edit-community.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/pages/community-info/profile/edit-community/edit-community.component.ts b/src/app/pages/community-info/profile/edit-community/edit-community.component.ts index 69265fc..d44ae48 100644 --- a/src/app/pages/community-info/profile/edit-community/edit-community.component.ts +++ b/src/app/pages/community-info/profile/edit-community/edit-community.component.ts @@ -87,11 +87,12 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach placeholder="Who can create links for your community" [options]="claimOptions" type="select"> -
+ +
`, From 4dbf21ba482a2869ee2b81912de567a3428dcb43 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 13 Sep 2023 14:38:28 +0300 Subject: [PATCH 05/11] update remove method on the screen you search and add projects and communities --- src/app/pages/projects/add-projects.component.ts | 3 +-- .../zenodo-communities/add-zenodo-communities.component.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/pages/projects/add-projects.component.ts b/src/app/pages/projects/add-projects.component.ts index c286636..1f0de79 100644 --- a/src/app/pages/projects/add-projects.component.ts +++ b/src/app/pages/projects/add-projects.component.ts @@ -141,8 +141,7 @@ export class AddProjectsComponent implements OnInit { public removeProject(project: any) { let communityProject = this.getCommunityProject(project); - let projectId: string = communityProject['id']; - this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, projectId).subscribe( + this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, communityProject['openaireId']).subscribe( data => { let index = this.communityProjects.indexOf(communityProject); this.communityProjects.splice(index, 1); diff --git a/src/app/pages/zenodo-communities/add-zenodo-communities.component.ts b/src/app/pages/zenodo-communities/add-zenodo-communities.component.ts index b0cfaf6..129b9dd 100644 --- a/src/app/pages/zenodo-communities/add-zenodo-communities.component.ts +++ b/src/app/pages/zenodo-communities/add-zenodo-communities.component.ts @@ -194,7 +194,7 @@ export class AddZenodoCommunitiesComponent implements OnInit { public getOpenaireId(community: any): string { for (let com of this.selectedCommunities) { if (com.id == community.id) { - return com.openaireId; + return com.id; } } return null; From 7bcab9023123a12400ae167bac5fbe6c094e6818 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 19 Sep 2023 15:59:37 +0300 Subject: [PATCH 06/11] update manage projects page to use paging and search through new communities API --- .../projects/add-projects.component.html | 6 +- .../pages/projects/add-projects.component.ts | 47 ++++++----- .../projects/manage-projects.component.ts | 12 +-- .../projects/remove-projects.component.html | 23 +++--- .../projects/remove-projects.component.ts | 80 ++++++++++--------- 5 files changed, 90 insertions(+), 78 deletions(-) diff --git a/src/app/pages/projects/add-projects.component.html b/src/app/pages/projects/add-projects.component.html index e9e6060..c4858e7 100644 --- a/src/app/pages/projects/add-projects.component.html +++ b/src/app/pages/projects/add-projects.component.html @@ -94,12 +94,12 @@
+ [externalUrl]="projectUrl" [hasLink]="false">