From 7f7b08b7af2d08c628c061a199798d5f56330c76 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 23 Jul 2024 02:17:45 +0300 Subject: [PATCH 1/8] [develop | DONE | ADDED]: Added the option to claim works to ORCID without pids, but with OpenAIRE id. 1. myOrcidLinks.component.ts & orcid.service.ts: Added functionality for orcid claim with openaireId. 2. orcid-work.component.ts: Added functionality for orcid claim with openaireId & added (missing from previous commit) @Input() compactView to show or not the word "claim". 3. orcidWork.ts: Set openaireId (relcanId) as external-id with "external-id-type": "source-work-id". 4. newSearchPage.component.ts: Added field public isLoggedIn: boolean = false; and initialize it by calling userManagementService.getUserInfo(). 5. newSearchPage.component.html: In set isLoggedIn parameter. 6. searchResult.component.ts: Added functionality for orcid claim with openaireId & Added field @Input() isLoggedIn: boolean = false; and replaced Session check. 7. result-preview.component.ts & result-preview.component.html: Removed checks to orcid claim only when there are pids. --- .../my-orcid-links/myOrcidLinks.component.ts | 16 ++++-- orcid/orcid-work.component.ts | 56 ++++++++++++------- orcid/orcid.service.ts | 24 ++++---- orcid/orcidWork.ts | 9 +++ .../searchUtils/newSearchPage.component.html | 3 +- .../searchUtils/newSearchPage.component.ts | 16 +++++- .../searchUtils/searchResult.component.ts | 21 ++++--- .../result-preview.component.html | 4 +- .../result-preview.component.ts | 2 +- 9 files changed, 103 insertions(+), 48 deletions(-) diff --git a/orcid/my-orcid-links/myOrcidLinks.component.ts b/orcid/my-orcid-links/myOrcidLinks.component.ts index 0e71b330..c4cb03f0 100644 --- a/orcid/my-orcid-links/myOrcidLinks.component.ts +++ b/orcid/my-orcid-links/myOrcidLinks.component.ts @@ -206,7 +206,7 @@ export class MyOrcidLinksComponent { this.subscriptions.push(this._orcidService.getPersonalDetails().subscribe( details => { let author: string = ""; -console.log(details) + if(details && details['name']) { let name: string = details['name']; if(name['given-names'] && name['given-names']['value']) { @@ -303,9 +303,13 @@ console.log(details) let works = this.works.slice(from, to); for(let work of works) { - for(let pid of work['pids']) { - let identifier: Identifier = Identifier.getIdentifierFromString(pid, false); - this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(pid="'+StringUtils.URIEncode(identifier.id)+'")'); + if(work['pids'] && work['pids'].length > 0) { + for (let pid of work['pids']) { + let identifier: Identifier = Identifier.getIdentifierFromString(pid, false); + this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(pid="' + StringUtils.URIEncode(identifier.id) + '")'); + } + } else { + this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(objIdentifier="' + StringUtils.URIEncode(work['openaireId']) + '")'); } } this.showLoading = false; @@ -344,8 +348,8 @@ console.log(details) let relatedResults = []; this.currentResults.push({"work": work, "results" : relatedResults}) results.forEach(result => { - let identifierValues: string[] = [].concat(...Array.from(result.identifiers.values())); - if(work['pids'].some(pid => identifierValues.includes(pid))) { + let identifierValues: string[] = result.identifiers ? [].concat(...Array.from(result.identifiers.values())) : []; + if((work['pids'] && work['pids'].some(pid => identifierValues.includes(pid))) || work['openaireId'] === result.relcanId) { let index: number = resultsFound.get(identifierValues); if(!index) { diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 8473be66..fbb996f5 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -24,7 +24,7 @@ declare var UIkit: any; + [title]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipAdd"> @@ -32,21 +32,21 @@ declare var UIkit: any; [ngClass]="isMobile && !(pageType == 'landing') ? 'uk-margin-left' : ''" [class.uk-text-bolder]="!(isMobile && pageType == 'landing')" [class.uk-text-muted]="isDisabled"> - - Claim + Claim
+ [innerHTML]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipAdd">
+ [title]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipDelete"> @@ -54,15 +54,15 @@ declare var UIkit: any; [ngClass]="isMobile && !(pageType == 'landing') ? 'uk-margin-left' : ''" [class.uk-text-bolder]="!(isMobile && pageType == 'landing')" [class.uk-text-muted]="isDisabled"> - - Remove + Remove
+ [innerHTML]="!isLoggedIn ? tooltipNoLoggedInUser : tooltipDelete">
@@ -192,8 +192,16 @@ declare var UIkit: any;

-
+
+ + Source-work-id: + + + {{openaireId.value}} + + +
@@ -300,6 +308,8 @@ export class OrcidWorkComponent { //for myorcid links page @Input() showOnlyUpdateButton: boolean = false; @Input() showUpdateButton: boolean = true; + @Input() compactView: boolean = false; // if true, do not show label for actions + public subscriptions: Subscription[] = []; @ViewChild('workModal') workModal; // @ViewChild('saveWorkModal') saveWorkModal; @@ -317,6 +327,7 @@ export class OrcidWorkComponent { public works: any[] = []; public orcidWorks: any[] = []; + public openaireId: {value: string, url: string} = null; public window: any; public isLoggedIn: boolean = false; @@ -395,10 +406,14 @@ export class OrcidWorkComponent { public parseIdentifiers(identifiers: ExternalIDV3_0[]): Map { let identifiersMap: Map = new Map(); for (let identifier of identifiers) { - if (!identifiersMap.has(identifier['external-id-type'])) { - identifiersMap.set(identifier['external-id-type'], new Array()); + if(identifier['external-id-type'] == "source-work-id") { + this.openaireId = {value: identifier['external-id-value'], url: identifier['external-id-url'].value}; + } else { + if (!identifiersMap.has(identifier['external-id-type'])) { + identifiersMap.set(identifier['external-id-type'], new Array()); + } + identifiersMap.get(identifier['external-id-type']).push(identifier['external-id-value']); } - identifiersMap.get(identifier['external-id-type']).push(identifier['external-id-value']); } return identifiersMap; } @@ -442,7 +457,7 @@ export class OrcidWorkComponent { } private getPutCode() { - this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe( + this.subscriptions.push(this.orcidService.getPutCode(this.resultLandingInfo.relcanId, this.pids).subscribe( putCodes => { this.putCodes = putCodes; this.cdr.markForCheck(); @@ -511,7 +526,7 @@ export class OrcidWorkComponent { } private saveWork() { - this.subscriptions.push(this.orcidService.saveWork(this.resultLandingInfo, this.pids).subscribe( + this.subscriptions.push(this.orcidService.saveWork(this.resultLandingInfo, this.resultLandingInfo.relcanId,this.pids).subscribe( response => { if(this.properties.logServiceUrl) { this.subscriptions.push(this._logService.logOrcidLink(this.properties, "added", this.resultLandingInfo.title, this.resultLandingInfo.identifiers.get('doi')[0]).subscribe(res => { })); @@ -564,7 +579,7 @@ export class OrcidWorkComponent { } private updateWorkPreparation() { - if (!Session.isLoggedIn()) { + if (!this.isLoggedIn) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, @@ -590,7 +605,7 @@ export class OrcidWorkComponent { } private updateWork() { - this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.pids, this.putCodes[0]).subscribe( + this.subscriptions.push(this.orcidService.updateWork(this.resultLandingInfo, this.resultLandingInfo.relcanId, this.pids, this.putCodes[0]).subscribe( response => { if (response) { this.updateDates[0] = response['last-modified-date'].value; @@ -626,7 +641,8 @@ export class OrcidWorkComponent { } public getOrcidWorks() { - if (!Session.isLoggedIn()) { + this.openaireId = null; + if (!this.isLoggedIn) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, @@ -668,7 +684,7 @@ export class OrcidWorkComponent { public deleteWorks(confirmed: boolean = false) { - if (!Session.isLoggedIn()) { + if (!this.isLoggedIn) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, @@ -833,7 +849,7 @@ export class OrcidWorkComponent { this.message += "There was an error getting work \"" + this.resultTitle + "\" from your ORCID record.
Please try again later."; } else if (this.currentAction == "add") { // this.message += "There was an error adding work with pids: "+this.pids+" to your ORCID record.
Please try again later."; - this.message += "There was an error adding work with pids: \"" + this.pids + "\" to your ORCID record.
Please try again later."; + this.message += "There was an error adding work with openaireId: \""+this.resultLandingInfo.relcanId+(this.pids?.length > 0 ? "\" and pids: \"" + this.pids : "") +"\" to your ORCID record.
Please try again later."; } else if (this.currentAction == "update") { // this.message += "There was an error updating work with pids: "+this.pids+" to your ORCID record.
Please try again later."; this.message += "There was an error updating work \"" + this.resultTitle + "\" to your ORCID record.
Please try again later."; @@ -877,7 +893,7 @@ export class OrcidWorkComponent { } get isDisabled() { - return (this.properties.environment == 'beta' || this.showLoading || !this.isLoggedIn || (!this.pids && (!this.identifiers || this.identifiers.size == 0))); + return (this.properties.environment == 'beta' || this.showLoading || !this.isLoggedIn); } get noPids() { diff --git a/orcid/orcid.service.ts b/orcid/orcid.service.ts index 8a48da02..999ffcd6 100644 --- a/orcid/orcid.service.ts +++ b/orcid/orcid.service.ts @@ -11,19 +11,21 @@ import {ConnectHelper} from "../connect/connectHelper"; export class OrcidService { constructor(private http: HttpClient) {} - getPutCode(pids: string) { - let url: string = properties.orcidAPIURL+"local/put-code?pids="+pids; + getPutCode(openaireId: string, pids: string) { + let url: string = properties.orcidAPIURL+"local/put-code?openaireId="+openaireId+(pids ? ("&pids="+pids) : ""); return this.http.get(url, CustomOptions.registryOptions()); } - getPutCodes(pids: string[][]) { + getPutCodes(openaireIds: string[], pids: string[][]) { let url: string = properties.orcidAPIURL+"local/put-codes"; - return this.http.post(url, JSON.stringify(pids), CustomOptions.registryOptions()); + let map = {"pids": pids, "openaireIds": openaireIds}; + return this.http.post(url, JSON.stringify(map), CustomOptions.registryOptions()); } - getLocalWorksByPids(pids: string[][]) { + getLocalWorksByPids(openaireIds: string[], pids: string[][]) { let url: string = properties.orcidAPIURL+"local/works"; - return this.http.post(url, JSON.stringify(pids), CustomOptions.registryOptions()); + let map = {"pids": pids, "openaireIds": openaireIds}; + return this.http.post(url, JSON.stringify(map), CustomOptions.registryOptions()); } getToken(code: string) { @@ -47,14 +49,15 @@ export class OrcidService { return this.http.get(url, CustomOptions.registryOptions()); } - saveWork(resultLandingInfo: ResultLandingInfo, pids: string) { + saveWork(resultLandingInfo: ResultLandingInfo, openaireId: string, pids: string) { let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, null); let portalId: string = ConnectHelper.getCommunityFromDomain(properties.domain); // if dashboard format changes, check in API the metrics service ("calculateMetrics" method) for orcid KPIs let dashboard: string = properties.environment + "_" + properties.dashboard + (portalId? "_" + portalId : ""); let result = { "dashboard": dashboard, - "pids": pids.split(","), + "openaireId": openaireId, + "pids": pids? pids.split(",") : [], "work": work }; let url: string = properties.orcidAPIURL+"orcid/work/save"; @@ -93,10 +96,11 @@ export class OrcidService { // return this.http.post(url, JSON.stringify(work), CustomOptions.registryOptions()) // .pipe(map(res => work)); // } - updateWork(resultLandingInfo: ResultLandingInfo, pids: string, putCode: string) { + updateWork(resultLandingInfo: ResultLandingInfo, openaireId: string, pids: string, putCode: string) { let work = WorkV3_0.resultLandingInfoConvert(resultLandingInfo, putCode); let result = { - "pids": pids.split(","), + "openaireId": openaireId, + "pids": pids ? pids.split(",") : [], "work": work }; diff --git a/orcid/orcidWork.ts b/orcid/orcidWork.ts index 054384a0..e92fbcb2 100644 --- a/orcid/orcidWork.ts +++ b/orcid/orcidWork.ts @@ -154,6 +154,15 @@ export class WorkV3_0 { ) }) })) + } else { + work['external-ids'] = { 'external-id': [{ + "external-id-type": "source-work-id", + "external-id-value": resultLandingInfo.relcanId, + "external-id-relationship": "self", + "external-id-url": { + "value": "https://explore.openaire.eu/search/"+resultLandingInfo.resultType+"?id="+resultLandingInfo.relcanId + }, + }] }; } // url (UrlV3_0, optional), diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 67044711..054997ae 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -409,7 +409,8 @@ [status]=searchUtils.status [type]="entityType" [showLoading]="true" [properties]=properties - [compactView]="compactView"> + [compactView]="compactView" + [isLoggedIn]="isLoggedIn"> { + if (user) { + this.isLoggedIn = true; + } else { + this.isLoggedIn = false; + } + }, error => { + this.isLoggedIn = false; + })); + if(properties.adminToolsPortalType !== "explore") { //this.getDivContents(); this.getPageContents(); diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index cd2467d5..1914bf8d 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -26,6 +26,8 @@ export class SearchResultComponent implements OnInit, OnChanges { @Input() showEnermaps: boolean; @Input() compactView: boolean = false; // if true, show less info (e.g. hide description) on each result + @Input() isLoggedIn: boolean = false; + public isMobile: boolean = false; private subscriptions: any[] = []; @@ -60,25 +62,30 @@ export class SearchResultComponent implements OnInit, OnChanges { } if ((properties.adminToolsPortalType == "explore" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator" || properties.dashboard == "irish") - && Session.isLoggedIn() && this.results && this.results.length > 0 + && this.isLoggedIn && this.results && this.results.length > 0 && (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other") ) { - this.subscriptions.push(this.orcidService.getPutCodes(this.previewResults.map( + this.subscriptions.push(this.orcidService.getPutCodes( + this.previewResults.map(previewResult => {return previewResult.relcanId}), + this.previewResults.map( previewResult => { if (previewResult.identifiers) { - let pidsArray: string[] = []; - for (let key of Array.from(previewResult.identifiers.keys())) { - pidsArray = pidsArray.concat(previewResult.identifiers.get(key)); + let pidsArray: string[] = null; + if(previewResult.identifiers?.size > 0) { + pidsArray = []; + for (let key of Array.from(previewResult.identifiers.keys())) { + pidsArray = pidsArray.concat(previewResult.identifiers.get(key)); + } } return pidsArray;//.join(); } })).subscribe( putCodes => { for (let i = 0; i < this.previewResults.length; i++) { - if (this.previewResults[i].identifiers) { + //if (this.previewResults[i].identifiers) { this.previewResults[i].orcidPutCodes = putCodes[i]; // console.debug(i, this.previewResults[i].orcidPutCodes); - } + //} } this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); }, error => { diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 01ebc125..717ca160 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -193,7 +193,7 @@ [url]="properties.domain + properties.baseLink + url + '?' + urlParam + '=' + result.id" [showTooltip]="false" [compactView]="compactView"> - - 0; + this.showOrcid; } projectActions() { From c507f934a06723c3098d672d0f724c98da680b0e Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 9 Sep 2024 12:54:04 +0300 Subject: [PATCH 2/8] [develop | DONE | FIXED] customCss add checks if identity/customCss not defined --- connect/community/CustomizationOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect/community/CustomizationOptions.ts b/connect/community/CustomizationOptions.ts index 133ffed3..5b552055 100644 --- a/connect/community/CustomizationOptions.ts +++ b/connect/community/CustomizationOptions.ts @@ -187,7 +187,7 @@ export class CustomizationOptions { if (current.identity && current.identity.mainColor && current.identity.secondaryColor) { updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); } - if(!current.identity.customCss){ + if(current.identity && !current.identity.customCss){ current.identity.customCss = defaultCO.identity.customCss; } if (!current.backgrounds) { From 49528c98746591fe519c49944119274fbb97efb3 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 9 Sep 2024 13:22:09 +0300 Subject: [PATCH 3/8] [develop | DONE | FIXED] minor typo in search bar plugin --- .../components/search-bar/plugin-search-bar.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts b/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts index efc1fb63..83704fb2 100644 --- a/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts +++ b/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts @@ -44,7 +44,7 @@ export class PluginSearchBar extends PluginBaseInfo{ -
+
From 8e41736f487e0c5895068e5ca5ec613e288135ef Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Sep 2024 00:20:08 +0300 Subject: [PATCH 4/8] [develop | DONE | ADDED]: fos.component.less: (commented classes) Experimenting on visibility and transitioning of FoS L4. --- fos/fos.component.less | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/fos/fos.component.less b/fos/fos.component.less index c8020e14..bb0f90ed 100644 --- a/fos/fos.component.less +++ b/fos/fos.component.less @@ -3,3 +3,25 @@ .custom-bottom-border { border-bottom: 5px solid fade(@explore-color, @global-opacity); } + +//.child { +// height: 0; +// //visibility: hidden; +// opacity: 0; +//} +// +//.parent:hover .uk-transition-slide-top { +// transition-delay: 0.5s; +//} +// +//.parent:hover .child { +// height: auto; +// visibility: visible; +// opacity: 1; +// //transition-delay: 0.5s; +// //transition: 0.6s ease-out; +//} +// +//.parent { +// //transition: all 0.6s ease-out; +//} \ No newline at end of file From 8f4dc4a4ee81ce22f9a775077e035daea9febd99 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Sep 2024 00:25:40 +0300 Subject: [PATCH 5/8] [develop | DONE | FIXED]: slider-tab.component.ts & slider-tabs.component.ts: Added element for embedded code. --- sharedComponents/tabs/slider-tab.component.ts | 2 +- sharedComponents/tabs/slider-tabs.component.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sharedComponents/tabs/slider-tab.component.ts b/sharedComponents/tabs/slider-tab.component.ts index b2113b55..a8a13a05 100644 --- a/sharedComponents/tabs/slider-tab.component.ts +++ b/sharedComponents/tabs/slider-tab.component.ts @@ -3,7 +3,7 @@ import {ActivatedRoute} from "@angular/router"; @Component({ selector: 'slider-tab', - template: `` + template: `` }) export class SliderTabComponent { @Input("tabTitle") diff --git a/sharedComponents/tabs/slider-tabs.component.ts b/sharedComponents/tabs/slider-tabs.component.ts index ae72cece..dc0419a5 100644 --- a/sharedComponents/tabs/slider-tabs.component.ts +++ b/sharedComponents/tabs/slider-tabs.component.ts @@ -21,6 +21,7 @@ declare var UIkit; @Component({ selector: 'slider-tabs', template: ` +
From 38f411b5145c6c2f19dee2caa95fd172f110bbbb Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Sep 2024 00:36:06 +0300 Subject: [PATCH 6/8] [develop | DONE | REMOVED]: resultLanding.module.ts: Removed unused import of SearchTabModule. --- landingPages/result/resultLanding.module.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index d1792e55..2d7dfc11 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -38,7 +38,6 @@ import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; import {EntityActionsModule} from "../../utils/entity-actions/entity-actions.module"; import {ResultLandingRoutingModule} from "./resultLanding-routing.module"; import {OrcidCoreModule} from "../../orcid/orcid-core.module"; -import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module"; @NgModule({ imports: [ From e66192172a9f19820f3617933412f7edb4d2374e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Sep 2024 02:07:04 +0300 Subject: [PATCH 7/8] [develop | DONE | FIXED]: navigationBar.component.ts: Added a class field public isClient: boolean = false; and set it in constructor with "this.isClient = !isPlatformServer(this.platform);" statement | navigationBar.component.html: Added checks not to display dropdowns on server (needed also for non destructive hydration). --- sharedComponents/navigationBar.component.html | 4 ++-- sharedComponents/navigationBar.component.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index a0147369..8b90121a 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -220,7 +220,7 @@ {{menu.badge}} {{menu.title}} -
+
    @@ -272,7 +272,7 @@ {{menu.title}} -
      diff --git a/sharedComponents/navigationBar.component.ts b/sharedComponents/navigationBar.component.ts index bffc64f1..a0657c2b 100644 --- a/sharedComponents/navigationBar.component.ts +++ b/sharedComponents/navigationBar.component.ts @@ -1,10 +1,10 @@ import { ChangeDetectorRef, - Component, ElementRef, + Component, ElementRef, Inject, Input, OnChanges, OnDestroy, - OnInit, QueryList, + OnInit, PLATFORM_ID, SimpleChanges, ViewChild, ViewChildren } from '@angular/core'; @@ -21,6 +21,7 @@ import {NotificationConfiguration} from "../notifications/notifications-sidebar/ import {SearchInputComponent} from "./search-input/search-input.component"; import {Filter} from "../searchPages/searchUtils/searchHelperClasses.class"; import {RouterHelper} from "../utils/routerHelper.class"; +import {isPlatformServer} from "@angular/common"; declare var UIkit; @@ -97,12 +98,16 @@ export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges { @ViewChild('canvas') canvas: ElementRef; public routerHelper: RouterHelper = new RouterHelper(); + public isClient: boolean = false; constructor(private router: Router, private route: ActivatedRoute, private config: ConfigurationService, private _helpContentService: HelpContentService, private layoutService: LayoutService, - private cdr: ChangeDetectorRef) {} + private cdr: ChangeDetectorRef, + @Inject(PLATFORM_ID) private platform: any) { + this.isClient = !isPlatformServer(this.platform); + } ngOnInit() { this.subs.push(this.route.queryParams.subscribe(params => { From 980fc6a34adb9e4ec7e87948a7c29127a387090c Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Sep 2024 02:13:05 +0300 Subject: [PATCH 8/8] [develop | DONE | FIXED]: userMini.component.ts Added a class field isClient: boolean = false; and set it in constructor with "this.isClient = !isPlatformServer(this.platform);" statement & added checks not to display dropdowns on server (needed also for non destructive hydration). --- login/userMini.component.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/login/userMini.component.ts b/login/userMini.component.ts index 87029003..08d20edc 100644 --- a/login/userMini.component.ts +++ b/login/userMini.component.ts @@ -1,4 +1,14 @@ -import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild} from '@angular/core'; +import { + Component, + EventEmitter, + Inject, + Input, + OnChanges, + OnInit, + Output, PLATFORM_ID, + SimpleChanges, + ViewChild +} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Session, User} from './utils/helper.class'; import {RouterHelper} from '../utils/routerHelper.class'; @@ -9,6 +19,7 @@ import { NotificationConfiguration, NotificationsSidebarComponent } from "../notifications/notifications-sidebar/notifications-sidebar.component"; +import {isPlatformServer} from "@angular/common"; declare var UIkit; @@ -27,7 +38,7 @@ declare var UIkit; -
      +