From e80df9f3b0588f0f97fe1bfc211dc76e9850df81 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Thu, 16 May 2024 10:14:42 +0300 Subject: [PATCH] [recommendations-functionality | WIP] resultLanding page: add recommendations tab, 'back' button, recommendations SVG icon as code - fc4eos only --- .../result/resultLanding.component.html | 29 +++++++++++++++++-- .../result/resultLanding.component.ts | 22 ++++++++++++-- landingPages/result/resultLanding.module.ts | 3 +- utils/icons/icons.ts | 5 ++++ utils/tabs/tabs.component.ts | 3 +- 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 487895c3..049b76a6 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -2,7 +2,6 @@ -
@@ -20,6 +19,13 @@
+ +
@@ -47,7 +53,6 @@
-
@@ -56,7 +61,7 @@
-
+
@@ -161,6 +166,10 @@ [tabTitle]="'Enermaps Tool'" [tabId]="'enermaps'" customClass="portalTab"> + +
@@ -193,6 +202,11 @@
+ + +
+ + @@ -965,6 +981,13 @@ + +
+ + Recommended for you +
+
+
    diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 769f1975..928e9cad 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -29,6 +29,7 @@ import {FullScreenModalComponent} from "../../utils/modal/full-screen-modal/full import {SdgFosSuggestComponent} from '../landing-utils/sdg-fos-suggest/sdg-fos-suggest.component'; import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service"; import {ContextsService} from "../../claims/claim-utils/service/contexts.service"; +import {RecommendationsService} from '../../../recommendations/recommendations.service'; declare var ResizeObserver; @@ -39,6 +40,7 @@ declare var ResizeObserver; export class ResultLandingComponent { public referrer: string; public prevPath: string; + public sessionStorage = sessionStorage; @Input() type: string = "publication"; @@ -182,6 +184,9 @@ export class ResultLandingComponent { public rightSidebarOffcanvasClicked: boolean = false; public egiTransferModalOpen = false; + + getRecommendationsForPublicationAPI: string = 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/item_to_item/' + constructor(private _resultLandingService: ResultLandingService, private _vocabulariesService: ISVocabulariesService, private _piwikService: PiwikService, @@ -198,7 +203,8 @@ export class ResultLandingComponent { private indexInfoService: IndexInfoService, private userManagementService: UserManagementService, private layoutService: LayoutService, - private _contextService: ContextsService) { + private _contextService: ContextsService, + private recommendationsService: RecommendationsService) { if(route.snapshot.data && route.snapshot.data['type']) { this.type = route.snapshot.data['type']; } @@ -280,7 +286,6 @@ export class ResultLandingComponent { }); } - this.scroll(); })); } @@ -965,6 +970,9 @@ export class ResultLandingComponent { if (activeTabId == 'enermaps' && this.properties.enermapsURL) { this.getEnermapsDetails(this.enermapsId); } + if (activeTabId == 'recommended' && this.properties.adminToolsPortalType == 'faircore4eosc') { + this.getRecommendations(); + } } } @@ -982,6 +990,12 @@ export class ResultLandingComponent { } } + private getRecommendations() { + this.subscriptions.push(this.recommendationsService.getRecommendationsForPublication(this.getRecommendationsForPublicationAPI, 'enermaps', this.resultLandingInfo.objIdentifier).subscribe(data => { + console.log(data); + })); + } + public enrichContexts(contextsWithLink: any) { this.contextsWithLink = contextsWithLink; } @@ -1215,4 +1229,8 @@ export class ResultLandingComponent { return "https://"+(this.properties.environment == "beta" ? "beta." : "")+"search.marketplace.eosc-portal.eu/"; } } + + public goBack() { + window.history.back(); + } } diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index d1792e55..c036e6bf 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -39,6 +39,7 @@ import {EntityActionsModule} from "../../utils/entity-actions/entity-actions.mod import {ResultLandingRoutingModule} from "./resultLanding-routing.module"; import {OrcidCoreModule} from "../../orcid/orcid-core.module"; import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module"; +import {RecommendationsService} from '../../../recommendations/recommendations.service'; @NgModule({ imports: [ @@ -55,7 +56,7 @@ import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module"; ResultLandingComponent ], providers: [ - ResultLandingService + ResultLandingService, RecommendationsService ], exports: [ ResultLandingComponent diff --git a/utils/icons/icons.ts b/utils/icons/icons.ts index 0b778656..1a4ac6b9 100644 --- a/utils/icons/icons.ts +++ b/utils/icons/icons.ts @@ -161,3 +161,8 @@ export const unknown_access: Icon = { name: 'unknown_access', data: '' } + +export const recommendations: Icon = { + name: 'recommendations', + data: ' ' +} diff --git a/utils/tabs/tabs.component.ts b/utils/tabs/tabs.component.ts index a819f293..68cb35c4 100644 --- a/utils/tabs/tabs.component.ts +++ b/utils/tabs/tabs.component.ts @@ -51,12 +51,13 @@ import {TabComponent} from './tab.component';