From f8186cb2ea94a56234d1ebb146bfd270f956264d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 3 Jun 2024 15:59:25 +0300 Subject: [PATCH 1/6] [develop]: Fix check in belongsTo class. --- utils/entities/resultLandingInfo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 453c8297..8097da49 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -70,7 +70,7 @@ export class BelongsTo { if (field) { field = Object.assign({}, field); let json: any = element; - if (field.path.length > 0) { + if (field.path.length > 0 && json) { if (Array.isArray(json)) { return json.findIndex(value => BelongsTo.check(value, field)) != -1; } else { From 3a6b01ebe84d9306aacfe484a0d3da7280103c5d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 3 Jun 2024 17:12:52 +0300 Subject: [PATCH 2/6] [develop | DONE]: Add isBottomIntersecting in layoutService and use is when it is needed. Add capitalize all in order to capitalize all words with whitespace separator. --- .../page-content/page-content.component.ts | 36 ------------------- .../sidebar/layout.service.ts | 21 ++++++++++- .../dataProvider/dataProvider.component.html | 2 +- .../dataProvider/dataProvider.component.ts | 18 ++++------ .../organization/organization.component.html | 2 +- .../organization/organization.component.ts | 18 ++++------ landingPages/project/project.component.html | 2 +- landingPages/project/project.component.ts | 19 ++++------ .../result/resultLanding.component.html | 2 +- .../result/resultLanding.component.ts | 18 ++++------ utils/entities/resultLandingInfo.ts | 2 +- utils/string-utils.class.ts | 8 +++-- 12 files changed, 55 insertions(+), 93 deletions(-) diff --git a/dashboard/sharedComponents/page-content/page-content.component.ts b/dashboard/sharedComponents/page-content/page-content.component.ts index 654f82e6..10b17a94 100644 --- a/dashboard/sharedComponents/page-content/page-content.component.ts +++ b/dashboard/sharedComponents/page-content/page-content.component.ts @@ -132,42 +132,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {end: true, offset: footer_offset}); } - /** - * @deprecated - * - * Should be smooth - * - * */ - private observeBottom() { - let bottom = document.getElementById('bottom'); - if (bottom) { - let bottomObs = new IntersectionObserver(entries => { - entries.forEach(entry => { - this.shouldSticky = !entry.isIntersecting; - }) - }); - this.subscriptions.push(bottomObs); - bottomObs.observe(bottom); - } - } - - /** - * @deprecated - * */ - private observeHeader() { - if (this.header) { - let headerObs = new IntersectionObserver(entries => { - entries.forEach(entry => { - if (entry.boundingClientRect.height > 0) { - this.layoutService.setReplaceHeader(!entry.isIntersecting); - } - }) - }); - this.subscriptions.push(headerObs); - headerObs.observe(this.header.nativeElement); - } - } - private observeStickyFooter() { if (this.sticky_footer) { let resizeObs = new ResizeObserver(entries => { diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index dc515f81..2cf7a798 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -1,4 +1,4 @@ -import {Injectable} from "@angular/core"; +import {AfterViewInit, Injectable} from "@angular/core"; import {BehaviorSubject, Observable, Subscriber} from "rxjs"; import {ActivationStart, Router} from "@angular/router"; import {Icon} from "../../../sharedComponents/menu"; @@ -92,6 +92,7 @@ export class LayoutService { * Display help pop-up on non-admin pages. (default true for the rest of the pages) * */ private hasHelpPopUpSubject: BehaviorSubject = new BehaviorSubject(true); + private isBottomIntersectingSubject: BehaviorSubject = new BehaviorSubject(false); private subscriptions: any[] = []; ngOnDestroy() { @@ -119,6 +120,20 @@ export class LayoutService { this.subscriptions.push(resizeObs); resizeObs.observe(document.documentElement); } + if(typeof document !== "undefined") { + setTimeout(() => { + let bottom = document.getElementById('bottom'); + if (bottom) { + let bottomObs = new IntersectionObserver(entries => { + entries.forEach(entry => { + this.isBottomIntersectingSubject.next(entry.isIntersecting); + }) + }); + this.subscriptions.push(bottomObs); + bottomObs.observe(bottom); + } + }, 500) + } } constructor(private router: Router) { @@ -355,4 +370,8 @@ export class LayoutService { setHasHelpPopUp(value: boolean) { this.hasHelpPopUpSubject.next(value); } + + get isBottomIntersecting(): Observable { + return this.isBottomIntersectingSubject.asObservable(); + } } diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 243bd629..50d88984 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -2,7 +2,7 @@ -
diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index d62da598..60c954ec 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -148,14 +148,13 @@ export class DataProviderComponent { @ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild('descriptionModal') descriptionModal; - // public shouldSticky: boolean = true; - subscriptions = []; private sub: Subscription; properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; public mobileContent: "info" | "metrics" | "actions" = "info"; public tabMobile: string = ""; public viewAllMobile: string = ""; @@ -198,6 +197,11 @@ export class DataProviderComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); if (typeof document !== 'undefined') { this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { @@ -261,16 +265,6 @@ export class DataProviderComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index 353cbf96..c58d75c4 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -3,7 +3,7 @@ [URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId" type="organization"> -
diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 623853f2..d6465383 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -115,8 +115,6 @@ export class OrganizationComponent { public graph_height: number = 0; @ViewChild("graph_and_feedback") graph_and_feedback; - // public shouldSticky: boolean = true; - subscriptions = []; innerReportSubscriptions = []; properties: EnvProperties; @@ -131,6 +129,7 @@ export class OrganizationComponent { public deleteByInferenceOpened: boolean = false; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; public mobileContent: "info" | "actions" = "info"; public viewAllMobile: string = ""; @@ -162,6 +161,11 @@ export class OrganizationComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); this.properties = properties; if (typeof document !== 'undefined') { @@ -218,16 +222,6 @@ export class OrganizationComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index e6a81ce9..18f51940 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -2,7 +2,7 @@ -
diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 380e5806..b70e8b42 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -169,14 +169,13 @@ export class ProjectComponent { @ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild('descriptionModal') descriptionModal; - // public shouldSticky: boolean = true; - subscriptions = []; private sub: Subscription; properties: EnvProperties; public openaireEntities = OpenaireEntities; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; public mobileContent: "info" | "metrics" | "actions" = "info"; public tabMobile: string = ""; public viewAllMobile: string = ""; @@ -209,6 +208,11 @@ export class ProjectComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); this.properties = properties; if (typeof document !== 'undefined') { @@ -278,16 +282,6 @@ export class ProjectComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } @@ -467,7 +461,6 @@ export class ProjectComponent { data => { this.projectInfo = data; this.projectInfo.setBelongsTo(id); - console.log(this.projectInfo); this.projectInfo.id = this.projectId; this.actionsAfterGettingProjectInfo(); diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 45d17250..03ff3145 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -2,7 +2,7 @@ -
diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 59b3c41e..b20fc52c 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -155,8 +155,6 @@ export class ResultLandingComponent { @ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild('descriptionModal') descriptionModal; - // public shouldSticky: boolean = true; - public mobileContent: "info" | "metrics" | "actions" = "info"; public tabMobile: string = ""; public viewAllMobile: string = ""; @@ -164,6 +162,7 @@ export class ResultLandingComponent { @ViewChild("sdgFosSuggest") sdgFosSuggest: SdgFosSuggestComponent; public isMobile: boolean = false; + public isBottomIntersecting: boolean = false; // Full screen modals for small screens (mobile) @ViewChild('summaryFsModal') summaryFsModal: FullScreenModalComponent; @ViewChild('subjectsFsModal') subjectsFsModal: FullScreenModalComponent; @@ -208,6 +207,11 @@ export class ResultLandingComponent { ngOnInit() { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => { + this.isBottomIntersecting = isBottomIntersecting; + this.cdr.detectChanges(); })); this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.isLoggedIn = !!user; @@ -294,16 +298,6 @@ export class ResultLandingComponent { } else { this.offset = 0; } - // let bottom = document.getElementById('bottom'); - // if(bottom) { - // let observer = new IntersectionObserver(entries => { - // entries.forEach(entry => { - // this.shouldSticky = !entry.isIntersecting; - // }) - // }); - // this.subscriptions.push(observer); - // observer.observe(bottom); - // } if(this.graph_and_feedback) { this.observeGraphAndFeedback(); } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 8097da49..8cdf216b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -209,7 +209,7 @@ export class ResultLandingInfo { this.belongsTo = !BelongsTo.result || BelongsTo.result.fields.findIndex(field => BelongsTo.check(this, field)) != -1; this.message = !this.belongsTo ? BelongsTo.result.message : null; if (this.message) { - this.message = this.message.replace('((result))', StringUtils.getEntityName(this.resultType)); + this.message = this.message.replace('((result))', StringUtils.capitalizeAll(StringUtils.getEntityName(this.resultType))); this.message = this.message.replace('((type_id))', typeId); this.message = this.message.replace('((id))', id); } diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index 3ccf6e6b..9c5ca69c 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -443,9 +443,13 @@ export class StringUtils { }); return words; } + + public static capitalizeAll(str: string): string { + return str.split(' ').map(value => StringUtils.capitalize(value)).join(' '); + } - public static capitalize(value: string): string { - return value.charAt(0).toUpperCase() + value.slice(1); + public static capitalize(str: string): string { + return str.charAt(0).toUpperCase() + str.slice(1); } /** From 2bfe25103be4dea1f94b3a3c4ed5588356b3fce6 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 4 Jun 2024 11:46:21 +0300 Subject: [PATCH 3/6] [develop]: Comment console logs --- claims/claim-utils/claimContextSearchForm.component.ts | 2 +- claims/claim-utils/claimHelper.class.ts | 2 +- claims/claim-utils/displayClaims/displayClaims.component.ts | 2 +- claims/claim-utils/service/searchOrcid.service.ts | 3 --- claims/linking/bulkClaim/bulkClaim.component.ts | 2 +- claims/linking/insertClaim/insertClaim.component.ts | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts index bed48c8f..71977c69 100644 --- a/claims/claim-utils/claimContextSearchForm.component.ts +++ b/claims/claim-utils/claimContextSearchForm.component.ts @@ -129,7 +129,7 @@ export class ClaimContextSearchFormComponent { } select(communityId, communityLabel) { - console.log("SELECT", communityId) + // console.log("SELECT", communityId) this.selectedCommunityId = communityId; this.selectedCommunityLabel = communityLabel; this.getCategories(); diff --git a/claims/claim-utils/claimHelper.class.ts b/claims/claim-utils/claimHelper.class.ts index c9d82250..9e248510 100644 --- a/claims/claim-utils/claimHelper.class.ts +++ b/claims/claim-utils/claimHelper.class.ts @@ -202,6 +202,6 @@ export class ShowOptions { options.push({value: 'context',label: OpenaireEntities.COMMUNITIES}) } this.selectOptions = options; - console.log(options, claimProperties.SELECT_ENTITIES.projects) + // console.log(options, claimProperties.SELECT_ENTITIES.projects) } } diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 9e9e4648..f2b50af5 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -329,7 +329,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { delete() { let claimsToBeDeleted = ((this.index != null) ? [this.claims[this.index].id] : this.selected.map(claim => claim.id)); - console.log(claimsToBeDeleted); + // console.log(claimsToBeDeleted); this.subscriptions.push(this._claimService.deleteBulk(claimsToBeDeleted, this.properties.claimsAPIURL).subscribe( res => { if (this.index != null) { diff --git a/claims/claim-utils/service/searchOrcid.service.ts b/claims/claim-utils/service/searchOrcid.service.ts index 892dc77d..b71df253 100644 --- a/claims/claim-utils/service/searchOrcid.service.ts +++ b/claims/claim-utils/service/searchOrcid.service.ts @@ -108,7 +108,6 @@ export class SearchOrcidService { static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any { - console.log(data) if (data[2] != null) { if (addId) { authorIds.push(data[2].path); @@ -128,9 +127,7 @@ export class SearchOrcidService { if (data[3] != null) { author['institution'] = data[3]; } - console.log(author['institution']) authors.push(author); - return true; } return false; diff --git a/claims/linking/bulkClaim/bulkClaim.component.ts b/claims/linking/bulkClaim/bulkClaim.component.ts index 79654726..0e296e87 100644 --- a/claims/linking/bulkClaim/bulkClaim.component.ts +++ b/claims/linking/bulkClaim/bulkClaim.component.ts @@ -133,11 +133,11 @@ export class BulkClaimComponent { } }); } + upload() { this.enableUpload = false; this.showReport = false; this.errorMessage = ""; - console.log(this.filesToUpload); if (this.filesToUpload.length == 0) { this.errorMessage = "There is no selected file to upload."; return; diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index 4aebe5f3..17c920ba 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -232,7 +232,7 @@ export class ClaimInsertComponent { data => { this.feedRecordsJob = data.data; this.records2Insert = directclaims.length; - console.log(data); + // console.log(data); // this.insertedRecords = data.insertedIds; // // this.errorInRecords = data.errorInClaims; From ca6f1fd7511d401c3eaf0fb1a4313d9fd2862770 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 4 Jun 2024 11:48:54 +0300 Subject: [PATCH 4/6] [develop | DONE | FIXED]: result-preview.component.html: Added check, not to show acronym & title when they are the same. --- utils/result-preview/result-preview.component.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index c6cc5f77..57caefb0 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -3,9 +3,11 @@ {{result.acronym}} - ( - - ) + + ( + + ) +
[no title available] From b0a2ed1865bdf251af3c77ff2c728a7af278705f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 4 Jun 2024 12:23:32 +0300 Subject: [PATCH 5/6] [develop]: Add loading in directLinking and add different ratio for svg icons in sidebar. --- claims/directLinking/directLinking.component.html | 1 + claims/directLinking/directLinking.module.ts | 3 ++- dashboard/sharedComponents/sidebar/sideBar.component.html | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/claims/directLinking/directLinking.component.html b/claims/directLinking/directLinking.component.html index f34e2c57..ea196bf3 100644 --- a/claims/directLinking/directLinking.component.html +++ b/claims/directLinking/directLinking.component.html @@ -1,3 +1,4 @@ + diff --git a/claims/directLinking/directLinking.module.ts b/claims/directLinking/directLinking.module.ts index 9505f79d..5d53bb6b 100644 --- a/claims/directLinking/directLinking.module.ts +++ b/claims/directLinking/directLinking.module.ts @@ -8,12 +8,13 @@ import {SearchResearchResultsServiceModule} from '../../services/searchResearchR import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import {LinkingGenericModule} from '../linking/linkingGeneric.module'; +import {LoadingModule} from "../../utils/loading/loading.module"; @NgModule({ imports: [ SharedModule, EntitySearchServiceModule, SearchResearchResultsServiceModule, - Schema2jsonldModule, SEOServiceModule, LinkingGenericModule + Schema2jsonldModule, SEOServiceModule, LinkingGenericModule, LoadingModule ], providers:[], declarations: [ diff --git a/dashboard/sharedComponents/sidebar/sideBar.component.html b/dashboard/sharedComponents/sidebar/sideBar.component.html index 4d92e286..65ee64a3 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.component.html +++ b/dashboard/sharedComponents/sidebar/sideBar.component.html @@ -40,7 +40,7 @@
- +
{{item.title}} From 9ae1ee928a7c467540cefe3ffea96efe54a91456 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 4 Jun 2024 12:55:36 +0300 Subject: [PATCH 6/6] [develop]: Add ration in Icon class and use it in sidebar. --- dashboard/sharedComponents/sidebar/sideBar.component.html | 2 +- sharedComponents/menu.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dashboard/sharedComponents/sidebar/sideBar.component.html b/dashboard/sharedComponents/sidebar/sideBar.component.html index 65ee64a3..ad50df30 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.component.html +++ b/dashboard/sharedComponents/sidebar/sideBar.component.html @@ -40,7 +40,7 @@
- +
{{item.title}} diff --git a/sharedComponents/menu.ts b/sharedComponents/menu.ts index b4328834..841086f0 100644 --- a/sharedComponents/menu.ts +++ b/sharedComponents/menu.ts @@ -1,7 +1,8 @@ export interface Icon { name?: string, svg?: string, - class?: string + class?: string, + ratio?: number } export class MenuItem { @@ -90,4 +91,4 @@ export class SideMenuItem extends MenuItem { ukIcon: string = ''; } -export enum MenuAlignment {LEFT = "LEFT", CENTER = "CENTER", RIGHT = "RIGHT"} \ No newline at end of file +export enum MenuAlignment {LEFT = "LEFT", CENTER = "CENTER", RIGHT = "RIGHT"}