From 606df73c7407f4533c8161e6ef78dfee3c5ea242 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 24 Oct 2023 12:46:38 +0300 Subject: [PATCH 001/126] [angular-16-irish-monitor | WIP]: Search orcid service: add new methods, add module --- .../service/searchOrcid.service.ts | 70 ++++++++++++++++--- .../service/searchOrcidService.module.ts | 19 +++++ 2 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 claims/claim-utils/service/searchOrcidService.module.ts diff --git a/claims/claim-utils/service/searchOrcid.service.ts b/claims/claim-utils/service/searchOrcid.service.ts index 208ce16e..3bf17c00 100644 --- a/claims/claim-utils/service/searchOrcid.service.ts +++ b/claims/claim-utils/service/searchOrcid.service.ts @@ -21,14 +21,35 @@ export class SearchOrcidService { let url = properties.searchOrcidURL + term + '/record'; return this.http.get(url, { headers: headers }) - //.map(res => res.json()['person']) - .pipe(map(res => res['person'])) - .pipe(map(res => [res['name']['given-names'], - res['name']['family-name'], - res['name']])) - .pipe(map(res => SearchOrcidService.parseOrcidAuthor(res, authorIds, authors, addId))); - } + //.map(res => res.json()['person']) + .pipe(map(res => res['person'])) + .pipe(map(res => [res['name']['given-names'], + res['name']['family-name'], + res['name']])) + .pipe(map(res => SearchOrcidService.parseOrcidAuthor(res, authorIds, authors, addId))); + } + searchOrcidSingleAuthor(term: string, properties: EnvProperties, addId): any { + + //var headers = new Headers(); + //headers.append('Accept', 'application/orcid+json'); + let headers = new HttpHeaders({'Accept': 'application/orcid+json'}); + + let url = properties.searchOrcidURL + term + '/record'; + + return this.http.get(url, { headers: headers }) + //.map(res => res.json()['person']) + .pipe(map(res => res['person'])) + .pipe(map(res => [res['name']['given-names'], + res['name']['family-name'], + res['name']])) + + .pipe(map(res => { + let authors = [] + SearchOrcidService.parseOrcidAuthor(res, [], authors, addId) + return authors.length > 0 ? authors[0] : null; + })); + } searchOrcidAuthors(term: string, properties: EnvProperties): any { @@ -45,14 +66,41 @@ export class SearchOrcidService { } + searchOrcidAuthorsNew(term: string, + properties: EnvProperties, size = 10): any { + let headers = new HttpHeaders({'Accept': 'application/orcid+json'}); + // let url = properties.searchOrcidURL+'search?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10'; + let url = /*properties.searchOrcidURL +*/ 'https://pub.orcid.org/v3.0/expanded-search?q=' + StringUtils.URIEncode('{!edismax qf="given-and-family-names^50.0 family-name^10.0 given-names^10.0 credit-name^10.0 other-names^5.0 text^1.0" pf="given-and-family-names^50.0" bq="current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70" mm=1}') + term + '&start=0&rows=' + size; + // given-and-family-names^50.0 family-name^10.0 given-names^10.0 credit-name^10.0 other-names^5.0 text^1.0" pf="given-and-family-names^50.0" bq="current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70" mm=1} + // https://pub.orcid.org/v3.0/expanded-search/?q=%7B!edismax%20qf%3D%22given-and-family-names%5E50.0%20family-name%5E10.0%20given-names%5E10.0%20credit-name%5E10.0%20other-names%5E5.0%20text%5E1.0%22%20pf%3D%22given-and-family-names%5E50.0%22%20bq%3D%22current-institution-affiliation-name%3A%5B*%20TO%20*%5D%5E100.0%20past-institution-affiliation-name%3A%5B*%20TO%20*%5D%5E70%22%20mm%3D1%7Dpaolo%20manghi&start=0&rows=50 + + //q={!edismax qf="given-and-family-names^50.0 family-name^10.0 given-names^5.0 credit-name^10.0 other-names^5.0 text^1.0" pf="given-and-family-names^50.0" mm=1}alessia bardi&start=0&rows=10 + let key = url; + return this.http.get(url, {headers: headers}) + .pipe(map(res => res['expanded-result'])) + .pipe(map(res => { + let authors = []; + if(res) { + for (let auth_result of res) { + const author = {}; + author['id'] = auth_result['orcid-id']; + author['authorGivenName'] = auth_result['given-names']; + author['authorFamilyName'] = auth_result['family-names']; + authors.push(author); + } + } + return authors; + + })); + } searchOrcidPublications(id: string, properties: EnvProperties, parse: boolean = false): any { let headers = new HttpHeaders({'Accept': 'application/orcid+json'}); let url = properties.searchOrcidURL + id + '/works'; - return this.http.get(url, { headers: headers }) - .pipe(map(res => res['group'])) - .pipe(map(request => (parse ? SearchOrcidService.parse(id, request) : request))); - } + return this.http.get(url, { headers: headers }) + .pipe(map(res => res['group'])) + .pipe(map(request => (parse ? SearchOrcidService.parse(id, request) : request))); + } static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any { diff --git a/claims/claim-utils/service/searchOrcidService.module.ts b/claims/claim-utils/service/searchOrcidService.module.ts new file mode 100644 index 00000000..64b31c1d --- /dev/null +++ b/claims/claim-utils/service/searchOrcidService.module.ts @@ -0,0 +1,19 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import {SearchOrcidService} from "./searchOrcid.service"; + + +@NgModule({ + imports: [ + CommonModule, FormsModule + ], + declarations: [ + ], + providers:[ + SearchOrcidService +], + exports: [ + ] +}) +export class SearchOrcidServiceModule { } From 33b763ca3891b08c837ec8d5ea08ed6492fc0fd0 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 24 Oct 2023 12:47:28 +0300 Subject: [PATCH 002/126] [angular-16-irish-monitor | WIP]: Piwik service: add new methods to test events --- utils/piwik/piwik.service.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/utils/piwik/piwik.service.ts b/utils/piwik/piwik.service.ts index 7d546f1b..81c9c2f5 100644 --- a/utils/piwik/piwik.service.ts +++ b/utils/piwik/piwik.service.ts @@ -69,6 +69,22 @@ export class PiwikService { } + private doTrackEvent(properties: EnvProperties, title, siteId, pageURL, eventCategory, eventAction, eventName, eventValue = 0): Observable { + let ua = this.getUserAgent(); + let referrer = this.getReferrer(); + let piwikId = ((siteId != null) ? siteId : properties.piwikSiteId); + if (typeof location !== 'undefined' && piwikId) { + var url =`${properties.piwikBaseUrl}${piwikId}&rec=1&url=${encodeURIComponent(pageURL)}&action_name=${encodeURIComponent(title)}&e_c=${encodeURIComponent(eventCategory)}&e_a=${encodeURIComponent(eventAction)}&e_n=${encodeURIComponent(eventName)}&e_v=${encodeURIComponent(eventValue)}` + +((ua != null && ua.length > 0) ? ('&ua=' + StringUtils.URIEncode(ua)) : '') + + ((referrer != null && referrer.length > 0) ? ('&urlref=' + StringUtils.URIEncode(referrer)) : ''); + // console.log(trackingApiUrl) + console.log(url) + // return of(new Object()); // for testing + + return this.http.get(url, {responseType: 'blob'}); + } + } + private getUserAgent() { if (typeof navigator !== 'undefined') { return navigator.userAgent; From 60a3e552b40bd7ea472cb92e66f7c643aeca850e Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 25 Oct 2023 17:41:13 +0300 Subject: [PATCH 003/126] [angular-16-irish-monitor | WIP] Search results service: add new method to get results by dois --- services/searchResearchResults.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index d81981e1..50f20abd 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -587,4 +587,13 @@ export class SearchResearchResultsService { return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) .pipe(map(res => res['meta']['total'])); } + fetchByDOIs(DOIs:string[]): any { + // let url = properties.searchAPIURLLAst + "resources2/?format=json"; + let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/researchProducts/byDoi" + + + + return this.http.post(url, {doiArray: DOIs}) + .pipe(map(res => [res['meta'].total, this.parseResults("result", res['results'], properties), RefineResultsUtils.parse(res['refineResults'], null, "publication")])); + } } From 115ba0c49eaafdad6382b2f300d05ea61f928f64 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 27 Oct 2023 09:25:01 +0300 Subject: [PATCH 004/126] [angular-16-irish-monitor | WIP]: Create base component with metadata initilization --- sharedComponents/SEO/SEO.service.ts | 4 +- sharedComponents/base/base.component.ts | 50 +++++++++++++++++++++++++ utils/piwik/piwik.service.ts | 4 +- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 sharedComponents/base/base.component.ts diff --git a/sharedComponents/SEO/SEO.service.ts b/sharedComponents/SEO/SEO.service.ts index 8543d17f..2267be0f 100644 --- a/sharedComponents/SEO/SEO.service.ts +++ b/sharedComponents/SEO/SEO.service.ts @@ -2,7 +2,9 @@ import { Injectable, Inject } from '@angular/core'; import { DOCUMENT } from '@angular/common'; import { Optional, RendererFactory2, ViewEncapsulation } from '@angular/core'; -@Injectable() +@Injectable({ + providedIn: 'root' +}) export class SEOService { constructor( @Inject(DOCUMENT) private doc, private rendererFactory: RendererFactory2, diff --git a/sharedComponents/base/base.component.ts b/sharedComponents/base/base.component.ts new file mode 100644 index 00000000..d1e5e18a --- /dev/null +++ b/sharedComponents/base/base.component.ts @@ -0,0 +1,50 @@ +import {Directive, OnDestroy} from "@angular/core"; +import {Subscriber} from "rxjs"; +import {EnvProperties} from "../../utils/properties/env-properties"; +import {properties} from "src/environments/environment"; +import {PiwikService} from "../../utils/piwik/piwik.service"; +import {Meta, Title} from "@angular/platform-browser"; +import {SEOService} from "../SEO/SEO.service"; +import {Router} from "@angular/router"; + +@Directive() +export abstract class BaseComponent implements OnDestroy { + public properties: EnvProperties = properties; + protected subscriptions: any[] = []; + /** Metadata */ + public title: string; + public description: string; + protected _piwikService: PiwikService; + protected _meta: Meta; + protected seoService: SEOService; + protected _title: Title; + protected _router: Router; + + protected constructor() { + } + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if(subscription instanceof Subscriber) { + subscription.unsubscribe() + } else if(subscription instanceof Function) { + subscription(); + } else if(typeof IntersectionObserver !== 'undefined' && subscription instanceof IntersectionObserver) { + subscription.disconnect(); + } else if(typeof ResizeObserver !== 'undefined' && subscription instanceof ResizeObserver) { + subscription.disconnect(); + } + }); + } + + public setMetadata() { + const url = properties.domain + properties.baseLink + this._router.url; + this.seoService.createLinkForCanonicalURL(url, false); + this._meta.updateTag({content: url}, "property='og:url'"); + this._meta.updateTag({content: this.description}, "name='description'"); + this._meta.updateTag({content: this.description}, "property='og:description'"); + this._meta.updateTag({content: this.title}, "property='og:title'"); + this._title.setTitle(this.title); + this.subscriptions.push(this._piwikService.trackView(properties, this.title).subscribe()); + } +} diff --git a/utils/piwik/piwik.service.ts b/utils/piwik/piwik.service.ts index 81c9c2f5..0f86b953 100644 --- a/utils/piwik/piwik.service.ts +++ b/utils/piwik/piwik.service.ts @@ -8,7 +8,9 @@ import {ConfigurationService} from "../configuration/configuration.service"; import {switchMap, take} from "rxjs/operators"; -@Injectable() +@Injectable({ + providedIn: 'root' +}) export class PiwikService { constructor(private http: HttpClient, private configurationService: ConfigurationService) { } From 92137556626a25dec819f258a6cf49e5e7562443 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 27 Oct 2023 15:52:55 +0300 Subject: [PATCH 005/126] Add new types of stakeholder for Irish --- monitor/entities/stakeholder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitor/entities/stakeholder.ts b/monitor/entities/stakeholder.ts index 13ed58cf..d4e36d76 100644 --- a/monitor/entities/stakeholder.ts +++ b/monitor/entities/stakeholder.ts @@ -8,7 +8,7 @@ export const ChartHelper = { suffix: "__))" }; -export type StakeholderType = 'funder' | 'ri' | 'project' | 'organization'; +export type StakeholderType = 'funder' | 'ri' | 'project' | 'organization' | 'country' | 'researcher' | 'datasource'; export type IndicatorType = 'number' | 'chart'; export type IndicatorSize = 'small' | 'medium' | 'large'; export type IndicatorPathType = 'table' | 'bar' | 'column' | 'pie' | 'line' | 'other'; @@ -303,6 +303,7 @@ export enum StakeholderEntities { RI = 'Research Initiative', ORGANIZATION = 'Research Institution', PROJECT = 'Project', + COUNTRY = 'National', STAKEHOLDERS = 'Dashboards', FUNDERS = 'Funders', From cdb5f1ecd00d165fbd3fe784508de11cda57abe4 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 30 Oct 2023 17:09:59 +0200 Subject: [PATCH 006/126] [WIP] Search researcher: work on the page layout - add banner, basic component functionalities --- services/searchResearchResults.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 50f20abd..a4a563ae 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -589,7 +589,7 @@ export class SearchResearchResultsService { } fetchByDOIs(DOIs:string[]): any { // let url = properties.searchAPIURLLAst + "resources2/?format=json"; - let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/researchProducts/byDoi" + let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/researchProducts/byDoi?type=publications" From 9eee47f0d2e5b016cc54f02f2b6e7e0617a7f927 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 30 Oct 2023 17:09:59 +0200 Subject: [PATCH 007/126] [angular-16-irish-monitor | WIP] Search researcher: update fetch by dois method --- services/searchResearchResults.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 50f20abd..a4a563ae 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -589,7 +589,7 @@ export class SearchResearchResultsService { } fetchByDOIs(DOIs:string[]): any { // let url = properties.searchAPIURLLAst + "resources2/?format=json"; - let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/researchProducts/byDoi" + let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/researchProducts/byDoi?type=publications" From c1e58e76a072598e537f85cfd31508b35ee7e3ac Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 2 Nov 2023 14:53:42 +0200 Subject: [PATCH 008/126] [angular-16-irish-monitor | WIP] piwik Service: make public trackEvent method --- utils/piwik/piwik.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/piwik/piwik.service.ts b/utils/piwik/piwik.service.ts index 0f86b953..39a35371 100644 --- a/utils/piwik/piwik.service.ts +++ b/utils/piwik/piwik.service.ts @@ -71,7 +71,7 @@ export class PiwikService { } - private doTrackEvent(properties: EnvProperties, title, siteId, pageURL, eventCategory, eventAction, eventName, eventValue = 0): Observable { + public doTrackEvent(properties: EnvProperties, title, siteId, pageURL, eventCategory, eventAction, eventName, eventValue = 0): Observable { let ua = this.getUserAgent(); let referrer = this.getReferrer(); let piwikId = ((siteId != null) ? siteId : properties.piwikSiteId); From ba6dcf3b1c20081b77a41f59f72898164f260abd Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 2 Nov 2023 16:39:14 +0200 Subject: [PATCH 009/126] [angular-16-irish-monitor | WIP]: Add route params resolver in base component. Change metadata in manage stakeholders. --- .../manageStakeholders.component.html | 1 - .../manageStakeholders.component.ts | 26 ++------ sharedComponents/base/base.component.ts | 65 +++++++++++++++---- 3 files changed, 58 insertions(+), 34 deletions(-) diff --git a/monitor-admin/manageStakeholders/manageStakeholders.component.html b/monitor-admin/manageStakeholders/manageStakeholders.component.html index 5b981cde..df98cce0 100644 --- a/monitor-admin/manageStakeholders/manageStakeholders.component.html +++ b/monitor-admin/manageStakeholders/manageStakeholders.component.html @@ -55,7 +55,6 @@ -
diff --git a/monitor-admin/manageStakeholders/manageStakeholders.component.ts b/monitor-admin/manageStakeholders/manageStakeholders.component.ts index 5e637b3e..1ca980bc 100644 --- a/monitor-admin/manageStakeholders/manageStakeholders.component.ts +++ b/monitor-admin/manageStakeholders/manageStakeholders.component.ts @@ -15,6 +15,7 @@ import {properties} from "src/environments/environment"; import {ActivatedRoute} from "@angular/router"; import {CacheIndicatorsService} from "../utils/cache-indicators/cache-indicators.service"; import {NotificationHandler} from "../../utils/notification-handler"; +import {BaseComponent} from "../../sharedComponents/base/base.component"; type Tab = 'all' | 'templates'| 'profiles'; @@ -25,9 +26,7 @@ declare var UIkit; templateUrl: "./manageStakeholders.component.html", styleUrls: ["./manageStakeholders.component.less"] }) -export class ManageStakeholdersComponent implements OnInit, OnDestroy { - - public properties: EnvProperties; +export class ManageStakeholdersComponent extends BaseComponent implements OnInit, OnDestroy { public loading: boolean = true; public deleteLoading: boolean = false; public stakeholderUtils: StakeholderUtils = new StakeholderUtils(); @@ -57,7 +56,6 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { /** * Grid or List View */ - private subscriptions: any[] = []; @ViewChild('editStakeholderModal', { static: true }) editStakeholderModal: AlertModal; @ViewChild('deleteStakeholderModal', { static: true }) deleteStakeholderModal: AlertModal; @ViewChild('editStakeholderComponent', { static: true }) editStakeholderComponent: EditStakeholderComponent; @@ -65,15 +63,16 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { constructor(private stakeholderService: StakeholderService, private cacheIndicatorsService: CacheIndicatorsService, private userManagementService: UserManagementService, - private route: ActivatedRoute, - private title: Title, + protected _route: ActivatedRoute, + protected _title: Title, private fb: UntypedFormBuilder) { + super(); } ngOnInit(): void { this.buildFilters(); - this.properties = properties; - this.title.setTitle('Manage profiles'); + this.title = 'Manage Profiles'; + this.setMetadata(); this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; })); @@ -94,21 +93,10 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { })); } - ngOnDestroy(): void { - this.subscriptions.forEach(value => { - if (value instanceof Subscriber) { - value.unsubscribe(); - } else if (value instanceof Function) { - value(); - } - }); - } - hide(element: any) { UIkit.dropdown(element).hide(); } - private buildFilters() { this.filters = this.fb.group({ status: this.fb.control('all'), diff --git a/sharedComponents/base/base.component.ts b/sharedComponents/base/base.component.ts index d1e5e18a..edc9eaca 100644 --- a/sharedComponents/base/base.component.ts +++ b/sharedComponents/base/base.component.ts @@ -1,19 +1,24 @@ import {Directive, OnDestroy} from "@angular/core"; -import {Subscriber} from "rxjs"; +import {BehaviorSubject, Subscriber} from "rxjs"; import {EnvProperties} from "../../utils/properties/env-properties"; import {properties} from "src/environments/environment"; import {PiwikService} from "../../utils/piwik/piwik.service"; import {Meta, Title} from "@angular/platform-browser"; import {SEOService} from "../SEO/SEO.service"; -import {Router} from "@angular/router"; +import {ActivatedRoute, Data, NavigationEnd, Params, Router} from "@angular/router"; @Directive() export abstract class BaseComponent implements OnDestroy { public properties: EnvProperties = properties; + /** Router params */ + protected paramsResolved: boolean = false; + protected params: BehaviorSubject; + protected data: BehaviorSubject; protected subscriptions: any[] = []; /** Metadata */ public title: string; public description: string; + protected _route: ActivatedRoute; protected _piwikService: PiwikService; protected _meta: Meta; protected seoService: SEOService; @@ -25,26 +30,58 @@ export abstract class BaseComponent implements OnDestroy { ngOnDestroy() { this.subscriptions.forEach(subscription => { - if(subscription instanceof Subscriber) { + if (subscription instanceof Subscriber) { subscription.unsubscribe() - } else if(subscription instanceof Function) { + } else if (subscription instanceof Function) { subscription(); - } else if(typeof IntersectionObserver !== 'undefined' && subscription instanceof IntersectionObserver) { + } else if (typeof IntersectionObserver !== 'undefined' && subscription instanceof IntersectionObserver) { subscription.disconnect(); - } else if(typeof ResizeObserver !== 'undefined' && subscription instanceof ResizeObserver) { + } else if (typeof ResizeObserver !== 'undefined' && subscription instanceof ResizeObserver) { subscription.disconnect(); } }); } + /** + * Initialize router params and data (should be called in the constructor) + * */ + initRouterParams(route: ActivatedRoute = null) { + if (route) { + this.params = new BehaviorSubject(null); + this.data = new BehaviorSubject(null); + this.subscriptions.push(this._router.events.subscribe(event => { + if (event instanceof NavigationEnd) { + let r = route; + while (r.firstChild) { + r = r.firstChild; + } + this.paramsResolved = true; + this.params.next(r.snapshot.params); + this.data.next(r.snapshot.data); + } + })); + } + } + public setMetadata() { - const url = properties.domain + properties.baseLink + this._router.url; - this.seoService.createLinkForCanonicalURL(url, false); - this._meta.updateTag({content: url}, "property='og:url'"); - this._meta.updateTag({content: this.description}, "name='description'"); - this._meta.updateTag({content: this.description}, "property='og:description'"); - this._meta.updateTag({content: this.title}, "property='og:title'"); - this._title.setTitle(this.title); - this.subscriptions.push(this._piwikService.trackView(properties, this.title).subscribe()); + if (this._title && this.title) { + this.title = (this._route?.snapshot.data?.title ? this._route.snapshot.data?.title : '') + this.title; + this._title.setTitle(this.title); + } + if (this._router) { + const url = properties.domain + properties.baseLink + this._router.url; + if (this.seoService) { + this.seoService.createLinkForCanonicalURL(url, false); + } + if (this._meta) { + this._meta.updateTag({content: url}, "property='og:url'"); + this._meta.updateTag({content: this.description}, "name='description'"); + this._meta.updateTag({content: this.description}, "property='og:description'"); + this._meta.updateTag({content: this.title}, "property='og:title'"); + } + } + if (this._piwikService) { + this.subscriptions.push(this._piwikService.trackView(properties, this.title).subscribe()); + } } } From ce8b104c207927d9c12a80cd1447b160c31c9ee3 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 9 Nov 2023 16:11:12 +0200 Subject: [PATCH 010/126] [angular-16-irish-monitor | DONE | REMOVED] SearchCustomFilter: remove promptToAddFilter field, and code to add and remove filter --- .../searchUtils/newSearchPage.component.html | 13 +--- .../searchUtils/newSearchPage.component.ts | 69 ++----------------- searchPages/searchUtils/searchUtils.class.ts | 2 - 3 files changed, 6 insertions(+), 78 deletions(-) diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index c8b860fd..f3f37221 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -4,9 +4,7 @@
    - +
  • {{customFilter.valueName}} @@ -272,13 +270,7 @@
- -
- Do you want to see results only for {{customFilter.valueName}}? Click here. -
+
@@ -399,4 +391,3 @@
- diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 96aa3e20..ee6c4bf9 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -138,11 +138,9 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { //Dashboard filterToggle = false; - customFilterEnabled: boolean = false; //stickyform @Input() stickyForm: boolean = false; - @ViewChild('removeCustomFilter') removeCustomFilter: AlertModal; currentValueToRemove; currentFilterToRemove; public indexUpdateDate: Date; @@ -185,7 +183,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { if (params['page'] && params['page'] != 1) { HelperFunctions.scrollToId("searchForm"); } - this.customFilterEnabled = params['cf'] && params['cf'] == "true"; if (this.basicMetaDescription.length == 0) { if (this.entityType == "result") { this.basicMetaDescription = [OpenaireEntities.RESULTS, "Discover" + (this.properties.adminToolsCommunity == 'openaire' ? " over 100 million of" : "") + " "+OpenaireEntities.RESULTS+" ", "categorized by research type, year range, funder, languages, "+OpenaireEntities.COMMUNITY+" and "+OpenaireEntities.DATASOURCES+"."]; @@ -644,10 +641,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { public removeFilter(value: Value, filter: Filter, forceRemove: boolean = false) { this.currentValueToRemove = value; this.currentFilterToRemove = filter; - if (!forceRemove && this.customFilter && this.customFilter.queryFieldName == filter.filterId && this.customFilter.valueId == value.id && this.customFilter.promptToAddFilter) { - this.openRemoveCustomFilterModal(); - return; - } filter.countSelectedValues--; this.selectedFilters--; if (value.selected == true) { @@ -661,20 +654,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { // } this.goTo(1); } - - public openRemoveCustomFilterModal() { - this.removeCustomFilter.alertTitle = 'Remove filter'; - this.removeCustomFilter.message = 'You are about to see results that are not related to ' + this.customFilter.valueName + '. Do you want to proceed?'; - this.removeCustomFilter.okButtonText = 'Yes'; - this.removeCustomFilter.cancelButtonText = 'No'; - this.removeCustomFilter.open(); - } - - closeCustomFilterModal() { - this.customFilterEnabled = false; - this.removeFilter(this.currentValueToRemove, this.currentFilterToRemove, true); - } - + public removeRangeFilter(filter: RangeFilter) { filter.selectedFromValue = null; filter.selectedToValue = null; @@ -718,42 +698,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { } }*/ - /** - * Set selected the value of the custom filter. - */ - addCustomFilter() { - this.customFilter.selected = true; - this.customFilterEnabled = true; - if (this.refineFields.indexOf(this.customFilter.queryFieldName) != -1) { - let found = false; - for (let filter of this.filters) { - if (this.customFilter.queryFieldName == filter.filterId) { - for (let value of filter.values) { - if (value.id == this.customFilter.valueId) { - value.selected = true; - filter.countSelectedValues++; - found = true; - break; - } - } - //add filter when field exist in refine but not in the refine values - if (!found) { - filter.countSelectedValues++; - filter.values.push({ - selected: true, - name: this.customFilter.valueName, - id: this.customFilter.valueId, - number: 0 - }); - } - break; - } - } - } - this.filterChanged(null); - - } - + // for loading public openLoading() { this.loading.open(); @@ -1112,8 +1057,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { allFqs += fq; } } - this.customFilterEnabled = URLparams["cf"] == "true"; - if (this.customFilter && (this.customFilter.isHiddenFilter || this.customFilterEnabled)) { + if (this.customFilter && (this.customFilter.isHiddenFilter)) { allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))); } @@ -1455,12 +1399,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { this.parameterNames.push("keyword"); this.parameterValues.push(this.searchUtils.keyword); } - - - if (this.customFilterEnabled) { - this.parameterNames.push("cf"); - this.parameterValues.push("true"); - } + // if (this.searchUtils.size != this.resultsPerPage) { // // allLimits += ((allLimits.length == 0) ? '?' : '&') + 'size=' + this.searchUtils.size; // this.parameterNames.push("size"); diff --git a/searchPages/searchUtils/searchUtils.class.ts b/searchPages/searchUtils/searchUtils.class.ts index f3cc2ace..da049a3f 100644 --- a/searchPages/searchUtils/searchUtils.class.ts +++ b/searchPages/searchUtils/searchUtils.class.ts @@ -27,7 +27,6 @@ export class SearchCustomFilter{ valueName:string; // Greece isHiddenFilter:boolean; selected:boolean; - promptToAddFilter:boolean; constructor( fieldName:string, queryFieldName:string, valueId:string, valueName:string ){ if(valueId == "test" && properties.environment == "development"){ valueId = "covid-19"; @@ -38,7 +37,6 @@ export class SearchCustomFilter{ this.valueId = valueId; this.valueName = valueName; this.selected = null; - this.promptToAddFilter = false; } public getParameters(params={}){ From ffec3914485d7374096c1f0da0070986b1c64c26 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 13 Nov 2023 11:16:47 +0200 Subject: [PATCH 011/126] [angular-16-irish-monitor | DONE | UPDATED] SearchResearch results - fetchByDOIs: use the search service API from properties --- services/searchResearchResults.service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index a4a563ae..cddf7c92 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -588,8 +588,7 @@ export class SearchResearchResultsService { .pipe(map(res => res['meta']['total'])); } fetchByDOIs(DOIs:string[]): any { - // let url = properties.searchAPIURLLAst + "resources2/?format=json"; - let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/researchProducts/byDoi?type=publications" + let url = properties.searchAPIURLLAst + "/researchProducts/byDoi?type=publications"; From 62d4ab1a36650f7a25abbe9ed339004878e9ec9c Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 13 Nov 2023 11:18:00 +0200 Subject: [PATCH 012/126] [angular-16-irish-monitor | DONE | UPDATED] Custom Filter accept single or an array of Custom filters --- .../searchResearchResults.component.ts | 12 +++++- .../searchUtils/newSearchPage.component.html | 17 +++++--- .../searchUtils/newSearchPage.component.ts | 43 ++++++++++++------- searchPages/searchUtils/searchUtils.class.ts | 4 +- 4 files changed, 51 insertions(+), 25 deletions(-) diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index f4f03fa7..cd49aead 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -71,7 +71,15 @@ export class SearchResearchResultsComponent { public loadPaging: boolean = true; public oldTotalResults: number = 0; @Input() openaireLink: string = null; - @Input() customFilter: SearchCustomFilter = null; + @Input() customFilters: SearchCustomFilter[] = null; + @Input() + set customFilter(customFilter: SearchCustomFilter | SearchCustomFilter[]) { + if(!Array.isArray(customFilter)) { + this.customFilters = [customFilter]; + }else{ + this.customFilters = customFilter; + } + } public pagingLimit: number = 0; properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; @@ -167,7 +175,7 @@ export class SearchResearchResultsComponent { } this.selectedFields = []; - this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter); + this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilters,params, this.resultType, this.quickFilter); if(refine) { this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); } else { diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index f3f37221..b2880400 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -4,13 +4,15 @@