From c8cdfb1417a7f3ca64756d8e7e560a2d7e8ac38f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 20 Apr 2023 14:40:18 +0300 Subject: [PATCH 01/13] Update library to the latest connect production --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index da144c1..faa57d9 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit da144c1c77012fa4489dd84f013d499f9df8f72a +Subproject commit faa57d99d193f6904c6a57363718d3269c843c13 From 8da98e7959e6d50e9b2a5b5185b50995c7f029f3 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 20 Apr 2023 15:02:55 +0300 Subject: [PATCH 02/13] Update assets and theme --- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/common-assets b/src/assets/common-assets index cd44ace..d772dbd 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit cd44ace5d067999ed6d852f20204d5a05385580b +Subproject commit d772dbd4b2f2d8af9e26d98eed7417f2fbf15c3a diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 99ecab0..2882ccd 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 99ecab0b4e9ceed21424c8fa26ef270b4695b11e +Subproject commit 2882ccde4eb93bd01b4cdb480790cc04b394794d From e6e9e06dfa7956621b006f5f494bc91a7182aa27 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 21 Apr 2023 15:09:22 +0300 Subject: [PATCH 03/13] [Connect | master]: Added FoS and SDGs pages in Community Gateways | Bug fixes in piwik siteIds. 1. app.component.ts: Added MenuItems for Fields of Science and Sustainable Development Goals. 2. app-routing.module.ts: Added routing paths for /sdgs and /fields-of-science. 3. /fos & /sdgs: Added folders and files for new SDGs and FoS pages. 4. piwikHelper.ts: Added piwik for "egrise", "euconexus", "dth". 5. affiliations.component.ts: [Bug fix] Comment piwik track call (this component is called with/in other pages that are already tracked). 6. htmlPage.component.ts: [Bug fix] Get piwik siteId from PiwikHelper (TODO: Should get it by API). --- .../affiliations/affiliations.component.ts | 2 +- src/app/app-routing.module.ts | 17 ++++++++++-- src/app/app.component.ts | 2 ++ src/app/fos/fos-routing.module.ts | 20 ++++++++++++++ src/app/fos/fos.component.ts | 24 +++++++++++++++++ src/app/fos/fos.module.ts | 27 +++++++++++++++++++ src/app/htmlPages/htmlPage.component.ts | 13 +++++---- src/app/sdg/sdg-routing.module.ts | 20 ++++++++++++++ src/app/sdg/sdg.component.ts | 23 ++++++++++++++++ src/app/sdg/sdg.module.ts | 27 +++++++++++++++++++ src/app/utils/piwikHelper.ts | 16 ++++++----- 11 files changed, 176 insertions(+), 15 deletions(-) create mode 100644 src/app/fos/fos-routing.module.ts create mode 100644 src/app/fos/fos.component.ts create mode 100644 src/app/fos/fos.module.ts create mode 100644 src/app/sdg/sdg-routing.module.ts create mode 100644 src/app/sdg/sdg.component.ts create mode 100644 src/app/sdg/sdg.module.ts diff --git a/src/app/affiliations/affiliations.component.ts b/src/app/affiliations/affiliations.component.ts index c980b4f..43f27d7 100644 --- a/src/app/affiliations/affiliations.component.ts +++ b/src/app/affiliations/affiliations.component.ts @@ -53,7 +53,7 @@ export class AffiliationsComponent { this.properties = properties; if(this.longView) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe()); + // this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe()); } this.url = this.properties.domain + this._router.url; this.seoService.createLinkForCanonicalURL(this.url); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4d06e93..5dfc9a2 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -10,14 +10,27 @@ const routes: Routes = [ {path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)}, /** Other Pages */ - {path: '', loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule)}, + { + path: '', + loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule) + }, {path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'}, {path: 'about/learn-how', loadChildren: () => import('./learn-how/learn-how.module').then(m => m.LearnHowModule)}, {path: 'about/faq', loadChildren: () => import('./learn-how/faqs/faqs.module').then(m => m.FaqsModule)}, {path: 'get-started', loadChildren: () => import('./get-started/get-started.module').then(m => m.GetStartedModule)}, {path: 'contact-us', loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)}, {path: 'invite', loadChildren: () => import('./utils/subscribe/invite/invite.module').then(m => m.InviteModule)}, - {path: 'content', loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), canActivate: [IsCommunity]}, + { + path: 'content', + loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), + canActivate: [IsCommunity] + }, + {path: 'sdgs', loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule)}, + { + path: 'fields-of-science', + loadChildren: () => import('./fos/fos.module').then(m => m.LibFosModule), + data: {extraOffset: 100} + }, { path: 'organizations', loadChildren: () => import('./htmlPages/organizations/organizationsPage.module').then(m => m.OrganizationsPageModule), diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5fd807d..92eefcf 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -377,6 +377,8 @@ export class AppComponent implements OnInit, OnDestroy { new MenuItem("", "National Bulletins", "", "/national-bulletins", false, [], ["/national-bulletins"], {}), new MenuItem("", "Subjects", "", "/subjects", false, [], ["/subjects"], {}), new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}), + new MenuItem("", "Fields of Science", "", "/fields-of-science", false, [], ["/fields-of-science"], {}), + new MenuItem("", "Sustainable Development Goals", "", "/sdgs", false, [], ["/sdgs"], {}), ] )); this.menuItems.push( diff --git a/src/app/fos/fos-routing.module.ts b/src/app/fos/fos-routing.module.ts new file mode 100644 index 0000000..fdbb09c --- /dev/null +++ b/src/app/fos/fos-routing.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {CommunityFosComponent} from "./fos.component"; +import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: CommunityFosComponent, + canActivate: [IsRouteEnabled], + canDeactivate: [PreviousRouteRecorder] + } + ]) + ] +}) +export class LibFosRoutingModule { +} \ No newline at end of file diff --git a/src/app/fos/fos.component.ts b/src/app/fos/fos.component.ts new file mode 100644 index 0000000..b2e9471 --- /dev/null +++ b/src/app/fos/fos.component.ts @@ -0,0 +1,24 @@ +import {Component} from "@angular/core"; +import {properties} from "../../environments/environment"; +import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; +import {PiwikHelper} from "../utils/piwikHelper"; + +@Component({ + selector: 'community-fos', + template: ` + + ` +}) + +export class CommunityFosComponent { + piwikSiteId; + communityId; + + constructor() { + } + + ngOnInit() { + this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); + this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); + } +} \ No newline at end of file diff --git a/src/app/fos/fos.module.ts b/src/app/fos/fos.module.ts new file mode 100644 index 0000000..5d1d24e --- /dev/null +++ b/src/app/fos/fos.module.ts @@ -0,0 +1,27 @@ +import {CommonModule} from "@angular/common"; +import {NgModule} from "@angular/core"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {LibFosRoutingModule} from "./fos-routing.module"; +import {FosRoutingModule} from "../openaireLibrary/fos/fos-routing.module"; +import {FosModule} from "../openaireLibrary/fos/fos.module"; +import {CommunityFosComponent} from "./fos.component"; + +@NgModule({ + imports: [ + CommonModule, + LibFosRoutingModule, + FosRoutingModule, + FosModule + ], + declarations: [ + CommunityFosComponent + ], + exports: [ + CommunityFosComponent + ], + providers: [ + PreviousRouteRecorder + ] +}) +export class LibFosModule { +} \ No newline at end of file diff --git a/src/app/htmlPages/htmlPage.component.ts b/src/app/htmlPages/htmlPage.component.ts index 8461032..f77366c 100644 --- a/src/app/htmlPages/htmlPage.component.ts +++ b/src/app/htmlPages/htmlPage.component.ts @@ -8,6 +8,7 @@ import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {Subscriber} from "rxjs"; import {properties} from "../../environments/environment"; +import {PiwikHelper} from "../utils/piwikHelper"; @Component({ selector: 'html-page', @@ -21,26 +22,28 @@ export class HtmlPageComponent { properties: EnvProperties = properties; public pageContents = null; public divContents = null; - + @Input() url: string = null; @Input() pageTitle: string; @Input() description: string; private subscriptions = []; communityId; - - constructor(private route: ActivatedRoute, private _router: Router, + piwikSiteId; + + constructor(private route: ActivatedRoute, private _router: Router, private _meta: Meta, private _title: Title, private seoService: SEOService, private _piwikService: PiwikService, private helper: HelperService) { } - + public ngOnInit() { + this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); + this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); } - this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); //TODO set the proper URL this.url = this.properties.domain + this._router.url; this.seoService.createLinkForCanonicalURL(this.url); diff --git a/src/app/sdg/sdg-routing.module.ts b/src/app/sdg/sdg-routing.module.ts new file mode 100644 index 0000000..b1020cd --- /dev/null +++ b/src/app/sdg/sdg-routing.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {CommunitySdgComponent} from "./sdg.component"; +import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: CommunitySdgComponent, + canActivate: [IsRouteEnabled], + canDeactivate: [PreviousRouteRecorder] + } + ]) + ] +}) +export class LibSdgRoutingModule { +} \ No newline at end of file diff --git a/src/app/sdg/sdg.component.ts b/src/app/sdg/sdg.component.ts new file mode 100644 index 0000000..3f29b2a --- /dev/null +++ b/src/app/sdg/sdg.component.ts @@ -0,0 +1,23 @@ +import {Component} from "@angular/core"; +import {properties} from "../../environments/environment"; +import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; +import {PiwikHelper} from "../utils/piwikHelper"; + +@Component({ + selector: 'community-sdg', + template: ` + + ` +}) +export class CommunitySdgComponent { + piwikSiteId; + communityId; + + constructor() { + } + + ngOnInit() { + this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); + this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); + } +} \ No newline at end of file diff --git a/src/app/sdg/sdg.module.ts b/src/app/sdg/sdg.module.ts new file mode 100644 index 0000000..b3c4f2a --- /dev/null +++ b/src/app/sdg/sdg.module.ts @@ -0,0 +1,27 @@ +import {CommonModule} from "@angular/common"; +import {NgModule} from "@angular/core"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {LibSdgRoutingModule} from "./sdg-routing.module"; +import {SdgRoutingModule} from "../openaireLibrary/sdg/sdg-routing.module"; +import {SdgModule} from "../openaireLibrary/sdg/sdg.module"; +import {CommunitySdgComponent} from "./sdg.component"; + +@NgModule({ + imports: [ + CommonModule, + LibSdgRoutingModule, + SdgRoutingModule, + SdgModule + ], + declarations: [ + CommunitySdgComponent + ], + exports: [ + CommunitySdgComponent + ], + providers: [ + PreviousRouteRecorder + ] +}) +export class LibSdgModule { +} \ No newline at end of file diff --git a/src/app/utils/piwikHelper.ts b/src/app/utils/piwikHelper.ts index a5a1989..a8d18e7 100644 --- a/src/app/utils/piwikHelper.ts +++ b/src/app/utils/piwikHelper.ts @@ -27,20 +27,22 @@ export class PiwikHelper{ "inspired-ris":530, "citizen-science":538, "eut":558, - "aurora":560, + "aurora": 560, "ebrains": 592, - "neanias-space":604, - "heritage-science":607, - "eutopia":608, + "neanias-space": 604, + "heritage-science": 607, + "eutopia": 608, "north-america-studies": 609, - "iperionhs":610, + "iperionhs": 610, "neanias-atmospheric": 613, "forthem": 625, "argo-france": 634, - "knowmad": 640 + "knowmad": 640, + "egrise": 710, + "euconexus": 707, + "dth": 719 }; public static getSiteId(communityId:string){ return this.siteIDs[communityId]; } - } From 482f0e28164b57950a41003cd3676fb56699c272 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 2 May 2023 14:31:15 +0300 Subject: [PATCH 04/13] Update library before beta deployment --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index c547dfa..3be6013 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit c547dfa9453b9a68befb41f447d8c410eb7aea2c +Subproject commit 3be6013644a90d9a49c08a71c75fb7549d8b3e69 From 4060fd9fad0567c08939273c3bc0de5425857109 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 11 May 2023 14:36:54 +0300 Subject: [PATCH 05/13] Fix login property. Fix bottom observer in server side. Update library --- src/app/app.component.ts | 2 +- src/app/openaireLibrary | 2 +- src/environments/environment.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5fd807d..aab6bab 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -474,7 +474,7 @@ export class AppComponent implements OnInit, OnDestroy { restrictedData ? "" : "/myCommunities", false, [], [], {})); } this.showMenu = true; - if (typeof document !== "undefined") { + if (typeof document !== "undefined" && this.bottom) { setTimeout(() => { this.createObservers(); }); diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 3be6013..73f2215 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 3be6013644a90d9a49c08a71c75fb7549d8b3e69 +Subproject commit 73f2215c07e4188bc762088c761ea312f076a2a6 diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 3b574d9..43e6812 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -58,7 +58,7 @@ export let properties: EnvProperties = { piwikBaseUrl: 'https://analytics.openaire.eu/piwik.php?idsite=', piwikSiteId: '80', registryUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/registry/', - loginUrl: "http://mpagasas.di.uoa.gr:19080/login-service//openid_connect_login", + loginUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_connect_login", userInfoUrl: "http://mpagasas.di.uoa.gr:19080/login-service/userInfo", logoutUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_logout", cookieDomain: '.di.uoa.gr', From bb67b6a668e0098a6bd3a798b3fb1c31c421df1c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 24 May 2023 12:37:20 +0300 Subject: [PATCH 06/13] Community home page: Init resultTypes to empty array before adding entities. --- src/app/community/community.component.ts | 1 + src/app/openaireLibrary | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index cc9fccd..88495d1 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -312,6 +312,7 @@ export class CommunityComponent { this.showOrp = !!showEntity["orp"]; this.showProjects = !!showEntity["project"]; this.showDataProviders = !!showEntity["datasource"]; + this.resultTypes.values = []; if (this.showPublications) { this.resultTypes.values.push({ name: this.openaireEntities.PUBLICATIONS, diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 73f2215..2b83920 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 73f2215c07e4188bc762088c761ea312f076a2a6 +Subproject commit 2b83920bc46f634921aeae2d7a05e49608047cb7 From c9d02ebcd7832200ba54021261ca13b62d793e4f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 24 May 2023 12:38:04 +0300 Subject: [PATCH 07/13] Update assets and theme --- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/common-assets b/src/assets/common-assets index ca209a5..f15bbfa 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit ca209a54baaa2d9e0004613a68088fdcf4bee43a +Subproject commit f15bbfa7265f170e06b256f086f2acedfa3f72e0 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index aa1e6c9..c92a0de 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit aa1e6c9df390a4ba0919b5f8591374f7eec75089 +Subproject commit c92a0dea1b7fc51f0cf272f8d4343735d000a23b From 27511be14e272bae0e6e66dfd79660f0023c941f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 24 May 2023 14:31:50 +0300 Subject: [PATCH 08/13] App component: Check this.document instead of client document. --- src/app/app.component.ts | 4 ++-- src/app/openaireLibrary | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index aab6bab..b62a7f0 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -271,12 +271,12 @@ export class AppComponent implements OnInit, OnDestroy { initAdminToolCommunity(communityId) { if (communityId) { this.properties.adminToolsPortalType = "community"; - if (typeof document === 'undefined') { + if (this.document) { this.initLayout(communityId); } }else{ this.properties.adminToolsPortalType = "connect"; - if (typeof document === 'undefined') { + if (this.document) { this.initLayout('connect'); } } diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 2b83920..e6974df 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 2b83920bc46f634921aeae2d7a05e49608047cb7 +Subproject commit e6974dfd0f989955999f7ccffa19e2e266867723 From a855a7491de76cf855c527cefdb798eb7bb2668c Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 25 May 2023 12:24:47 +0300 Subject: [PATCH 09/13] [Connect | develop]: app.component.ts: Updated when and how "initAdminToolCommunity()" is called to init css - for community gateway, always display its customized css when exists | Updating libraries. --- src/app/app.component.ts | 15 +++++++++++---- src/app/openaireLibrary | 2 +- src/assets/openaire-theme | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b62a7f0..ffd1579 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -228,7 +228,7 @@ export class AppComponent implements OnInit, OnDestroy { private init() { let communityId: string = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.showMenu = false; - this.initAdminToolCommunity(communityId); + // this.initAdminToolCommunity(communityId); this.buildMenu(communityId); // this.communityId = communityId; if (!communityId) { @@ -299,6 +299,7 @@ export class AppComponent implements OnInit, OnDestroy { } initLayout(communityId){ if(!this.layout && (typeof location == 'undefined') && !this.previewLayout) { + // if((typeof location == 'undefined') && !this.previewLayout) { this.subscriptions.push(this.layoutSub.subscribe(value => { this.layout = this.layouts.filter(layout => layout.portalPid == communityId)[0]?this.layouts.filter(layout => layout.portalPid == communityId)[0]:this.layouts.filter(layout => layout.portalPid == 'default')[0]; this.initCss(this.layout.portalPid, this.layout.date?this.layout.date:null) @@ -331,6 +332,8 @@ export class AppComponent implements OnInit, OnDestroy { buildCommunityMenu(){ if (this.community && !ConnectHelper.isPrivate(this.community, this.user)) { this.communityId = this.community.communityId; + this.initAdminToolCommunity(this.communityId); + this.header = { // url: 'https://' + (this.properties.environment == 'beta' ? 'beta.' : '') + this.community.id + '.openaire.eu', route: "/", @@ -405,14 +408,16 @@ export class AppComponent implements OnInit, OnDestroy { } this.showMenu = true; } else { + this.initAdminToolCommunity(this.communityId); + this.communityId = null; this.properties.adminToolsPortalType = "connect"; this.configurationService.initCommunityInformation(this.properties, "connect"); - this.initAdminToolCommunity(null); + // this.initAdminToolCommunity(null); this.buildConnectMenu(true); if (this.community && this.community.status == "manager") { - if (!this.user ) { - if(typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) { + if (!this.user) { + if (typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) { this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_LOGIN, @@ -433,6 +438,8 @@ export class AppComponent implements OnInit, OnDestroy { } } buildConnectMenu(restrictedData: boolean = false) { + this.initAdminToolCommunity(null); + let url = "https://" + (properties.environment != "production" ? "beta." : "") + "connect.openaire.eu"; this.header = { route: restrictedData ? "" : "/", diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index e6974df..95a3cc3 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit e6974dfd0f989955999f7ccffa19e2e266867723 +Subproject commit 95a3cc3ff62983d593730827a8d07fd43887627b diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index c92a0de..468b2b0 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit c92a0dea1b7fc51f0cf272f8d4343735d000a23b +Subproject commit 468b2b008f474c88dacc52991a5231693833f1f9 From 59b6d14342aa2e87407f5eeab67b8b64974cb926 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 25 May 2023 16:38:18 +0300 Subject: [PATCH 10/13] Add hasMachineCache: true in production. Fix css loading bug when a community is restricted. --- src/app/app.component.ts | 200 +++++++++++++++------------ src/app/openaireLibrary | 2 +- src/environments/environment.prod.ts | 3 +- 3 files changed, 113 insertions(+), 92 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ffd1579..9a1710a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,13 @@ -import {Component, ElementRef, Inject, OnDestroy, OnInit, RendererFactory2, ViewChild, ViewEncapsulation} from '@angular/core'; +import { + Component, + ElementRef, + Inject, + OnDestroy, + OnInit, PLATFORM_ID, + RendererFactory2, + ViewChild, + ViewEncapsulation +} from '@angular/core'; import {ActivatedRoute, NavigationEnd, Router} from '@angular/router'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; @@ -11,14 +20,14 @@ import {UserManagementService} from "./openaireLibrary/services/user-management. import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {properties} from '../environments/environment'; import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component"; -import {AsyncSubject, Subscriber} from "rxjs"; +import {Subscriber} from "rxjs"; import {CommunityService} from "./openaireLibrary/connect/community/community.service"; import {StringUtils} from "./openaireLibrary/utils/string-utils.class"; import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class"; -import {CustomizationOptions, Layout} from "./openaireLibrary/connect/community/CustomizationOptions"; +import {Layout} from "./openaireLibrary/connect/community/CustomizationOptions"; import {CustomizationService} from "./openaireLibrary/services/customization.service"; import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll"; -import {Meta} from "@angular/platform-browser"; +import {makeStateKey, Meta, StateKey, TransferState} from "@angular/platform-browser"; import {CommunityInfo} from "./openaireLibrary/connect/community/communityInfo"; import {SEOService} from "./openaireLibrary/sharedComponents/SEO/SEO.service"; import {UntypedFormBuilder, UntypedFormGroup, Validators} from "@angular/forms"; @@ -29,7 +38,8 @@ import {QuickContactComponent} from "./openaireLibrary/sharedComponents/quick-co import {Composer} from "./openaireLibrary/utils/email/composer"; import {NotificationHandler} from "./openaireLibrary/utils/notification-handler"; import {OpenaireEntities} from "./openaireLibrary/utils/properties/searchFields"; -import {DOCUMENT} from "@angular/common"; +import {DOCUMENT, isPlatformServer} from "@angular/common"; +import {AdvancedAsyncSubject} from "./openaireLibrary/utils/AdvancedAsyncSubject"; @Component({ selector: 'app-root', @@ -44,7 +54,9 @@ import {DOCUMENT} from "@angular/common"; Get Started - Get Started + Get Started + [name]="(community.shortTitle) ? community.shortTitle : community.title" + [description]="community.description">
@@ -89,17 +102,17 @@ import {DOCUMENT} from "@angular/common"; + [properties]="properties"> - + [showSocialButtons]="true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true" + [communityId]="community.communityId" [menuItems]=bottomMenuItems [properties]="properties" [centered]="true"> + + [id]="community.communityId" [name]="community.title" + [type]="community.type">
` @@ -109,7 +122,7 @@ export class AppComponent implements OnInit, OnDestroy { userMenuItems: MenuItem[] = []; menuItems: MenuItem [] = []; bottomMenuItems: MenuItem[] = []; - public community:CommunityInfo = null; + public community: CommunityInfo = null; properties: EnvProperties = properties; showMenu: boolean = false; communities = null; @@ -125,15 +138,20 @@ export class AppComponent implements OnInit, OnDestroy { public images: string[] = []; @ViewChild('modal') modal: AlertModal; @ViewChild('quickContact') quickContact: QuickContactComponent; - @ViewChild('bottom', {read: ElementRef}) bottom: ElementRef; + @ViewChild('bottom', {read: ElementRef}) bottom: ElementRef; private subscriptions = []; layout: Layout = null; layouts: Layout[] = null; layoutDefault: Layout = null; layoutConnect: Layout = null; - layoutSub = new AsyncSubject(); + layoutSub = new AdvancedAsyncSubject(); previewLayout = null; - constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, + /** + * key for portal identity check (client - server: using transfer state + * */ + key: StateKey = makeStateKey('portal'); + + constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, private _communitiesService: CommunitiesService, private smoothScroll: SmoothScroll, private router: Router, private userManagementService: UserManagementService, private configurationService: ConfigurationService, private _communityService: CommunityService, @@ -141,8 +159,11 @@ export class AppComponent implements OnInit, OnDestroy { private quickContactService: QuickContactService, private fb: UntypedFormBuilder, private emailService: EmailService, - @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2 - ) { + @Inject(DOCUMENT) private document, + private transferState: TransferState, + @Inject(PLATFORM_ID) private platformId: any, + private rendererFactory: RendererFactory2 + ) { this.subscriptions.push(router.events.forEach((event) => { if (event instanceof NavigationEnd) { if (event.url === '/contact-us') { @@ -157,15 +178,14 @@ export class AppComponent implements OnInit, OnDestroy { } ngOnInit() { - - this.subscriptions.push(this.route.queryParams.subscribe(data => { - this.previewLayout = (data['previewLayout'] && data['previewLayout'].length >0 ? data['previewLayout']: null); - if (this.properties.environment == "production" || this.properties.environment == "development") { - this._meta.updateTag({content: 'all', name: 'robots'}); - this.seoService.removeLinkForPrevURL(); - this.seoService.removeLinkForNextURL(); - } - })); + this.subscriptions.push(this.route.queryParams.subscribe(data => { + this.previewLayout = (data['previewLayout'] && data['previewLayout'].length > 0 ? data['previewLayout'] : null); + if (this.properties.environment == "production" || this.properties.environment == "development") { + this._meta.updateTag({content: 'all', name: 'robots'}); + this.seoService.removeLinkForPrevURL(); + this.seoService.removeLinkForNextURL(); + } + })); this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI); if (typeof document !== 'undefined') { try { @@ -177,7 +197,8 @@ export class AppComponent implements OnInit, OnDestroy { this.user = user; this.init(); }, error => { - this.init()})); + this.init(); + })); this.subscriptions.push(this.quickContactService.isDisplayed.subscribe(display => { this.showQuickContact = display; })); @@ -195,15 +216,15 @@ export class AppComponent implements OnInit, OnDestroy { this._communityService.clearSubscriptions(); this.smoothScroll.clearSubscriptions(); } - - createObservers() { - let options = { - root: null, - rootMargin: '0px', - threshold: 0.1 - }; - let intersectionObserver = new IntersectionObserver(entries => { - entries.forEach(entry => { + + createObservers() { + let options = { + root: null, + rootMargin: '0px', + threshold: 0.1 + }; + let intersectionObserver = new IntersectionObserver(entries => { + entries.forEach(entry => { if (entry.isIntersecting && this.showQuickContact) { this.showQuickContact = false; this.quickContactService.setDisplay(this.showQuickContact); @@ -212,15 +233,15 @@ export class AppComponent implements OnInit, OnDestroy { this.quickContactService.setDisplay(this.showQuickContact); } }); - }, options); - intersectionObserver.observe(this.bottom.nativeElement); - this.subscriptions.push(intersectionObserver); - } + }, options); + intersectionObserver.observe(this.bottom.nativeElement); + this.subscriptions.push(intersectionObserver); + } get isManager() { return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user)) } - + get isPrivate() { return this.community && !ConnectHelper.isPrivate(this.community, this.user) } @@ -238,9 +259,9 @@ export class AppComponent implements OnInit, OnDestroy { this.userManagementService.fixRedirectURL = null; } } - initCss(communityId, suffix=null) { + + initCss(communityId, suffix = null) { try { - const renderer = this.rendererFactory.createRenderer(this.document, { id: '-1', encapsulation: ViewEncapsulation.None, @@ -251,21 +272,18 @@ export class AppComponent implements OnInit, OnDestroy { if (head === null) { throw new Error(' not found within DOCUMENT.'); } - if(!this.document.getElementById("dashboardStyle")) { + if (!this.document.getElementById("dashboardStyle")) { const script = renderer.createElement('link'); renderer.setAttribute(script, "id", "dashboardStyle"); - renderer.setAttribute(script, "href", ((communityId) ? communityId : this.properties.adminToolsPortalType) + (suffix?"-"+suffix:"") + ".css"); + renderer.setAttribute(script, "href", ((communityId) ? communityId : this.properties.adminToolsPortalType) + (suffix ? "-" + suffix : "") + ".css"); renderer.setAttribute(script, "rel", "stylesheet"); renderer.appendChild(head, script); - }else if(!this.previewLayout){ - this.document.getElementById("dashboardStyle").href = ((communityId) ? communityId : this.properties.adminToolsPortalType)+ (suffix?"-"+suffix:"") + ".css"; - // console.log(this.document.getElementById("dashboardStyle")); + } else if (!this.previewLayout) { + this.document.getElementById("dashboardStyle").href = ((communityId) ? communityId : this.properties.adminToolsPortalType) + (suffix ? "-" + suffix : "") + ".css"; } - } catch (e) { console.error('Renderrer Error to append style ', e); } - } initAdminToolCommunity(communityId) { @@ -274,48 +292,54 @@ export class AppComponent implements OnInit, OnDestroy { if (this.document) { this.initLayout(communityId); } - }else{ + } else { this.properties.adminToolsPortalType = "connect"; if (this.document) { this.initLayout('connect'); } } this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType); - } - getLayouts(){ + + getLayouts() { this.customizationService.getLayouts(this.properties).subscribe( - layouts => { - this.layouts = layouts; - this.layoutDefault = layouts.filter(layout => layout.portalPid == 'default')[0]; - this.layoutConnect = layouts.filter(layout => layout.portalPid == 'connect')[0]; - this.layoutSub.next(this.layouts); - this.layoutSub.complete(); - }, - error => { - - } - ); + layouts => { + this.layouts = layouts; + this.layoutDefault = layouts.filter(layout => layout.portalPid == 'default')[0]; + this.layoutConnect = layouts.filter(layout => layout.portalPid == 'connect')[0]; + this.layoutSub.next(this.layouts); + }, + error => { + this.layoutSub.next([]); + } + ); } - initLayout(communityId){ - if(!this.layout && (typeof location == 'undefined') && !this.previewLayout) { + + initLayout(communityId) { + let portal = this.transferState.get(this.key, null); + if(isPlatformServer(this.platformId)) { + this.transferState.set(this.key, communityId); + } + if (!this.layout && (portal !== communityId) && !this.previewLayout) { // if((typeof location == 'undefined') && !this.previewLayout) { this.subscriptions.push(this.layoutSub.subscribe(value => { - this.layout = this.layouts.filter(layout => layout.portalPid == communityId)[0]?this.layouts.filter(layout => layout.portalPid == communityId)[0]:this.layouts.filter(layout => layout.portalPid == 'default')[0]; - this.initCss(this.layout.portalPid, this.layout.date?this.layout.date:null) + this.layouts = value; + this.layout = this.layouts.filter(layout => layout.portalPid == communityId)[0] ? this.layouts.filter(layout => layout.portalPid == communityId)[0] : this.layouts.filter(layout => layout.portalPid == 'default')[0]; + this.initCss(this.layout.portalPid, this.layout.date ? this.layout.date : null) })); - - }else if(this.previewLayout && this.previewLayout.split("-preview-")[0] == communityId){ + + } else if (this.previewLayout && this.previewLayout.split("-preview-")[0] == communityId) { this.initCss(communityId, this.previewLayout.split(communityId)[1]); } } + public buildMenu(communityId: string) { if (communityId) { if (!this.community || this.communityId !== communityId) { this.subscriptions.push(this._communityService.getCommunity(communityId).subscribe(community => { if (community) { - this.community = community; - }else{ + this.community = community; + } else { this.community = null; this.communityId = null; } @@ -328,12 +352,11 @@ export class AppComponent implements OnInit, OnDestroy { this.buildConnectMenu(); } } - - buildCommunityMenu(){ + + buildCommunityMenu() { if (this.community && !ConnectHelper.isPrivate(this.community, this.user)) { this.communityId = this.community.communityId; this.initAdminToolCommunity(this.communityId); - this.header = { // url: 'https://' + (this.properties.environment == 'beta' ? 'beta.' : '') + this.community.id + '.openaire.eu', route: "/", @@ -382,8 +405,8 @@ export class AppComponent implements OnInit, OnDestroy { new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}), ] )); - this.menuItems.push( - new MenuItem("develop", "Develop", "", "/develop", false, [], ["/develop"], {}), + this.menuItems.push( + new MenuItem("develop", "Develop", "", "/develop", false, [], ["/develop"], {}), ); if (this.isManager) { this.menuItems.push( @@ -408,10 +431,7 @@ export class AppComponent implements OnInit, OnDestroy { } this.showMenu = true; } else { - this.initAdminToolCommunity(this.communityId); - this.communityId = null; - this.properties.adminToolsPortalType = "connect"; this.configurationService.initCommunityInformation(this.properties, "connect"); // this.initAdminToolCommunity(null); this.buildConnectMenu(true); @@ -425,21 +445,21 @@ export class AppComponent implements OnInit, OnDestroy { } }); } - } else { - if(typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) { + } else { + if (typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) { this.router.navigate(['/'], {queryParamsHandling: "merge"}); } } - }else if (this.community && this.community.status == "hidden") { + } else if (this.community && this.community.status == "hidden") { this.router.navigate([this.properties.errorLink]); - }else{ - this.router.navigate(['/'], this.community && this.community.status ? { queryParamsHandling: "merge" } : {}); + } else { + this.router.navigate(['/'], this.community && this.community.status ? {queryParamsHandling: "merge"} : {}); } } } + buildConnectMenu(restrictedData: boolean = false) { this.initAdminToolCommunity(null); - let url = "https://" + (properties.environment != "production" ? "beta." : "") + "connect.openaire.eu"; this.header = { route: restrictedData ? "" : "/", diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 95a3cc3..39a7ed5 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 95a3cc3ff62983d593730827a8d07fd43887627b +Subproject commit 39a7ed58be27513c05598edc18cf095eb5b044c5 diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index ae3369b..d3247e0 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -114,5 +114,6 @@ export let properties: EnvProperties = { altMetricsAPIURL: "https://api.altmetric.com/v1/doi/", b2noteAPIURL: 'https://b2note.eudat.eu/', adminPortalURL: "https://admin.connect.openaire.eu", - myOrcidLinksPage: "/my-orcid-links" + myOrcidLinksPage: "/my-orcid-links", + hasMachineCache: true }; From ff4be90cfc6e79190007662c7e7ef3946812e5e0 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 25 May 2023 17:13:38 +0300 Subject: [PATCH 11/13] Update library, assets and theme before release --- src/app/openaireLibrary | 2 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index faa57d9..d410335 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit faa57d99d193f6904c6a57363718d3269c843c13 +Subproject commit d4103354aa0254475df4aa29382999bc2f25bf29 diff --git a/src/assets/common-assets b/src/assets/common-assets index d772dbd..d8e7e54 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit d772dbd4b2f2d8af9e26d98eed7417f2fbf15c3a +Subproject commit d8e7e5439fbd606301b51fdd5ed5115d9ad75c22 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 2882ccd..a5b03a9 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 2882ccde4eb93bd01b4cdb480790cc04b394794d +Subproject commit a5b03a914c98c4478d758f58a8ceacc8f3c0611a From b5d95fbac88e57dccc2ed9cf7a37db31ed74b84e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 26 May 2023 14:37:34 +0300 Subject: [PATCH 12/13] [Library | develop]: ISVocabularies.service.ts: [Bug fix] In methods getFos() and getSDGs(), removed check and call to cache - these files are always local | sdg.component.ts: Set customFilter and pass it as parameter to . --- src/app/openaireLibrary | 2 +- src/app/sdg/sdg.component.ts | 5 ++++- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index d410335..3ee89e2 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit d4103354aa0254475df4aa29382999bc2f25bf29 +Subproject commit 3ee89e2bcae313a1ac82cfb678c4476ec1e9905f diff --git a/src/app/sdg/sdg.component.ts b/src/app/sdg/sdg.component.ts index 3f29b2a..b33c4d4 100644 --- a/src/app/sdg/sdg.component.ts +++ b/src/app/sdg/sdg.component.ts @@ -2,16 +2,18 @@ import {Component} from "@angular/core"; import {properties} from "../../environments/environment"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {PiwikHelper} from "../utils/piwikHelper"; +import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; @Component({ selector: 'community-sdg', template: ` - + ` }) export class CommunitySdgComponent { piwikSiteId; communityId; + customFilter: SearchCustomFilter = null; constructor() { } @@ -19,5 +21,6 @@ export class CommunitySdgComponent { ngOnInit() { this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); + this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, ""); } } \ No newline at end of file diff --git a/src/assets/common-assets b/src/assets/common-assets index d8e7e54..f15bbfa 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit d8e7e5439fbd606301b51fdd5ed5115d9ad75c22 +Subproject commit f15bbfa7265f170e06b256f086f2acedfa3f72e0 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index a5b03a9..468b2b0 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit a5b03a914c98c4478d758f58a8ceacc8f3c0611a +Subproject commit 468b2b008f474c88dacc52991a5231693833f1f9 From 4394b6373608e02bb74370e0190771d8febb89e7 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Sat, 27 May 2023 22:49:43 +0300 Subject: [PATCH 13/13] Update library --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 3ee89e2..bb8f196 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 3ee89e2bcae313a1ac82cfb678c4476ec1e9905f +Subproject commit bb8f196abb5054af89342284729f28a8e659076c