From 4131de601cb29a97873120ae3c99c6c203a8724b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 7 Feb 2024 12:00:16 +0200 Subject: [PATCH 1/7] [develop | DONE | ADDED]: cache.js: Added in "longCachingRequests", the endpoints "/utils-service/explore/search" and "/utils-service/explore/funders" to be used as a grouped responses in explore search and funders pages. --- services/cache/mecache/cache.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/cache/mecache/cache.js b/services/cache/mecache/cache.js index 11710b4e..435763a8 100644 --- a/services/cache/mecache/cache.js +++ b/services/cache/mecache/cache.js @@ -14,7 +14,8 @@ const cacheMaxSize = 500; const longCachingRequests = ["/communityFull", "/full", "/pagehelpcontent", "/provision/mvc/vocabularies/", "/pages?page_route=", "/allmetrics", "/countryusagestats/", "/openaire/info", - "/api/communities/", "/openaire/contexts/", "/utils-service/explore/home"]; + "/api/communities/", "/openaire/contexts/", + "/utils-service/explore/home", "/utils-service/explore/search", "/utils-service/explore/funders"]; let cors = require('cors'); app.use(cors()); From a3c79137aa30a57096a9f04c715d99bb4649f88b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 7 Feb 2024 21:28:45 +0200 Subject: [PATCH 2/7] [develop | DONE | CHANGED]: Remove preselected "Open Access" filter from search. 1. home.component.ts: Set field "resultsQuickFilter" to null. 2. searchAll.component.ts: Set field "quickFilter" to null | In method "entityChanged()" do not set parameter "resultbestaccessright" | [BUG FIX] Clear subscriptions from fetchOrps. 3. searchResearchResults.component.ts: Set field "quickFilter" to null. 4. navigationBar.component.ts: Set field "resultsQuickFilter" to null. 5. app.component.ts: Remove "resultbestaccessright" parameter from menu items of Search research products. --- explore/src/app/app.component.ts | 12 ++++++------ explore/src/app/home/home.component.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/explore/src/app/app.component.ts b/explore/src/app/app.component.ts index 7de1b674..a17526e3 100644 --- a/explore/src/app/app.component.ts +++ b/explore/src/app/app.component.ts @@ -167,15 +167,15 @@ export class AppComponent { this.userMenuItems.push(new MenuItem("", "My profile", "", "", false, [], [], {})); this.userMenuItems.push(new MenuItem("", "My ORCID links", "", "/my-orcid-links", false, [], [""], {})); this.userMenuItems.push(new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {})); - let researchOutcomesMenu = new MenuItem("", OpenaireEntities.RESULTS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'}); + let researchOutcomesMenu = new MenuItem("", OpenaireEntities.RESULTS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {}); researchOutcomesMenu.items = [ - new MenuItem("", OpenaireEntities.PUBLICATIONS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("publications") + '"', resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'}), - new MenuItem("", OpenaireEntities.DATASETS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("datasets") + '"', resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'}), - new MenuItem("", OpenaireEntities.SOFTWARE, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("software") + '"', resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'}), - new MenuItem("", OpenaireEntities.OTHER, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("other") + '"', resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'})]; + new MenuItem("", OpenaireEntities.PUBLICATIONS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("publications") + '"'}), + new MenuItem("", OpenaireEntities.DATASETS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("datasets") + '"'}), + new MenuItem("", OpenaireEntities.SOFTWARE, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("software") + '"'}), + new MenuItem("", OpenaireEntities.OTHER, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("other") + '"'})]; //TODO add check for research results route this.menuItems = [ - new MenuItem("search", "Search", "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'}, + new MenuItem("search", "Search", "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {}, null, null, null, null, "_blank", "internal", false, [ researchOutcomesMenu, diff --git a/explore/src/app/home/home.component.ts b/explore/src/app/home/home.component.ts index 5bbbbfb7..f5cab70c 100644 --- a/explore/src/app/home/home.component.ts +++ b/explore/src/app/home/home.component.ts @@ -125,12 +125,12 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { @ViewChild('contact') contact: ElementRef; subscriptions: any[] = []; @ViewChildren('scrolling_element') elements: QueryList; - resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { - filter: null, - selected: true, - filterId: "resultbestaccessright", - value: "Open Access" - }; + resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = null;//{ + // filter: null, + // selected: true, + // filterId: "resultbestaccessright", + // value: "Open Access" + // }; selectedEntity = "all"; selectedEntitySimpleUrl; selectedEntityAdvancedUrl; From 36f1ed105d89f4878c8d4f7d2cc33949fba8ed72 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 7 Feb 2024 22:53:03 +0200 Subject: [PATCH 3/7] Updating openaireLibrary & common-assets --- explore/src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index b12877df..fbe514b7 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit b12877df2a5fb4d9d136edec330b1c5c82e8eb34 +Subproject commit fbe514b74086c61dbfc3b8647b9eea458b34139d From af50558136c0be40ca97f6a568cd29bdb7199fcd Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 7 Feb 2024 22:56:11 +0200 Subject: [PATCH 4/7] [grouped-queries | DONE | CHANGED] funders.component.ts: Replaced search & stakeholders queries of funders (in Funders page) with grouped query for Funders page of EXPLORE --- explore/src/app/funders/funders.component.ts | 249 ++++++++++++------- explore/src/app/funders/funders.module.ts | 3 +- 2 files changed, 159 insertions(+), 93 deletions(-) diff --git a/explore/src/app/funders/funders.component.ts b/explore/src/app/funders/funders.component.ts index 800b8ced..f1de1989 100644 --- a/explore/src/app/funders/funders.component.ts +++ b/explore/src/app/funders/funders.component.ts @@ -17,6 +17,7 @@ import {NumberUtils} from '../openaireLibrary/utils/number-utils.class'; import {LayoutService} from '../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service'; import {FormBuilder, FormControl} from '@angular/forms'; import {debounceTime, distinctUntilChanged} from 'rxjs/operators'; +import {GroupedRequestsService} from "../openaireLibrary/services/groupedRequests.service"; @Component({ selector: 'funders', @@ -85,7 +86,8 @@ export class FundersComponent implements OnInit { private stakeholderService: StakeholderService, private layoutService: LayoutService, private cdr: ChangeDetectorRef, - private fb: FormBuilder,) { + private fb: FormBuilder, + private groupedRequestsService: GroupedRequestsService) { } ngOnInit() { @@ -142,100 +144,155 @@ export class FundersComponent implements OnInit { } private getFunders() { - let refineParams = '&fq=resultbestaccessright%20exact%20%22Open%20Access%22'; - this.subscriptions.push( - zip( - this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties), - this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams), - this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties), - this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL, 'funder') - ).subscribe((data: any[]) => { - // storing all needed data to a map - // 1st call - let queriedFunders1 = data[0][1][0].values; - queriedFunders1.forEach(queriedFunder => { - this.fundersMap.set(queriedFunder.id, { - "id": queriedFunder.id, - "name": queriedFunder.name, - "alias": '', - "researchProducts": +queriedFunder.number, - "openAccessResearchProducts": 0, - "openAccessPercentage": 0, - "projects": 0, - "monitorDashboard": '', - "monitorDashboardStatus": '', - "logoUrl": '' - }); - }); + this.subscriptions.push(this.groupedRequestsService.funders().subscribe(data => { + let funders = data["funders"]; + funders.forEach(queriedFunder => { + let id = queriedFunder.id; + let funder = { + "id": id, + "name": this.removePartAfterCharacters(queriedFunder.name, "||"), + "alias": '', + "researchProducts": +queriedFunder.results, + "openAccessResearchProducts": +queriedFunder.openResults, + "openAccessPercentage": 0, + "projects": +queriedFunder.projects, + "monitorDashboard": '', + "monitorDashboardStatus": '', + "logoUrl": '' + }; - // 2nd call - let queriedFunders2 = data[1][1][0].values; - queriedFunders2.forEach(queriedFunder => { - if(this.fundersMap.has(queriedFunder.id)) { - this.fundersMap.get(queriedFunder.id).openAccessResearchProducts = +queriedFunder.number; - } - }); + if((!funder.researchProducts || funder.researchProducts == 0) && (!funder.projects || funder.projects == 0)) { + return; + } - // 3rd call - let queriedFunders3 = data[2][1][0].values; - queriedFunders3.forEach(queriedFunder => { - if(+queriedFunder.number > 1) { - if (this.fundersMap.has(queriedFunder.id)) { - this.fundersMap.get(queriedFunder.id).projects = +queriedFunder.number; - } else { - this.fundersMap.set(queriedFunder.id, { - "id": queriedFunder.id, - "name": queriedFunder.name, - "alias": '', - "researchProducts": 0, - "openAccessResearchProducts": 0, - "openAccessPercentage": 0, - "projects": +queriedFunder.number, - "monitorDashboard": '', - "monitorDashboardStatus": '', - "logoUrl": '' - }); - } - } - }); + if(queriedFunder.stakeholder) { + let stakeholder = queriedFunder.stakeholder; + funder.alias = stakeholder.alias; + funder.monitorDashboard = stakeholder.alias; + funder.monitorDashboardStatus = stakeholder.visibility; + funder.logoUrl = (stakeholder.isUpload ? properties.utilsService + "/download/" : "")+ (stakeholder.logoUrl); + } - // 4th call - let queriedFunders4 = data[3]; - queriedFunders4.forEach(queriedFunder => { - let id = queriedFunder.index_id + '||' + queriedFunder.index_name + '||' + queriedFunder.index_shortName; - if(this.fundersMap.has(id) && ( - !this.fundersMap.get(id).monitorDashboardStatus - || - (this.fundersMap.get(id).monitorDashboardStatus == "RESTRICTED" && queriedFunder.visibility == "PUBLIC") - || - (this.fundersMap.get(id).monitorDashboardStatus == "PRIVATE" && (queriedFunder.visibility == "RESTRICTED" || queriedFunder.visibility == "PUBLIC")))) { - this.fundersMap.get(id).alias = queriedFunder.alias; - this.fundersMap.get(id).monitorDashboard = queriedFunder.alias; - this.fundersMap.get(id).monitorDashboardStatus = queriedFunder.visibility; - this.fundersMap.get(id).logoUrl = (queriedFunder.isUpload ? properties.utilsService + "/download/" : "")+ (queriedFunder.logoUrl); - } - }); - this.fundersMap.forEach((value) => { - if(value.openAccessResearchProducts > 0) { - value.openAccessPercentage = Math.round((value.openAccessResearchProducts / value.researchProducts) * 100); - } - if(!value.logoUrl && this.staticLogos.has(value.id)) { - let split = value.id.split("||"); - let shortname = (split && split.length==3) ? value.id.split("||")[2] : value.id; - value.logoUrl = "assets/explore-assets/funders/logos/"+shortname+".png"; - } - }); - // convert funders map into an array - this.funders = Array.from(this.fundersMap.values()); - // calculate total numbers for intro content - this.calculateNumbers(); - // sort funders - this.funders.sort((a, b) => a['name'].localeCompare(b['name'])); - // initialize displayedFunders - this.displayedFunders = this.funders; - this.showLoading = false; - }) - ); + if(funder.openAccessResearchProducts && funder.researchProducts) { + funder.openAccessPercentage = Math.round((funder.openAccessResearchProducts / funder.researchProducts) * 100); + } + + if(!funder.logoUrl && this.staticLogos.has(funder.id)) { + let split = funder.id.split("||"); + let shortname = (split && split.length==3) ? funder.id.split("||")[2] : funder.id; + funder.logoUrl = "assets/explore-assets/funders/logos/"+shortname+".png"; + } + + this.fundersMap.set(queriedFunder.id, funder); + }); + // convert funders map into an array + this.funders = Array.from(this.fundersMap.values()); + // calculate total numbers for intro content + this.fundersNumber = data.count; + this.researchProductsNumber = data.results; + this.projectsNumber = data.projects; + // sort funders + this.funders.sort((a, b) => a['name'].localeCompare(b['name'])); + // initialize displayedFunders + this.displayedFunders = this.funders; + this.showLoading = false; + })) + + // let refineParams = '&fq=resultbestaccessright%20exact%20%22Open%20Access%22'; + // this.subscriptions.push( + // zip( + // this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties), + // this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams), + // this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties), + // this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL, 'funder') + // ).subscribe((data: any[]) => { + // // storing all needed data to a map + // // 1st call + // let queriedFunders1 = data[0][1][0].values; + // queriedFunders1.forEach(queriedFunder => { + // this.fundersMap.set(queriedFunder.id, { + // "id": queriedFunder.id, + // "name": queriedFunder.name, + // "alias": '', + // "researchProducts": +queriedFunder.number, + // "openAccessResearchProducts": 0, + // "openAccessPercentage": 0, + // "projects": 0, + // "monitorDashboard": '', + // "monitorDashboardStatus": '', + // "logoUrl": '' + // }); + // }); + // + // // 2nd call + // let queriedFunders2 = data[1][1][0].values; + // queriedFunders2.forEach(queriedFunder => { + // if(this.fundersMap.has(queriedFunder.id)) { + // this.fundersMap.get(queriedFunder.id).openAccessResearchProducts = +queriedFunder.number; + // } + // }); + // + // // 3rd call + // let queriedFunders3 = data[2][1][0].values; + // queriedFunders3.forEach(queriedFunder => { + // if(+queriedFunder.number > 1) { + // if (this.fundersMap.has(queriedFunder.id)) { + // this.fundersMap.get(queriedFunder.id).projects = +queriedFunder.number; + // } else { + // this.fundersMap.set(queriedFunder.id, { + // "id": queriedFunder.id, + // "name": queriedFunder.name, + // "alias": '', + // "researchProducts": 0, + // "openAccessResearchProducts": 0, + // "openAccessPercentage": 0, + // "projects": +queriedFunder.number, + // "monitorDashboard": '', + // "monitorDashboardStatus": '', + // "logoUrl": '' + // }); + // } + // } + // }); + // + // // 4th call + // let queriedFunders4 = data[3]; + // queriedFunders4.forEach(queriedFunder => { + // let id = queriedFunder.index_id + '||' + queriedFunder.index_name + '||' + queriedFunder.index_shortName; + // if(this.fundersMap.has(id) && ( + // !this.fundersMap.get(id).monitorDashboardStatus + // || + // (this.fundersMap.get(id).monitorDashboardStatus == "RESTRICTED" && queriedFunder.visibility == "PUBLIC") + // || + // (this.fundersMap.get(id).monitorDashboardStatus == "PRIVATE" && (queriedFunder.visibility == "RESTRICTED" || queriedFunder.visibility == "PUBLIC")))) { + // this.fundersMap.get(id).alias = queriedFunder.alias; + // this.fundersMap.get(id).monitorDashboard = queriedFunder.alias; + // this.fundersMap.get(id).monitorDashboardStatus = queriedFunder.visibility; + // this.fundersMap.get(id).logoUrl = (queriedFunder.isUpload ? properties.utilsService + "/download/" : "")+ (queriedFunder.logoUrl); + // } + // }); + // this.fundersMap.forEach((value) => { + // if(value.openAccessResearchProducts > 0) { + // value.openAccessPercentage = Math.round((value.openAccessResearchProducts / value.researchProducts) * 100); + // } + // if(!value.logoUrl && this.staticLogos.has(value.id)) { + // let split = value.id.split("||"); + // let shortname = (split && split.length==3) ? value.id.split("||")[2] : value.id; + // value.logoUrl = "assets/explore-assets/funders/logos/"+shortname+".png"; + // } + // }); + // // convert funders map into an array + // this.funders = Array.from(this.fundersMap.values()); + // // calculate total numbers for intro content + // this.calculateNumbers(); + // // sort funders + // this.funders.sort((a, b) => a['name'].localeCompare(b['name'])); + // // initialize displayedFunders + // this.displayedFunders = this.funders; + // console.log(this.funders); + // this.showLoading = false; + // }) + // ); } private calculateSum(array, property) { @@ -305,4 +362,12 @@ export class FundersComponent implements OnInit { this.currentPage = $event.value; HelperFunctions.scrollToId('target'); } + + private removePartAfterCharacters(field, characters):string { + if(field && field.indexOf(characters) !=-1){ + return field.split(characters)[0]; + + } + return field; + } } diff --git a/explore/src/app/funders/funders.module.ts b/explore/src/app/funders/funders.module.ts index c89e2d64..e95a5a5f 100644 --- a/explore/src/app/funders/funders.module.ts +++ b/explore/src/app/funders/funders.module.ts @@ -20,6 +20,7 @@ import {closed_access} from '../openaireLibrary/utils/icons/icons'; import {InputModule} from '../openaireLibrary/sharedComponents/input/input.module'; import {PagingModule} from '../openaireLibrary/utils/paging.module'; import {SearchInputModule} from '../openaireLibrary/sharedComponents/search-input/search-input.module'; +import {GroupedRequestsServiceModule} from "../openaireLibrary/services/groupedRequestsService.module"; @NgModule({ @@ -27,7 +28,7 @@ import {SearchInputModule} from '../openaireLibrary/sharedComponents/search-inpu FundersRoutingModule, CommonModule, RouterModule, AlertModalModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, LoadingModule, RefineFieldResultsServiceModule, LogoUrlPipeModule, IconsModule, InputModule, - PagingModule, SearchInputModule + PagingModule, SearchInputModule, GroupedRequestsServiceModule ], declarations: [ FundersComponent From 5b5000b2fe92be99923a96496a3e86b3cdf549d5 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 7 Feb 2024 23:06:52 +0200 Subject: [PATCH 5/7] Updating openaireLibrary --- explore/src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index b12877df..13727852 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit b12877df2a5fb4d9d136edec330b1c5c82e8eb34 +Subproject commit 137278522e0d3577b222dc6bab3dbc3842c013a0 From 1738dfcccc86c3212e09b881ac6e0d2b314d8af5 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 8 Feb 2024 12:40:48 +0200 Subject: [PATCH 6/7] Updating openaireLibrary --- explore/src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index 13727852..fbe514b7 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 137278522e0d3577b222dc6bab3dbc3842c013a0 +Subproject commit fbe514b74086c61dbfc3b8647b9eea458b34139d From 07681241c006225c67e1d771652afeaa8f2335a8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 8 Feb 2024 14:20:13 +0200 Subject: [PATCH 7/7] [develop | DONE | CHANGED]: contact.component.ts: Do not request page help contents (helptexts). --- explore/src/app/contact/contact.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore/src/app/contact/contact.component.ts b/explore/src/app/contact/contact.component.ts index 410d9a18..d421ce75 100644 --- a/explore/src/app/contact/contact.component.ts +++ b/explore/src/app/contact/contact.component.ts @@ -67,7 +67,7 @@ export class ContactComponent implements OnInit { this.updateTitle(this.pageTitle); this.updateDescription(this.description); this.reset(); - this.getPageContents(); + // this.getPageContents(); this.sending = false; }