From 6886df2caadff2a4f5a1d6b38b7f7d0e491d9a9b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 15 Apr 2024 17:11:38 +0300 Subject: [PATCH] [develop | DONE | CHANGED]: Alt attribute on images | Set changeDetection: ChangeDetectionStrategy.OnPush on result-preview.component.ts. 1. deletedByInference.service.ts: [Bug fix] Fixed author check. 2. sdg.component.html & quick-contact.component.html & fos.component.html: Added alt attribute on images. 3. result-preview.component.ts: Set changeDetection: ChangeDetectionStrategy.OnPush | Added get countDots(). 4. result-preview.component.html: Changed how number of access routes dots is passed into a class (countDots) - needed for ChangeDetectionStrategy.OnPush. 5. orcid-work.component.ts: Added alt attribute on images | Added ChangeDetectorRef and call this.cdr.markForCheck(); on "getPutCode()", "saveWork()" and "deleteWorks()" - needed for ChangeDetectionStrategy.OnPush. 6. searchResult.component.ts: Rebuild previewResults object after getting orcidPutCodes to draw html again - needed for ChangeDetectionStrategy.OnPush. 7. newSearchPage.component.html: Removed uk-flex-wrap for number of results and uk-margin-medium-left from desktop sorting. --- fos/fos.component.html | 2 +- .../deletedByInference.service.ts | 3 +-- orcid/orcid-work.component.ts | 15 +++++++++---- sdg/sdg.component.html | 6 +++--- .../searchUtils/newSearchPage.component.html | 4 ++-- .../searchUtils/searchResult.component.ts | 21 +++++++++++++++++++ .../quick-contact.component.html | 2 +- .../result-preview.component.html | 2 +- .../result-preview.component.ts | 9 ++++++-- 9 files changed, 48 insertions(+), 16 deletions(-) diff --git a/fos/fos.component.html b/fos/fos.component.html index 5121aa2f..1d0c8bf5 100644 --- a/fos/fos.component.html +++ b/fos/fos.component.html @@ -32,7 +32,7 @@
- + FoS logo
diff --git a/landingPages/result/deletedByInference/deletedByInference.service.ts b/landingPages/result/deletedByInference/deletedByInference.service.ts index 5b812e8f..f3b3754c 100644 --- a/landingPages/result/deletedByInference/deletedByInference.service.ts +++ b/landingPages/result/deletedByInference/deletedByInference.service.ts @@ -145,8 +145,7 @@ 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(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) { diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 6153d146..8473be66 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {ChangeDetectorRef, Component, Input, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from "@angular/router"; import {Subscriber, Subscription} from "rxjs"; import {OrcidService} from "./orcid.service"; @@ -85,7 +85,7 @@ declare var UIkit: any; ORCID  - + ORCID logo  ACTIONS @@ -330,7 +330,8 @@ export class OrcidWorkComponent { private _router: Router, private orcidService: OrcidService, private resultLandingService: ResultLandingService, - private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService) { + private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService, + private cdr: ChangeDetectorRef) { if (typeof document !== 'undefined') { this.tokenUrl = properties.orcidTokenURL + "client_id=" + properties.orcidClientId @@ -444,6 +445,8 @@ export class OrcidWorkComponent { this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe( putCodes => { this.putCodes = putCodes; + this.cdr.markForCheck(); + // this.cdr.detectChanges(); }, error => { } @@ -525,7 +528,9 @@ export class OrcidWorkComponent { this.putCodes.push("" + response['put-code']); this.creationDates.push(response['created-date']['value']); this.updateDates.push(response['last-modified-date']['value']); - + this.cdr.markForCheck(); + // this.cdr.detectChanges(); + // this.closeGrantModal(); // this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!"; this.message = "You have successfully added work \"" + this.resultTitle + "\" in your ORCID record!"; @@ -701,6 +706,8 @@ export class OrcidWorkComponent { deletedAll = false; } else { this.putCodes.splice(i, 1); + this.cdr.markForCheck(); + // this.cdr.detectChanges(); this.creationDates.splice(i, 1); this.updateDates.splice(i, 1); // this.works.splice(i, 1); diff --git a/sdg/sdg.component.html b/sdg/sdg.component.html index 1acb5d08..c1f431fe 100644 --- a/sdg/sdg.component.html +++ b/sdg/sdg.component.html @@ -34,9 +34,9 @@
- + SDGs logo
- + SDGs big logo
@@ -61,7 +61,7 @@
- +
{{sdg.number == null ? '0' : sdg.number | number}} diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 74028ebd..c623abc1 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -311,7 +311,7 @@ target="_blank"> OpenAIRE - Explore.
-
+
@@ -347,7 +347,7 @@
-
+
diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index 33ba74c0..881578d8 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -78,6 +78,7 @@ export class SearchResultComponent implements OnInit, OnChanges { // console.debug(i, this.previewResults[i].orcidPutCodes); } } + this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); }, error => { } @@ -85,6 +86,26 @@ export class SearchResultComponent implements OnInit, OnChanges { } } + private replacer(key, value) { + if(value instanceof Map) { + return { + dataType: 'Map', + value: Array.from(value.entries()), // or with spread: value: [...value] + }; + } else { + return value; + } + } + + private reviver(key, value) { + if(typeof value === 'object' && value !== null) { + if (value.dataType === 'Map') { + return new Map(value.value); + } + } + return value; + } + public getResultPreview(result: SearchResult): ResultPreview { return ResultPreview.searchResultConvert(result, (result.entityType) ? result.entityType : this.type); } diff --git a/sharedComponents/quick-contact/quick-contact.component.html b/sharedComponents/quick-contact/quick-contact.component.html index d43d55d4..23e3d1ab 100644 --- a/sharedComponents/quick-contact/quick-contact.component.html +++ b/sharedComponents/quick-contact/quick-contact.component.html @@ -12,7 +12,7 @@ Send a message
- + contact person
How can we help? diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 046eb7c0..229ab5f9 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -218,7 +218,7 @@