diff --git a/server.ts b/server.ts index 3ec5aad..77ac8f2 100644 --- a/server.ts +++ b/server.ts @@ -95,9 +95,9 @@ function buildAll(res: Response = null) { } }); } - -buildCss('connect'); -buildCss('default'); +properties.portalBuildTime = (new Date()).valueOf(); +buildCss('connect', properties.portalBuildTime); +buildCss('default', properties.portalBuildTime); buildAll(); // The Express app is exported so that it can be used by serverless Functions. diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a8fd095..dc835b2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -154,9 +154,6 @@ export class AppComponent implements OnInit, OnDestroy { if (this.properties.environment == "production" || this.properties.environment == "development") { this.subscriptions.push(this.route.queryParams.subscribe(data => { this.previewLayout = (data['previewLayout'] && data['previewLayout'].length >0 ? data['previewLayout']: null); - if(this.previewLayout){ - // this.initCss(this.previewLayout); - } this._meta.updateTag({content: 'all', name: 'robots'}); this.seoService.removeLinkForPrevURL(); this.seoService.removeLinkForNextURL(); @@ -246,10 +243,14 @@ export class AppComponent implements OnInit, OnDestroy { initAdminToolCommunity(communityId) { if (communityId) { this.properties.adminToolsPortalType = "community"; - this.initLayout(communityId); + if (typeof document === 'undefined') { + this.initLayout(communityId); + } }else{ this.properties.adminToolsPortalType = "connect"; - this.initCss("connect"); + if (typeof document === 'undefined') { + this.initCss("connect", this.properties.portalBuildTime); + } } this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType); @@ -267,13 +268,13 @@ export class AppComponent implements OnInit, OnDestroy { // this.initCss("default"); } else { // this.layout.layoutOptions = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor, CustomizationOptions.getIdentity(communityId).secondaryColor); - this.initCss("default"); + this.initCss("default", this.properties.portalBuildTime); } }, error => { this.layout.layoutOptions = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor, CustomizationOptions.getIdentity(communityId).secondaryColor); - this.initCss("default"); + this.initCss("default", this.properties.portalBuildTime); } ); }else if(this.previewLayout && this.previewLayout.split("-preview-")[0] == communityId){ diff --git a/src/environments/environment.beta.ts b/src/environments/environment.beta.ts index 0af00b2..9dc14d2 100644 --- a/src/environments/environment.beta.ts +++ b/src/environments/environment.beta.ts @@ -116,5 +116,6 @@ export let properties: EnvProperties = { altMetricsAPIURL: "https://api.altmetric.com/v1/doi/", b2noteAPIURL: 'https://b2note.eudat.eu/', adminPortalURL: "https://beta.admin.connect.openaire.eu", - myOrcidLinksPage: "/my-orcid-links" + myOrcidLinksPage: "/my-orcid-links", + portalBuildTime: null }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 4b1bcaf..1150ee4 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -116,5 +116,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", + portalBuildTime: null }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index a9cce02..f85fa4a 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -121,5 +121,6 @@ export let properties: EnvProperties = { altMetricsAPIURL: 'https://api.altmetric.com/v1/doi/', b2noteAPIURL: 'https://b2note.eudat.eu/', adminPortalURL: 'https://beta.admin.connect.openaire.eu', - myOrcidLinksPage: "/my-orcid-links" + myOrcidLinksPage: "/my-orcid-links", + portalBuildTime: null };