From 7ccd9c625b82c5a955522388803ad5e6d1f12bfa Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 28 Dec 2023 15:41:17 +0200 Subject: [PATCH 01/15] [develop | DONE | FIXED]: searchAll.component.ts: Updated entitytype parameter to method "NewSearchPageComponent.createKeywordQuery()" for querying number of datasurces and services also by pid. --- searchPages/find/searchAll.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index 99900b63..c59d975a 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -444,7 +444,7 @@ export class SearchAllComponent { this.fetchDataproviders.results = []; this.reload["datasources"] = false; // this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams); - this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("datasources",this.keyword,"q","="):"", this.properties, refineParams).subscribe( + this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("dataprovider",this.keyword,"q","="):"", this.properties, refineParams).subscribe( data => { this.fetchDataproviders.searchUtils.totalResults = data; this.fetchDataproviders.searchUtils.status = this.errorCodes.DONE; @@ -463,7 +463,7 @@ export class SearchAllComponent { if (this.activeEntity != "services" && this.reload["services"] && this.showServices) { this.fetchServices.results = []; this.reload["services"] = false; - this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("datasources",this.keyword,"q","="):"", this.properties, refineParams, "services").subscribe( + this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("service",this.keyword,"q","="):"", this.properties, refineParams, "services").subscribe( data => { this.fetchServices.searchUtils.totalResults = data; this.fetchServices.searchUtils.status = this.errorCodes.DONE; From 84c2451521dc366224b23d8e27e149b449cdb77e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 28 Dec 2023 16:34:43 +0200 Subject: [PATCH 02/15] [develop | DONE | CHANGED]: dataProvider.component.html & project.component.html & resultLanding.component.html: Changed uk-flex-middle to uk-flex-top for .landing-metrics-card, after min-height was introduced. --- landingPages/dataProvider/dataProvider.component.html | 2 +- landingPages/project/project.component.html | 2 +- landingPages/result/resultLanding.component.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 569bc81f..59528c96 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -188,7 +188,7 @@
-
+
diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 241fd84d..1c0742a9 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -321,7 +321,7 @@
-
+
diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 7d6a9ccd..dc4e35d5 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -385,7 +385,7 @@
-
+
From 18325323d063eae2583ef3f940642ca67ed325ca Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 8 Jan 2024 14:04:18 +0200 Subject: [PATCH 03/15] [develop | DONE | CHANGED]: fos/fos.component.html & landing-utils/fos.component.ts & searchFields.base.ts: Removed "BETA" indication from Fields of Science. --- fos/fos.component.html | 6 +++--- landingPages/landing-utils/fos.component.ts | 4 ++-- utils/properties/searchFields.base.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fos/fos.component.html b/fos/fos.component.html index d4c076cf..d9635936 100644 --- a/fos/fos.component.html +++ b/fos/fos.component.html @@ -7,9 +7,9 @@
- - Beta - + + +

Fields of Science . diff --git a/landingPages/landing-utils/fos.component.ts b/landingPages/landing-utils/fos.component.ts index ba95bdc8..7b201015 100644 --- a/landingPages/landing-utils/fos.component.ts +++ b/landingPages/landing-utils/fos.component.ts @@ -7,7 +7,7 @@ import {StringUtils} from "../../utils/string-utils.class"; selector: 'fos', template: `
-
Beta
+
@@ -45,7 +45,7 @@ import {StringUtils} from "../../utils/string-utils.class";
-
Beta
+ {{title}}
diff --git a/utils/properties/searchFields.base.ts b/utils/properties/searchFields.base.ts index 67152fe6..335409be 100644 --- a/utils/properties/searchFields.base.ts +++ b/utils/properties/searchFields.base.ts @@ -271,7 +271,7 @@ export class SearchFieldsBase { filterType: "checkbox" }, ["fos"]: { - name: "Field of Science [Beta]", + name: "Field of Science", type: "vocabulary", param: "fos", operator: "fs", @@ -279,7 +279,7 @@ export class SearchFieldsBase { filterType: "checkbox" }, ["foslabel"]: { - name: "Field of Science [Beta]", + name: "Field of Science", type: "vocabulary", param: "foslabel", operator: "fl", From 6f13ab475a71fcc53f4eb70307ae8b60b20375f8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 8 Jan 2024 15:36:27 +0200 Subject: [PATCH 04/15] [develop | DONE | CHANGED]: Show code in Fields of Science (FoS) when fos field is queried in filters, or not, when foslabel field is queried. 1. searchFields.base.ts: Added method "getFosParameter()" to check if "fos" or "foslabel" is in RESULT_REFINE_FIELDS | Removed environment check for fos in RESULT_REFINE_FIELDS and RESULT_FIELDS_ORDERED. 2. resultLanding.service.ts & landing-utils/fos.component.ts & fos/fos.component: Include code in fos labels when fos field is queried, otherwise (foslabel) not. --- fos/fos.component.html | 4 ++-- fos/fos.component.ts | 4 +++- landingPages/landing-utils/fos.component.ts | 6 ++++-- landingPages/result/resultLanding.service.ts | 7 ++++++- utils/properties/searchFields.base.ts | 8 ++++++-- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/fos/fos.component.html b/fos/fos.component.html index d9635936..5121aa2f 100644 --- a/fos/fos.component.html +++ b/fos/fos.component.html @@ -113,7 +113,7 @@
@@ -139,7 +139,7 @@

diff --git a/fos/fos.component.ts b/fos/fos.component.ts index 043e7bd5..3065b2c0 100644 --- a/fos/fos.component.ts +++ b/fos/fos.component.ts @@ -15,6 +15,7 @@ import {PiwikService} from "../utils/piwik/piwik.service"; import {debounceTime, distinctUntilChanged} from "rxjs/operators"; import Timeout = NodeJS.Timeout; import {ISVocabulariesService} from "../utils/staticAutoComplete/ISVocabularies.service"; +import {SearchFields} from "../utils/properties/searchFields"; declare var UIkit; @@ -46,6 +47,7 @@ export class FosComponent implements OnInit, OnDestroy { private timeout: Timeout; @ViewChild('tabs') tabs: ElementRef; public sliderInit: boolean = false; + private searchFieldsHelper: SearchFields = new SearchFields(); constructor( private vocabulariesService: ISVocabulariesService, @@ -217,6 +219,6 @@ export class FosComponent implements OnInit, OnDestroy { public buildFosQueryParam(fos) { // return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; - return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); + return (this.searchFieldsHelper.getFosParameter() == 'foslabel' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); } } diff --git a/landingPages/landing-utils/fos.component.ts b/landingPages/landing-utils/fos.component.ts index 7b201015..e489cbd9 100644 --- a/landingPages/landing-utils/fos.component.ts +++ b/landingPages/landing-utils/fos.component.ts @@ -2,6 +2,7 @@ import {Component, EventEmitter, Input, Output} from "@angular/core"; import {RouterHelper} from "../../utils/routerHelper.class"; import {properties} from "../../../../environments/environment"; import {StringUtils} from "../../utils/string-utils.class"; +import {SearchFields} from "../../utils/properties/searchFields"; @Component({ selector: 'fos', @@ -96,6 +97,7 @@ export class FosComponent { public routerHelper: RouterHelper = new RouterHelper(); public properties = properties; public title: string = "Fields of Science"; + private searchFieldsHelper: SearchFields = new SearchFields(); public viewAllClick() { // if(this.subjects.length <= this.threshold*2) { @@ -122,11 +124,11 @@ export class FosComponent { public buildFosQueryParam(fos) { // return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; - return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); + return (this.searchFieldsHelper.getFosParameter() == 'foslabel' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); } public buildFosHrefParam(fos): string { // return ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)); - return (properties.environment !== 'production' ? ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)) : ('fos='+this.urlEncodeAndQuote(fos.id))); + return (this.searchFieldsHelper.getFosParameter() == 'foslabel' ? ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)) : ('fos='+this.urlEncodeAndQuote(fos.id))); } } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 7ed58bb0..df6e8745 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -9,6 +9,7 @@ import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/re import {Dates, Identifier, StringUtils} from "../../utils/string-utils.class"; import {properties} from "../../../../environments/environment"; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {SearchFields} from "../../utils/properties/searchFields"; @Injectable() export class ResultLandingService { @@ -312,9 +313,13 @@ export class ResultLandingService { this.resultLandingInfo.subjects = subjectResults[0]; this.resultLandingInfo.otherSubjects = subjectResults[1]; this.resultLandingInfo.classifiedSubjects = subjectResults[2]; + if (subjectResults[3]) { + let searchFieldsHelper: SearchFields = new SearchFields(); subjectResults[3].forEach(element => { - this.resultLandingInfo.fos.push({id: element, label: element.replace(/^\d+/, '').trim()}); + this.resultLandingInfo.fos.push( + {id: element, label: searchFieldsHelper.getFosParameter() == "foslabel" ? element.replace(/^\d+/, '').trim() : element} + ); }); } if (this.resultLandingInfo.fos) { diff --git a/utils/properties/searchFields.base.ts b/utils/properties/searchFields.base.ts index 335409be..3b4a19bd 100644 --- a/utils/properties/searchFields.base.ts +++ b/utils/properties/searchFields.base.ts @@ -16,7 +16,7 @@ export class SearchFieldsBase { // Remove Collected From Filter "collectedfrom","collectedfrom" public RESULT_REFINE_FIELDS = [ - "instancetypename", properties.environment!='production'?"foslabel":'fos', "relfunder", + "instancetypename", "foslabel", "relfunder", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"]; @@ -25,7 +25,7 @@ export class SearchFieldsBase { {type: "refine", title: "", values: ["instancetypename"]}, {type: "range", title: "", values: ["resultacceptanceyear", "resultacceptanceyear"]}, {type: "refine", title: "", values: [ - properties.environment!='production'?"foslabel":'fos', "relfunder", + "foslabel", "relfunder", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community" ]} @@ -885,6 +885,10 @@ export class SearchFieldsBase { } return "or"; } + + getFosParameter() { + return this.RESULT_REFINE_FIELDS.includes("foslabel") ? "foslabel" : "fos"; + } } export class FieldDetails { From c2312e297e32df2925e60641d755494c900abdc5 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Thu, 11 Jan 2024 12:49:57 +0200 Subject: [PATCH 05/15] [develop | DONE | FIXED] remove b2note (annotation component) and all its references --- .../annotation/annotation.component.ts | 225 ------------------ landingPages/annotation/annotation.css | 41 ---- landingPages/annotation/annotation.module.ts | 13 - landingPages/annotation/annotation.service.ts | 95 -------- .../result/resultLanding.component.ts | 1 - landingPages/result/resultLanding.module.ts | 3 +- 6 files changed, 1 insertion(+), 377 deletions(-) delete mode 100644 landingPages/annotation/annotation.component.ts delete mode 100644 landingPages/annotation/annotation.css delete mode 100644 landingPages/annotation/annotation.module.ts delete mode 100644 landingPages/annotation/annotation.service.ts diff --git a/landingPages/annotation/annotation.component.ts b/landingPages/annotation/annotation.component.ts deleted file mode 100644 index 90a26f9c..00000000 --- a/landingPages/annotation/annotation.component.ts +++ /dev/null @@ -1,225 +0,0 @@ -import { - Component, - ElementRef, - EventEmitter, - HostListener, - Input, - OnDestroy, - OnInit, - Output, - ViewChild -} from "@angular/core"; -import {Annotation, AnnotationService} from "./annotation.service"; -import {ResultLandingInfo} from "../../utils/entities/resultLandingInfo"; -import {EnvProperties} from "../../utils/properties/env-properties"; -import {properties} from "../../../../environments/environment"; -import {UserManagementService} from "../../services/user-management.service"; -import {COOKIE, Session, User} from "../../login/utils/helper.class"; -import {Subscriber} from "rxjs"; - -@Component({ - selector: 'b2note', - template: ` -
Annotations
-
-
- - - - -
- - -
- -
-
-
-
- - -
-
`, - styleUrls: ['annotation.css'] -}) -export class AnnotationComponent implements OnInit, OnDestroy { - - @Input() - public landingInfo: ResultLandingInfo = null; - @Input() - public id: string = null; - public properties: EnvProperties = properties; - public url: string = null; - public pid: string = null; - public keywords: string[] = []; - public visible: boolean = false; - public annotations: Annotation[] = []; - public annotationSize: number = 10; - public isLoggedIn: boolean = Session.isLoggedIn(); - public visibleAnnotations: number; - public loading: boolean = false; - public submitted: boolean = false; - @Output() - public pidEmitter: EventEmitter = new EventEmitter(); - @ViewChild('iframe') iframe: ElementRef; - @ViewChild('form') form: ElementRef; - private subscriptions: any[] = []; - - constructor(private annotationService: AnnotationService) { - } - - @HostListener('window:message', ['$event']) - public onChange(event) { - if (this.properties.b2noteAPIURL.includes(event.origin)) { - if (event.data === "B2NOTE loaded") { - let token = COOKIE.getCookie('AccessToken'); - this.iframe.nativeElement.contentWindow.postMessage({token: token}, this.properties.b2noteAPIURL); - } else { - this.getAnnotations(); - } - } - } - - ngOnInit(): void { - this.visibleAnnotations = this.annotationSize; - if (typeof window !== "undefined") { - let id = this.id; - this.url = window.location.href; - if (this.landingInfo.deletedByInferenceIds) { - id = this.landingInfo.deletedByInferenceIds[0]; - this.url = this.url.replace(this.id, id); - } - if (this.landingInfo.identifiers && this.landingInfo.identifiers.size > 0) { - if (this.landingInfo.identifiers.get('doi')) { - this.pid = this.landingInfo.identifiers.get('doi')[0]; - } else { - const key: string = this.landingInfo.identifiers.keys().next().value; - if (key) { - this.pid = this.landingInfo.identifiers.get(key)[0]; - } - } - } - if (this.pid) { - this.getAnnotations(); - } - this.pidEmitter.emit(this.pid); - } - } - - public get enabled(): boolean { - return this.pid && this.isLoggedIn; - } - - private clearSubscriptions() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscriber) { - subscription.unsubscribe(); - } - }); - this.subscriptions = []; - } - - private getAnnotations() { - if (!this.annotations || this.annotations.length === 0) { - this.loading = true; - } - this.subscriptions.push(this.annotationService.getAllAnnotations(this.pid).subscribe(annotations => { - this.annotations.forEach((annotation, index) => { - if (!annotations.find(element => element.type === annotation.type && element.text === annotation.text)) { - this.annotations.splice(index, 1); - } - }); - annotations.forEach(annotation => { - if (!this.annotations.find(element => element.type === annotation.type && element.text === annotation.text)) { - annotation.targetSize = 3; - this.annotationService.getAnnotationTargets(annotation.text, annotation.type).subscribe(targets => { - annotation.targets = targets.filter(target => target.id !== this.pid); - }); - this.annotations.push(annotation); - } - }); - this.annotations = this.sort(this.annotations); - this.loading = false; - }, error => { - this.loading = false; - })); - } - - public sort(annotations: Annotation[]): Annotation[] { - return annotations.sort((a, b) => { - if (a.type === b.type) { - return 1; - } else if (a.type === 'semantic') { - return -1; - } else if (b.type === 'semantic') { - return 1; - } else if (a.type === 'keyword') { - return -1; - } else if (b.type === 'keyword') { - return 1; - } - }); - } - - public searchPid(pid: string): { [k: string]: any; } { - return { - pid: pid - } - } - - ngOnDestroy() { - this.clearSubscriptions(); - } - - toggleAnnotation(event) { - if (this.visible) { - event.preventDefault(); - } else if(!this.submitted) { - this.form.nativeElement.submit(); - this.submitted = true; - } - this.visible = !this.visible; - } - - open(i: number) { - this.annotations.forEach((annotation, index) => { - if (index != i) { - annotation.targetSize = 3; - } else { - annotation.targetSize = annotation.targets.length - } - }); - } -} diff --git a/landingPages/annotation/annotation.css b/landingPages/annotation/annotation.css deleted file mode 100644 index 4a2961d3..00000000 --- a/landingPages/annotation/annotation.css +++ /dev/null @@ -1,41 +0,0 @@ -.widget-container { - position: fixed; - left: 50%; - top: 50%; - z-index: 1000; - padding: 19px; - margin-left: -167px; - margin-top: -311px; - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); - border: 1px solid #e3e3e3; - border-radius: 4px; - outline: 0; - min-height: 20px; - background-color: #f5f5f5; - cursor: move; -} - -.widget-container:hover, .widget-container:active{ - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.close { - float: right; - padding: 0; - cursor: pointer; - background: transparent; - border: 0; - font-size: 21px; - font-weight: bold; - opacity: 0.2; -} - -.b2note-iframe { - width: 100%; - height: 600px; - border: 1px solid #dddddd; -} diff --git a/landingPages/annotation/annotation.module.ts b/landingPages/annotation/annotation.module.ts deleted file mode 100644 index cca05c28..00000000 --- a/landingPages/annotation/annotation.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {NgModule} from "@angular/core"; -import {AnnotationComponent} from "./annotation.component"; -import {CommonModule} from "@angular/common"; -import {DragDropModule} from "@angular/cdk/drag-drop"; -import {RouterModule} from "@angular/router"; -import {LoadingModule} from "../../utils/loading/loading.module"; - -@NgModule({ - imports: [CommonModule, DragDropModule, RouterModule, LoadingModule], - declarations: [AnnotationComponent], - exports: [AnnotationComponent] -}) -export class AnnotationModule {} diff --git a/landingPages/annotation/annotation.service.ts b/landingPages/annotation/annotation.service.ts deleted file mode 100644 index 992f9044..00000000 --- a/landingPages/annotation/annotation.service.ts +++ /dev/null @@ -1,95 +0,0 @@ -import {Injectable} from "@angular/core"; -import {HttpClient} from "@angular/common/http"; -import {Observable} from "rxjs"; -import {EnvProperties} from "../../utils/properties/env-properties"; -import {map} from "rxjs/operators"; -import {properties} from "../../../../environments/environment"; - -export interface AnnotationTarget { - id: string; - url: string; -} - -export interface Annotation { - text: string; - type: 'semantic' | 'keyword' | 'comment'; - targets?: AnnotationTarget[]; - targetSize?: number; -} - -@Injectable({ - providedIn: "root" -}) -export class AnnotationService { - - api = 'api/'; - - constructor(private http: HttpClient) { - } - - getAllAnnotations(source: string): Observable { - let url = properties.b2noteAPIURL + this.api + 'annotations?target-id[]=' + encodeURIComponent(source); - return this.http.get(url).pipe(map((response: any[]) => { - return this.parseAnnotations(response); - })); - } - - getAnnotationTargets(value: string, type: 'semantic' | 'keyword' | 'comment'): Observable { - let url = properties.b2noteAPIURL + this.api + 'annotations?value=' + encodeURIComponent(value) + '&type[]=' + type; - return this.http.get(url).pipe(map((response: any[]) => { - return this.parseAnnotationTargets(response); - })); - } - - private parseAnnotations(response: any[]): Annotation[] { - let annotations: Annotation[] = []; - if (response && response.length > 0) { - response.forEach(value => { - if (value.visibility === 'public') { - let body = value.body; - if (body.type === 'TextualBody') { - if (body.purpose === 'tagging') { - annotations.push({ - text: body.value, - type: "keyword" - }); - } else { - annotations.push({ - text: body.value, - type: "comment" - }); - } - } else { - let items = body.items; - let text: string = null; - items.forEach(item => { - if (item.type === 'TextualBody') { - text = item.value; - } - }); - annotations.push({ - text: text, - type: "semantic" - }); - } - } - }); - } - return annotations; - } - - private parseAnnotationTargets(response: any[]): AnnotationTarget[] { - let targets: AnnotationTarget[] = []; - if (response && response.length > 0) { - response.forEach(value => { - if (value.visibility === 'public') { - targets.push({ - id: value.target.id, - url: value.target.source - }); - } - }); - } - return targets; - } -} diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index bc25c014..ad3d0311 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -134,7 +134,6 @@ export class ResultLandingComponent { public isLoggedIn: boolean = false; public pid: string; - // @ViewChild("annotation") annotation: AnnotationComponent; public contextsWithLink: any; public relatedClassFilters: Option[]=[{"label": "All relations", "value": ""}]; diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index 3803a598..247c8a99 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -20,7 +20,6 @@ import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {HelperModule} from "../../utils/helper/helper.module"; import {ResultLandingUtilsModule} from "../landing-utils/resultLandingUtils.module"; import {AlertModalModule} from "../../utils/modal/alertModal.module"; -import {AnnotationModule} from "../annotation/annotation.module"; import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module"; import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module"; import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module"; @@ -45,7 +44,7 @@ import {EntityActionsModule} from "../../utils/entity-actions/entity-actions.mod CiteThisModule, PagingModule, IFrameModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule, DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, - AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule, + LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule, OrcidModule, IconsModule, InputModule, EGIDataTransferModule, RecaptchaModule, SdgFosSuggestModule, FullScreenModalModule, SafeHtmlPipeModule, EntityActionsModule ], From c06d020cdcebbaeeb6130e163d37864e3d73a00e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 12 Jan 2024 13:59:58 +0200 Subject: [PATCH 06/15] [develop | DONE | CHANGED]: ISVocabularies.service.ts: Updated method "parseFOS()" to parse all Fields of Science by visiting hierarchy from fos.json using an iterative DFS (Depth First Search), instead of looping each level - this does not depend on the number of levels specified in the vocabulary file. --- .../ISVocabularies.service.ts | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/utils/staticAutoComplete/ISVocabularies.service.ts b/utils/staticAutoComplete/ISVocabularies.service.ts index 074afa4e..7a880f44 100644 --- a/utils/staticAutoComplete/ISVocabularies.service.ts +++ b/utils/staticAutoComplete/ISVocabularies.service.ts @@ -143,28 +143,49 @@ export class ISVocabulariesService { parseFOS(data: any): AutoCompleteValue[] { let array: AutoCompleteValue[] = [] - for (let fos of data) { + let children = data.reverse(); + while(children && children.length > 0) { + let fos = children.pop(); let value: AutoCompleteValue = new AutoCompleteValue(); value.id = fos.id;//data[i].code; value.label = fos.label; array.push(value); - if(fos.children) { - for (let fos2 of fos.children) { - let value: AutoCompleteValue = new AutoCompleteValue(); - value.id = fos2.id;//data[i].code; - value.label = fos2.label; - array.push(value); - if(fos2.children) { - for (let fos3 of fos2.children) { - let value: AutoCompleteValue = new AutoCompleteValue(); - value.id = fos3.id;//data[i].code; - value.label = fos3.label; - array.push(value); - } - } + if(fos.children && fos.children.length > 0) { + for (let i=fos.children.length-1; i>=0; i--) { + children.push(fos.children[i]); } } } + // for (let fos of data) { + // let value: AutoCompleteValue = new AutoCompleteValue(); + // value.id = fos.id;//data[i].code; + // value.label = fos.label; + // array.push(value); + // if(fos.children) { + // for (let fos2 of fos.children) { + // let value: AutoCompleteValue = new AutoCompleteValue(); + // value.id = fos2.id;//data[i].code; + // value.label = fos2.label; + // array.push(value); + // if(fos2.children) { + // for (let fos3 of fos2.children) { + // let value: AutoCompleteValue = new AutoCompleteValue(); + // value.id = fos3.id;//data[i].code; + // value.label = fos3.label; + // array.push(value); + // // if(fos3.children) { + // // for (let fos4 of fos3.children) { + // // let value: AutoCompleteValue = new AutoCompleteValue(); + // // value.id = fos4.id;//data[i].code; + // // value.label = fos4.label; + // // array.push(value); + // // } + // // } + // } + // } + // } + // } + // } return array; } From 5699aed59942a94e0d004023a09bc7994458cfe9 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Wed, 17 Jan 2024 11:16:06 +0200 Subject: [PATCH 07/15] [develop | DONE | FIXED] linking: stack elements on mobile to avoid page breaking --- .../claimResultSearchForm.component.html | 24 ++++++++++--------- claims/linking/linkingGeneric.component.html | 14 +++++------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/claims/claim-utils/claimResultSearchForm.component.html b/claims/claim-utils/claimResultSearchForm.component.html index b2e66b11..fe0ab300 100644 --- a/claims/claim-utils/claimResultSearchForm.component.html +++ b/claims/claim-utils/claimResultSearchForm.component.html @@ -1,14 +1,16 @@ -
- -
-
-
-
-
-
+
+
+ +
+
+
+
+
+
+
diff --git a/claims/linking/linkingGeneric.component.html b/claims/linking/linkingGeneric.component.html index 7f394dd2..16cb04bf 100644 --- a/claims/linking/linkingGeneric.component.html +++ b/claims/linking/linkingGeneric.component.html @@ -73,11 +73,11 @@
-
+
-
+
-
+

Link source to

-
+
-
+
Source
@@ -145,7 +145,7 @@
-
+
-
+
From 43ceb9f266bfb538c003e8dc760c6bbe0188cce3 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 24 Jan 2024 12:14:40 +0200 Subject: [PATCH 08/15] [develop | DONE | CHANGED] claims: disable result link when status is pending --- .../claim-utils/displayClaims/displayClaims.component.html | 2 +- .../entityFormatter/claimEntityFormatter.component.ts | 3 ++- .../entityFormatter/publicationTitleFormatter.component.ts | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index 2c5dd4eb..bdcc74b3 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -63,7 +63,7 @@
+ [externalPortalUrl]=externalPortalUrl [source]="true" [linkAvailable]="isClaimAvailable(claim)">
Link to: + path="/search/result" [externalPortalUrl]=externalPortalUrl [linkAvailable]="linkAvailable">

{{entity.title?entity.title:"[No title available]"}} - {{entity.title?entity.title:"[No title available]"}} + [routerLink]="path" class="uk-link uk-link-heading" [class.uk-disabled]="!linkAvailable">{{entity.title?entity.title:"[No title available]"}} + {{entity.title?entity.title:"[No title available]"}}

@@ -23,5 +23,6 @@ export class PublicationTitleFormatter { @Input() path: string; @Input() entity: any; @Input() externalPortalUrl: string = null; + @Input() linkAvailable: boolean = true; public routerHelper: RouterHelper = new RouterHelper(); } From e176169afd25ce613631a5c7ca7a45eb7cfbb4e7 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 24 Jan 2024 14:36:12 +0200 Subject: [PATCH 09/15] [develop]: Fix some properties values --- utils/properties/environments/environment.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/utils/properties/environments/environment.ts b/utils/properties/environments/environment.ts index 1bef13a0..32510803 100644 --- a/utils/properties/environments/environment.ts +++ b/utils/properties/environments/environment.ts @@ -10,7 +10,7 @@ export let common: EnvProperties = { searchOrcidURL: "https://pub.orcid.org/v2.1/", orcidURL: "https://orcid.org/", orcidAPIURL: "https://services.openaire.eu/uoa-orcid-service/", - orcidTokenURL : "https://orcid.org/oauth/authorize?", + orcidTokenURL: "https://orcid.org/oauth/authorize?", orcidClientId: "APP-IN0O56SBVVTB7NN4", doiURL: "https://doi.org/", pmcURL: "http://europepmc.org/articles/", @@ -33,7 +33,7 @@ export let common: EnvProperties = { csvLimit: 2000, pagingLimit: 20, resultsPerPage: 10, - baseLink : "", + baseLink: "", searchLinkToResult: "/search/result?id=", searchLinkToPublication: "/search/publication?articleId=", searchLinkToProject: "/search/project?projectId=", @@ -79,22 +79,19 @@ export let common: EnvProperties = { footerGrantText: "OpenAIRE has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No. 777541 and 101017452", //connect - enermapsURL:"https://lab.idiap.ch/enermaps", + enermapsURL: "https://lab.idiap.ch/enermaps", zenodoCommunities: 'https://zenodo.org/api/communities', shareInZenodoPage: '/participate/deposit/zenodo', afterLoginRedirectLink: '/myCommunities', searchLinkToCommunities: '/search/find/communities', - - - } export let commonDev: EnvProperties = { environment: "development", pdfStatisticsAPIURL: "https://beta.services.openaire.eu/pdf-stats", - statisticsAPIURL: "http://vatopedi.di.uoa.gr:8080/stats/", + statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/", statisticsFrameAPIURL: "https://beta.openaire.eu/stats/", - statisticsFrameNewAPIURL: "https://stats.madgik.di.uoa.gr/stats-api/", + statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/", claimsAPIURL: "http://scoobydoo.di.uoa.gr:8880/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/", searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/", searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", @@ -102,7 +99,7 @@ export let commonDev: EnvProperties = { openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=", csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports", orcidAPIURL: "http://duffy.di.uoa.gr:19480/uoa-orcid-service/", - orcidTokenURL : "https://sandbox.orcid.org/oauth/authorize?", + orcidTokenURL: "https://sandbox.orcid.org/oauth/authorize?", orcidClientId: "APP-A5M3KTX6NCN67L91", utilsService: "http://dl170.madgik.di.uoa.gr:8000", vocabulariesAPI: "https://dev-openaire.d4science.org/provision/mvc/vocabularies/", @@ -117,7 +114,7 @@ export let commonDev: EnvProperties = { datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/", contextsAPI: "https://dev-openaire.d4science.org/openaire/context", communityAPI: "https://dev-openaire.d4science.org/openaire/community/", - lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows", + lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows", widgetLink: "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=", claimsInformationLink: "https://www.openaire.eu/linking-beta", indexInfoAPI: "https://beta.services.openaire.eu/openaire/info/", @@ -208,7 +205,7 @@ export let commonBeta: EnvProperties = { export let commonProd: EnvProperties = { environment: "production", pdfStatisticsAPIURL: "https://services.openaire.eu/pdf-stats", - statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/", + statisticsAPIURL: "https://services.openaire.eu/stats-api/", statisticsFrameAPIURL: "https://www.openaire.eu/stats/", statisticsFrameNewAPIURL: "https://services.openaire.eu/stats-tool/", claimsAPIURL: "https://services.openaire.eu/claims-new/rest/claimsService/", From 0a47193bf3f63d0660dbe1e88048bce0de0d5a63 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 24 Jan 2024 17:03:15 +0200 Subject: [PATCH 10/15] [develop | DONE | FIXED]: searchResearchResults.service.ts & resultLanding.service.ts & deletedByInference.service.ts: #9425 - When an author (same name & rank) has 2 instances on the same record, keep orcid information if exists in at least one instance. --- .../deletedByInference/deletedByInference.service.ts | 9 +++++++++ landingPages/result/resultLanding.service.ts | 9 +++++++++ services/searchResearchResults.service.ts | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/landingPages/result/deletedByInference/deletedByInference.service.ts b/landingPages/result/deletedByInference/deletedByInference.service.ts index 41d6e312..5b812e8f 100644 --- a/landingPages/result/deletedByInference/deletedByInference.service.ts +++ b/landingPages/result/deletedByInference/deletedByInference.service.ts @@ -145,6 +145,15 @@ export class DeletedByInferenceService { if(author.orcid_pending) { author.orcid_pending = author.orcid_pending.toUpperCase(); } + + if(result['authors'][author.rank] && results['authors'][author.rank].fullName == author.content) { + if(!author.orcid && result['authors'][author.rank].orcid) { + author.orcid = result['authors'][author.rank].orcid; + } else if(!author.orcid_pending && result['authors'][author.rank].orcid_pending) { + author.orcid_pending = result['authors'][author.rank].orcid_pending; + } + } + result['authors'][author.rank] = {"fullName": author.content, "orcid": author.orcid, "orcid_pending": author.orcid_pending}; } } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index df6e8745..d0f7060c 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -381,6 +381,15 @@ export class ResultLandingService { if (author.orcid_pending) { author.orcid_pending = author.orcid_pending.toUpperCase(); } + + if(this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.content) { + if(!author.orcid && this.resultLandingInfo['authors'][author.rank].orcid) { + author.orcid = this.resultLandingInfo['authors'][author.rank].orcid; + } else if(!author.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) { + author.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending; + } + } + this.resultLandingInfo['authors'][author.rank] = { "fullName": author.content, "orcid": author.orcid, diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 4c76bf90..62329217 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -348,6 +348,15 @@ export class SearchResearchResultsService { if (author.orcid_pending) { author.orcid_pending = author.orcid_pending.toUpperCase(); } + + if(result['authors'][author.rank] && result['authors'][author.rank].fullName == author.content) { + if(!author.orcid && result['authors'][author.rank].orcid) { + author.orcid = result['authors'][author.rank].orcid; + } else if(!author.orcid_pending && result['authors'][author.rank].orcid_pending) { + author.orcid_pending = result['authors'][author.rank].orcid_pending; + } + } + result['authors'][author.rank] = { "fullName": author.content, "orcid": author.orcid, From 1e41013e069ada9421c7bb28aa5e662fdbe4eb2c Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 25 Jan 2024 12:31:14 +0200 Subject: [PATCH 11/15] [develop | DONE | CHANGED]: showSubjects.components.ts: Removed subjects by Vocabulary for BETA & DEV environments & Updated how EOSC subjects are displayed | resultLanding.component: Added get method "hasSubjects" and updated checks to show subjects depending on environment. --- .../landing-utils/showSubjects.component.ts | 29 +++++++++++++++---- .../result/resultLanding.component.html | 8 ++--- .../result/resultLanding.component.ts | 4 +++ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/landingPages/landing-utils/showSubjects.component.ts b/landingPages/landing-utils/showSubjects.component.ts index 31767075..df8255bd 100644 --- a/landingPages/landing-utils/showSubjects.component.ts +++ b/landingPages/landing-utils/showSubjects.component.ts @@ -13,7 +13,7 @@ import {properties} from "../../../../environments/environment"; @Component({ selector: 'showSubjects', template: ` - +
Subjects by Vocabulary
@@ -22,10 +22,11 @@ import {properties} from "../../../../environments/environment"; -
+ -
+
Keywords
@@ -33,6 +34,16 @@ import {properties} from "../../../../environments/environment"; View all
+ + +
+ EOSC Subjects +
+
+ +
+
@@ -78,7 +89,7 @@ import {properties} from "../../../../environments/environment";
-

+

@@ -91,13 +102,17 @@ import {properties} from "../../../../environments/environment";

+ +

+ {{getValue(eoscSubjects).join(', ')}} +

- +
` @@ -234,4 +249,8 @@ export class ShowSubjectsComponent { this.openSubjectsByVocabularyModal(); } } + + getValue(eosSubjects) { + return eosSubjects.map(res => res.value); + } } diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index dc4e35d5..d102c511 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -283,7 +283,7 @@ - - + @@ -549,7 +549,7 @@

- +
Subjects @@ -736,7 +736,7 @@ + *ngIf="hasSubjects"> diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index ad3d0311..b25b77e5 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -1171,6 +1171,10 @@ export class ResultLandingComponent { return "Not available access"; } + public get hasSubjects(): boolean { + return !!(this.resultLandingInfo.subjects || this.resultLandingInfo.otherSubjects || (this.resultLandingInfo.classifiedSubjects && this.properties.environment == 'production') || this.resultLandingInfo.eoscSubjects); + } + public getEoscParams() { let params = ""; if(this.prevPath) { From fa216cbc0755e588f9ca12d3a6770d9a24a6035f Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 25 Jan 2024 12:33:50 +0200 Subject: [PATCH 12/15] [develop | DONE | CHANGED]: availableOn.component.ts: Removed environment check from fulltext links (display them also in production). --- landingPages/landing-utils/availableOn.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 336d0c75..05bfb6cd 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -14,7 +14,7 @@ import {RouterHelper} from "../../utils/routerHelper.class";
- -
+
Full-Text: From 5a23f6437d4f5348f6ac92a68336d9fb958708e4 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 29 Jan 2024 19:53:11 +0200 Subject: [PATCH 13/15] [develop | DONE | FIXED]: project.component.ts: In method "closeLoading()" added setTimeout of 300ms - too fast open and close of the loading modal and it couldn't close eventually. --- landingPages/project/project.component.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 4e7eb8ba..bbf26740 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -897,9 +897,11 @@ export class ProjectComponent { } private closeLoading() { - if (this.loading) { - this.loading.close(); - } + setTimeout(() => { + if (this.loading) { + this.loading.close(); + } + }, 300) } private setMessageLoading(message: string) { From 6b5b7df8be8bf141b3f0e50a7063efbcd51d4af6 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 29 Jan 2024 19:55:26 +0200 Subject: [PATCH 14/15] [develop | DONE | DELETED]: Deleted legacy unused files mailPrefs.component.html, mailPrefs.component.ts, mailPrefs.module.ts, htmlProjectReport.component.ts, htmlProjectReport.module.ts. --- .../mailPrefs.component.html | 55 ---- .../mailPrefs.component.ts | 259 --------------- .../userEmailPreferences/mailsPrefs.module.ts | 23 -- .../htmlProjectReport.component.ts | 302 ------------------ .../htmlProjectReport.module.ts | 30 -- 5 files changed, 669 deletions(-) delete mode 100644 connect/userEmailPreferences/mailPrefs.component.html delete mode 100644 connect/userEmailPreferences/mailPrefs.component.ts delete mode 100644 connect/userEmailPreferences/mailsPrefs.module.ts delete mode 100644 landingPages/htmlProjectReport/htmlProjectReport.component.ts delete mode 100644 landingPages/htmlProjectReport/htmlProjectReport.module.ts diff --git a/connect/userEmailPreferences/mailPrefs.component.html b/connect/userEmailPreferences/mailPrefs.component.html deleted file mode 100644 index 4bbe55a2..00000000 --- a/connect/userEmailPreferences/mailPrefs.component.html +++ /dev/null @@ -1,55 +0,0 @@ - -
-
- User Email Preferences for Claims Notifications -
- - - - - - -
- - -
- -
-
Notify - for new user links:
- - -
- -
-
Frequency:
-
- -
-
- -
- - -
- -
- -
- - - -
- diff --git a/connect/userEmailPreferences/mailPrefs.component.ts b/connect/userEmailPreferences/mailPrefs.component.ts deleted file mode 100644 index 6243387f..00000000 --- a/connect/userEmailPreferences/mailPrefs.component.ts +++ /dev/null @@ -1,259 +0,0 @@ -import {Component, Input} from '@angular/core'; -import {Location} from '@angular/common'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Session} from '../../login/utils/helper.class'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import {MailPrefsService} from './mailPrefs.service'; -import {ConnectHelper} from '../connectHelper'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {ErrorMessagesComponent} from '../../utils/errorMessages.component'; -import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; -import {properties} from "../../../../environments/environment"; -import {Subscriber} from "rxjs"; - -declare var UIkit: any; - -@Component({ - selector: 'mailPrefs', - templateUrl: 'mailPrefs.component.html', - providers:[MailPrefsService] - -}) -export class MailPrefsComponent { - properties:EnvProperties; - subscriptions = []; - @Input() communityId: string; - public preferencesFor: string = "community"; - public status: number; - - public notifications = []; - public initialNotifications = []; - public prefsChanged = {}; - public hidden: boolean = true; - - //public showForbiddenMessage:boolean = false; - public userValidMessage:string = ""; - public savedMessage: string = ""; - - private errorCodes: ErrorCodes; - private errorMessages: ErrorMessagesComponent; - - @Input() showSaveResetButtons: boolean = true; - - constructor (private _mailPrefsService: MailPrefsService, private route: ActivatedRoute, private _router:Router, private location: Location) { - this.errorCodes = new ErrorCodes(); - this.errorMessages = new ErrorMessagesComponent(); - this.status = this.errorCodes.LOADING; - } - - ngOnInit() { - this.properties = properties; - this.subscriptions.push(this.route.params.subscribe(params => { - this.hidden = true; - console.debug(this.communityId); - if(!this.communityId){ - this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); - } - if(!this.communityId) { - this.communityId = params['community']; - } - console.debug(this.communityId, params) - this.getEmailPreferences(); - })); - - - } - - getEmailPreferences() { - if(!Session.isLoggedIn()){ - //this.userValidMessage = "User session has expired. Please login again."; - if(this.showSaveResetButtons) { - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } - } else { - this.status = this.errorCodes.LOADING; - this.savedMessage = ""; - - if(this.communityId && this.communityId != "openaire") { - this.preferencesFor = "community"; - this.subscriptions.push(this._mailPrefsService.getUserEmailPreferencesForCommunity(this.communityId, this.properties.claimsAPIURL).subscribe( - data => { - if(data.code == "204") { - this.status = this.errorCodes.NONE; - this.initialNotifications = [{notify: true, frequency:24, openaireId: this.communityId}]; - } else { - this.initialNotifications = data.data; - } - this.notifications = JSON.parse(JSON.stringify( this.initialNotifications )); - - this.status = this.errorCodes.DONE; - this.hidden = false; - - }, - err => { - this.hidden = false; - this.handleErrors(err); - this.handleError("Error getting user email preferences for community with id: "+this.communityId, err); - } - )); - } else { - this.preferencesFor = "project"; - this.subscriptions.push(this._mailPrefsService.getUserEmailPreferencesForOpenaire(this.properties.claimsAPIURL).subscribe( - data => { - - if(data.code == "204") { - this.status = this.errorCodes.NONE; - } else { - - this.initialNotifications = data.data; - this.notifications = JSON.parse(JSON.stringify( this.initialNotifications )); - //this.notifications = this.initialNotifications.map(x => Object.assign({}, x)); - //this.notifications = this.initialNotifications; - - this.status = this.errorCodes.DONE; - } - }, - err => { - //console.info(err); - this.handleErrors(err); - this.handleError("Error getting user email preferences for openaire", err); - } - )); - } - } - } - - changeNotify(notification: any, checked: boolean, index: number) { - if(!Session.isLoggedIn()){ - //this.userValidMessage = "User session has expired. Please login again."; - if(this.showSaveResetButtons) { - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } - } else { - this.savedMessage = ""; - this.status = this.errorCodes.DONE; - notification.notify = checked; - this.prefsChanged[index] = true; - } - } - - changeFrequency(index: number) { - if(!Session.isLoggedIn()){ - //this.userValidMessage = "User session has expired. Please login again."; - if(this.showSaveResetButtons) { - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } - } else { - this.savedMessage = ""; - this.status = this.errorCodes.DONE; - if(this.initialNotifications[index].frequency != this.notifications[index].frequency) { - this.prefsChanged[index] = true; - } - } - } - - saveNotification(index: number) { - if(this.notifications.length > 0 && this.initialNotifications.length > 0) { - if(!Session.isLoggedIn()){ - //this.userValidMessage = "User session has expired. Please login again."; - if(this.showSaveResetButtons) { - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } - } else { - if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) { - - this.status = this.errorCodes.LOADING; - this.savedMessage = ""; - - this.subscriptions.push(this._mailPrefsService.saveUserEmailPreferences(this.notifications[index], this.properties.claimsAPIURL).subscribe( - data => { - this.initialNotifications[index] = JSON.parse(JSON.stringify( this.notifications[index] )); - - this.status = this.errorCodes.DONE; - - /*UIkit.notification({ - message : 'Your email preferences for '+this.notifications[index].openaireName+' have been successfully changed', - status : 'success', - timeout : 3000, - pos : 'top-center' - });*/ - this.savedMessage = "Notification settings for claims saved!"; - }, - err => { - //console.log(err); - this.handleError("Error saving user email preferences: "+JSON.stringify(this.notifications[index]), err); - this.status = this.errorCodes.NOT_SAVED; - } - )); - } - else { - /*UIkit.notification({ - message : 'No changes selected for '+this.notifications[index].openaireName+' email preferences', - status : 'primary', - timeout : 3000, - pos : 'top-center' - });*/ - this.savedMessage = "Notification settings for claims saved!"; - } - } - } - } - - restoreNotification(index: number) { - if(!Session.isLoggedIn()){ - //this.userValidMessage = "User session has expired. Please login again."; - if(this.showSaveResetButtons) { - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } - } else { - if(this.notifications.length > 0 && this.initialNotifications.length > 0) { - this.status = this.errorCodes.LOADING; - this.savedMessage = ""; - this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] )); - this.status = this.errorCodes.DONE; - this.prefsChanged[index] = false; - } - } - } - /* - prefsChanged(index: number) : boolean { - if(this.notifications.length > 0 && this.initialNotifications.length > 0) { - if(JSON.stringify(this.notifications[index]) != JSON.stringify(this.initialNotifications[index])) { - return true; - } - } - return false; - } - */ - ngOnDestroy() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscriber) { - subscription.unsubscribe(); - } - }); - } - - - handleErrors(err){ - //this.showErrorMessage = true; - //try{ - var code = ""; - if(!err.status) { - var error = err.json(); - code = error.code; - } else { - code = err.status; - } - this.status = this.errorMessages.getErrorCode(code); - } - - private handleError(message: string, error) { - console.error("User mail notification preferences Page (for claims): "+message, error); - } - - - //}catch (e) { - //console.log("Couldn't parse answer as json") - //this.showErrorMessage = true; - //} -} diff --git a/connect/userEmailPreferences/mailsPrefs.module.ts b/connect/userEmailPreferences/mailsPrefs.module.ts deleted file mode 100644 index f670212e..00000000 --- a/connect/userEmailPreferences/mailsPrefs.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; - -import { MailPrefsComponent } from './mailPrefs.component'; -import { MailPrefsService } from './mailPrefs.service'; -import {ErrorMessagesModule} from '../../utils/errorMessages.module'; -import { MatSlideToggleModule } from '@angular/material/slide-toggle'; - -@NgModule({ - imports: [ - CommonModule, RouterModule, FormsModule, ReactiveFormsModule, ErrorMessagesModule, MatSlideToggleModule - ], - declarations: [ - MailPrefsComponent - ], - providers:[MailPrefsService], - exports: [ - MailPrefsComponent - ] -}) -export class MailPrefsModule { } diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts deleted file mode 100644 index b17c82c5..00000000 --- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ /dev/null @@ -1,302 +0,0 @@ -import {Component, Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Meta, Title} from '@angular/platform-browser'; - -import {EnvProperties} from '../../utils/properties/env-properties'; - -import {HtmlProjectReportService} from './htmlProjectReport.service'; -import {ProjectService} from '../project/project.service'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import {SEOService} from '../../sharedComponents/SEO/SEO.service'; -import {HelperService} from "../../utils/helper/helper.service"; -import {Subscriber} from "rxjs"; -import {properties} from "../../../../environments/environment"; - -declare var UIkit: any; - -@Component({ - selector: 'htmlProjectReport', - template: ` -
-
-
- -
- - - -
-
{{header1}}
-
{{header2}}
- -
- -
- -
- - -
-
- -
-
-
- - ` -}) -export class HtmlProjectReportComponent { - @Input() communityId = null; - private projectId: string; - private totalResults: number = 10; - private resultsType: string = "publication"; - - public header1: string = ""; - public header2: string = ""; - public htmlResult: string = ""; - - subscriptions = []; - - public warningMessage: string = ""; - public errorMessage: string = ""; - public showLoading: boolean = true; - properties: EnvProperties; - public pageContents = null; - public divContents = null; - - constructor(private route: ActivatedRoute, - private htmlService: HtmlProjectReportService, - private _piwikService: PiwikService, - private _projectService: ProjectService, - private _meta: Meta, - private _title: Title, - private _router: Router, - private helper: HelperService, - private seoService: SEOService) { - } - - ngOnInit() { - - this.properties = properties; - //this.getDivContents(); - this.getPageContents(); - this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url); - this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url); - - - this.subscriptions.push(this.route.queryParams.subscribe(params => { - this.projectId = params['projectId']; - - if (params['size'] == parseInt(params['size'], 10)) { - this.totalResults = params['size']; - } else { - this.showLoading = false; - this.warningMessage = "Requested size is not an integer"; - } - - if (params['type'] && (params['type'] == "publication" || params['type'] == "dataset" || params['type'] == "software" || params['type'] == "other")) { - if (params['type'] == "publication") { - this.resultsType = 'publication'; - } else if (params['type'] == "dataset") { - this.resultsType = 'research data'; - } else if (params['type'] == "software") { - this.resultsType = 'software'; - } else if (params['type'] == "other") { - this.resultsType = "other research product"; - } - - var title = "Project's " + this.resultsType + " report"; - var description = "project, project " + this.resultsType + " report, funding, open access, publications, research data, software, other research products"; - this.updateTitle(title); - this.updateDescription(description); - - - } else { - this.showLoading = false; - this.warningMessage = "Requested type should be publication or research data or software or other research product"; - } - - //showLoading is true if no warnings - if (this.showLoading) { - if (this.projectId) { - this.createHeaders(); - } else { - this.showLoading = false; - this.warningMessage = "No valid project id"; - } - } - })); - } - - private getPageContents() { - if(this.communityId) { - this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { - this.pageContents = contents; - })); - } - } - - private getDivContents() { - if(this.communityId) { - this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { - this.divContents = contents; - })); - } - } - - ngOnDestroy() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscriber) { - subscription.unsubscribe(); - } - }); - } - - private createHeaders() { - this.subscriptions.push(this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe( - data => { - this.createHeader1(data); - if (data.acronym) { - this.updateTitle(data.acronym + " " + this.resultsType + " report"); - } else if (data.title) { - this.updateTitle(data.title + " " + this.resultsType + " report"); - } - this.subscriptions.push(this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report").subscribe()); - }, - err => { - this.handleError("Error getting html information for project id: " + this.projectId, err); - //console.log(err); - this.createClipboard(); - } - )); - - if (this.resultsType == "publication") { - this.header2 += this.totalResults.toLocaleString('en-US') + " publications"; - } else if (this.resultsType == "research data") { - this.header2 += this.totalResults.toLocaleString('en-US') + " research data"; - } else if (this.resultsType == "software") { - this.header2 += this.totalResults.toLocaleString('en-US') + " software"; - } else if (this.resultsType == "other research product") { - this.header2 += this.totalResults.toLocaleString('en-US') + " other"; - } - } - - private createClipboard() { - let intro: string = ''; - intro += ''; - intro += ''; - intro += '' + this.header1 + '' - intro += ''; - - if (typeof window !== 'undefined') { - this.subscriptions.push(this.htmlService.getHTML(this.projectId, this.resultsType, this.properties.csvAPIURL).subscribe( - data => { - //let body: string = intro+'

'+this.header1+'

'+this.header2+'

'+data+''; - let body: string = intro + '

' + this.header1 + '

' + this.header2 + '

'; - body += "" + data + "
TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
"; - body += ''; - - //this.htmlResult = data; - this.htmlResult = "" + data + "
TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
"; - - let clipboard; - let Clipboard; - Clipboard = require('clipboard'); - clipboard = new Clipboard('.clipBtn', { - /*target: function(trigger) { - return document.getElementById("clipboard"); - }*/ - text: function (trigger) { - return body;//document.getElementById("clipboard").getAttribute('innerHTML');//"aaaa"+tmp+"oo"; - } - }); - - this.showLoading = false; - }, - err => { - //console.log(err); - this.handleError("Error getting html for id: " + this.projectId, err); - - this.errorMessage = 'Service not available'; - this.showLoading = false; - } - )); - } - } - - createHeader1(data: { "title": string, "acronym": string, "callIdentifier": string }) { - if (this.resultsType == "publication") { - this.header1 += "Publications"; - } else if (this.resultsType == "research data") { - this.header1 += "Research Data"; - } else if (this.resultsType == "software") { - this.header1 += "Software"; - } else if (this.resultsType == "other research product") { - this.header1 += "Other Research Products"; - } - - if (data != undefined) { - if (data.title != undefined && data.title != "") { - this.header1 += data.title; - } - if ((data.title != undefined && data.title != "") && - ((data.acronym != undefined && data.acronym != "") || - (data.callIdentifier != undefined && data.callIdentifier != ""))) { - this.header1 += "("; - } - if (data.acronym != undefined && data.acronym != "") { - this.header1 += data.acronym + " - "; - } - if (data.callIdentifier != undefined && data.callIdentifier != "") { - this.header1 += data.callIdentifier; - } - if ((data.title != undefined && data.title != "") && - ((data.acronym != undefined && data.acronym != "") || - (data.callIdentifier != undefined && data.callIdentifier != ""))) { - this.header1 += ")"; - } - } - - this.createClipboard(); - } - - public copied() { - UIkit.notification({ - message: 'Raw html is copied. Please paste it on an html file.', - status: 'success', - timeout: 3000, - pos: 'top-center' - }); - } - - private updateDescription(description: string) { - this._meta.updateTag({content: description}, "name='description'"); - this._meta.updateTag({content: description}, "property='og:description'"); - } - - private updateTitle(title: string) { - var _prefix = ""; - if(!this.communityId) { - _prefix = "OpenAIRE | "; - } - var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); - this._title.setTitle(_title); - this._meta.updateTag({content: _title}, "property='og:title'"); - } - - private updateUrl(url: string) { - this._meta.updateTag({content: url}, "property='og:url'"); - } - - private handleError(message: string, error) { - console.error("Html Project Report Page: " + message, error); - } -} diff --git a/landingPages/htmlProjectReport/htmlProjectReport.module.ts b/landingPages/htmlProjectReport/htmlProjectReport.module.ts deleted file mode 100644 index f80a1974..00000000 --- a/landingPages/htmlProjectReport/htmlProjectReport.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -//import {MaterialModule} from '@angular/material'; -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { ProjectServiceModule} from '../project/projectService.module'; - - -import {HtmlProjectReportService} from './htmlProjectReport.service'; -import {HtmlProjectReportComponent} from './htmlProjectReport.component'; -import {PiwikServiceModule} from '../../utils/piwik/piwikService.module'; -import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; -import {HelperModule} from "../../utils/helper/helper.module"; -import {RouterModule} from '@angular/router'; - -@NgModule({ - imports: [ - CommonModule, FormsModule, ProjectServiceModule, PiwikServiceModule, SEOServiceModule, HelperModule, - RouterModule - ], - declarations: [ - HtmlProjectReportComponent - ], - providers:[ - HtmlProjectReportService - ], - exports: [ - HtmlProjectReportComponent - ] -}) -export class HtmlProjectReportModule { } From 243e73636289970338f3edf5c5b23fe4fa9df6b3 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 1 Feb 2024 19:46:34 +0200 Subject: [PATCH 15/15] [develop | DONE | CHANGED]: Moved predefined query checks to "fq" field instead of "query" | Updated cachingRequests | Temporary bug fix in refine fields dependent to static refine fields. 1. searchOrganizations.service.ts: In method "numOfSearchOrganizations2()" and in method "advancedSearchOrganizations()" moved predefined query checks to "fq" field instead of "query". 2. entitySearch.service.ts: Mark method "searchByDepositType()" as @deprecated since it is not used anymore. 3. searchDataProviders.component.ts: In methods "_getFilters()" and "getResults()" updated parameters to set predefined query checks to "fq" field instead of "query" for repositories, journals, entity registries, but keep in "query" field for deposit search. 4. cache-interceptor.service.ts: Updated urls in cachingRequests table and checks in "checkForCachedRequests()" method. 5. searchFields.base.ts: [Bug fix] Temporarily removed from HIDDEN_FIELDS and "DEPENDENT_FIELDS" the "instancetypename" field - there is a bug with static refine fields, until the "angular-16-irish-monitor" branch is merged. --- cache-interceptor.service.ts | 39 ++++++++++++------- searchPages/searchDataProviders.component.ts | 24 +++++++++++- services/searchOrganizations.service.ts | 20 ++++++---- .../entitySearch.service.ts | 5 +++ utils/properties/searchFields.base.ts | 6 ++- 5 files changed, 68 insertions(+), 26 deletions(-) diff --git a/cache-interceptor.service.ts b/cache-interceptor.service.ts index 14e0f648..6a84c38a 100644 --- a/cache-interceptor.service.ts +++ b/cache-interceptor.service.ts @@ -8,29 +8,39 @@ import { properties } from "../../environments/environment"; export class CacheInterceptorService implements HttpInterceptor { cachingRequests = [ // Remove 2 following lines when bug with hidden refine filters is solved. - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&fields=country&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0", "/resources2/?format=json&refine=true&fields=funder&fields=fundinglevel0_id&fields=projectstartyear&fields=projectendyear&fields=projectoamandatepublications&&type=projects&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=results&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&fields=country&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=results&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=publications&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=datasets&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=software&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=other&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=publications&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=datasets&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=software&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&type=other&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&type=results&page=0&size=0", - "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0", - "/resources2/?format=json&refine=true&fields=funder&fields=projectstartyear&fields=projectendyear&fields=projectoamandatepublications&&type=projects&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&type=results&page=0&size=0", + "/resources2/?format=json&refine=true&fields=instancetypename&fields=foslabel&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0", + "/resources2/?format=json&refine=true&fields=funder&fields=projectoamandatepublications&fields=projectstartyear&fields=projectendyear&&type=projects&page=0&size=0", "/resources2/?format=json&refine=true&fields=eoscdatasourcetype&fields=datasourceodlanguages&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=country&fields=collectedfromname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0", - "/resources2/?format=json&query= ( (reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*) ) &refine=true&fields=country&&type=organizations&page=0&size=0", + // "/resources2/?format=json&query= ( (reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*) ) &refine=true&fields=country&&type=organizations&page=0&size=0", + "/resources2/?format=json&refine=true&fields=country&&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)&page=0&size=0&minRef=true", - "/projects/?format=json&refine=true&page=1&size=0&fields=funder", + "/resources2/?format=json&size=0&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)", + + // "/projects/?format=json&refine=true&page=1&size=0&fields=funder", + "/projects/?fields=funder&sf=funder&format=json&size=0", + "/results/?fields=relfunder&sf=relfunder&format=json&size=0", "/resources/?format=json&query=( oaftype exact datasource and (eoscdatasourcetype exact \"Journal Archive\" or eoscdatasourcetype exact \"Repository\"))&refine=true&fields=datasourcetypename&fields=country&fields=datasourceodsubjects&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0", "/search/v2/api/datasources/count?format=json", "/search/v2/api/publications/count?format=json", "/search/v2/api/datasets/count?format=json", "/search/v2/api/software/count?format=json", "/search/v2/api/other/count?format=json", - "relresulttype%3Dpublication" + "relresulttype%3Dpublication", + + "/resources2/?format=json&size=0&type=projects", + "/resources2/?format=json&size=0&type=datasources", + "/resources2/?format=json&size=0&type=results", + "/resources2/?format=json&size=0&type=results&fq=resultbestaccessright%20exact%20%22Open%20Access%22" ]; @@ -53,7 +63,8 @@ export class CacheInterceptorService implements HttpInterceptor { if (!properties.useLongCache) { return false; } - if(url.indexOf("refine=true") !== -1 || url.indexOf("/count?format=json") !== -1 || url.indexOf("relresulttype%3Dpublication") !== -1) { + if(url.indexOf("sf=") !== -1 || url.indexOf("refine=true") !== -1 || url.indexOf("/count?format=json") !== -1 || url.indexOf("relresulttype%3Dpublication") !== -1 || + (url.indexOf("?format=json&size=0&type=") !== -1 && url.indexOf("query=") == -1)) { return this.cachingRequests.some(partUrl => (url.indexOf(partUrl) !== -1)); } return false; diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 4b8647cc..5f086b29 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -190,7 +190,17 @@ export class SearchDataProvidersComponent { this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type); - this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit"), true) + let isDeposit: boolean = (this.type == "deposit"); + let parametersFull; + let refineQueryFull; + if(isDeposit) { + parametersFull = datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''); + refineQueryFull = refineFieldsFilterQuery; + } else { + parametersFull = parameters; + refineQueryFull = refineFieldsFilterQuery+(refineFieldsFilterQuery.length > 0 && datasourceQueryPrefix.length >0 ? "&" : "")+(datasourceQueryPrefix.length>0 ? "fq=" : "")+datasourceQueryPrefix; + } + this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( parametersFull, page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineQueryFull, isDeposit, true) //.switchMap( .subscribe( data => { @@ -262,7 +272,17 @@ export class SearchDataProvidersComponent { this.searchUtils.totalResults = 0; let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type); - this.searchResultsSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe( + let isDeposit: boolean = (this.type == "deposit"); + let parametersFull; + let refineQueryFull; + if(isDeposit) { + parametersFull = datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''); + refineQueryFull = refineFieldsFilterQuery; + } else { + parametersFull = parameters; + refineQueryFull = refineFieldsFilterQuery+(refineFieldsFilterQuery.length > 0 && datasourceQueryPrefix.length >0 ? "&" : "")+(datasourceQueryPrefix.length>0 ? "fq=" : "")+datasourceQueryPrefix; + } + this.searchResultsSub = this._searchDataProvidersService.advancedSearchDataproviders( parametersFull, page, size, this.properties, null, this.searchPage.getFields(), refineQueryFull, isDeposit).subscribe( data => { let totalResults = data[0]; let results = data[1]; diff --git a/services/searchOrganizations.service.ts b/services/searchOrganizations.service.ts index b4b51c15..b71f4e09 100644 --- a/services/searchOrganizations.service.ts +++ b/services/searchOrganizations.service.ts @@ -63,11 +63,12 @@ export class SearchOrganizationsService { "reldatasourcecompatibilityid exact openaire-cris_1.1 or " + "reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)"; - url += "&query="; + // url += "&query="; if(params!= null && params != '' ) { - url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; - }else{ - url +=" ( "+basicQuery+ " ) "; + // url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; + url +="&query=(" + params + ")"; + // }else{ + // url +=" ( "+basicQuery+ " ) "; } if(refineParams!= null && refineParams != '' ) { url += refineParams; @@ -75,6 +76,7 @@ export class SearchOrganizationsService { if(refineQuery) { url += "&" + refineQuery; } + url += "&fq="+basicQuery; url += "&page="+(page-1)+"&size="+size; url += minRef ? "&minRef=true" : ""; @@ -212,15 +214,17 @@ export class SearchOrganizationsService { "reldatasourcecompatibilityid exact openaire-cris_1.1 or " + "reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)"; - url += "&query="; + // url += "&query="; if(params!= null && params != '' ) { - url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; - }else{ - url +=" ( "+basicQuery+ " ) "; + // url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; + url +="&query=( "+params+ " ) "; + // }else{ + // url +=" ( "+basicQuery+ " ) "; } if(refineParams!= null && refineParams != '' ) { url += refineParams; } + url += "&fq="+basicQuery; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .pipe(map(res => res['meta']['total'])); } diff --git a/utils/entitiesAutoComplete/entitySearch.service.ts b/utils/entitiesAutoComplete/entitySearch.service.ts index 95f20506..f7cc9478 100644 --- a/utils/entitiesAutoComplete/entitySearch.service.ts +++ b/utils/entitiesAutoComplete/entitySearch.service.ts @@ -38,6 +38,11 @@ export class EntitiesSearchService { return [{id:'-2',label:'Error'}]; }); }*/ + + // not used + /** + * @deprecated + */ searchByDepositType(keyword:string, DepositType:string, properties:EnvProperties ):any { this.ready = false; diff --git a/utils/properties/searchFields.base.ts b/utils/properties/searchFields.base.ts index 3b4a19bd..cbb11fcc 100644 --- a/utils/properties/searchFields.base.ts +++ b/utils/properties/searchFields.base.ts @@ -770,7 +770,9 @@ export class SearchFieldsBase { //add project field depending on funder public HIDDEN_FIELDS: string[] = ["fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id", - "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "instancetypename"]; + "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", + // "instancetypename" + ]; public DEPENDENT_FIELDS: { [key: string]: string } = { ["relproject"]: "relfunder", @@ -780,7 +782,7 @@ export class SearchFieldsBase { ["relfundinglevel0_id"]: "relfunder", ["relfundinglevel1_id"]: "relfundinglevel0_id", ["relfundinglevel2_id"]: "relfundinglevel1_id", - ["instancetypename"]: "type" + // ["instancetypename"]: "type" };