[Library | Trunk]: Make EnvProperties interface and make all fields optional. Set domain property on properties service.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58882 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-06-11 13:53:48 +00:00
parent 159e443648
commit 7a42282e45
2 changed files with 119 additions and 169 deletions

View File

@ -1,162 +1,118 @@
export class EnvProperties {
environment: string; //{beta,test,production, development}
dashboard:string; //{explore, connect, monitor}
domain: string;
enablePiwikTrack: boolean;
useCache: boolean;
showAddThis: boolean;
showContent: boolean;
export type Environment = "development" | "test" | "beta" | "production";
export type Dashboard = "explore" | "connect" | "monitor";
metricsAPIURL;
framesAPIURL;
statisticsFrameAPIURL;
statisticsFrameNewAPIURL;
useNewStatistisTool: boolean;
statisticsAPIURL;
impactFactorsAPIURL;
claimsAPIURL;
searchAPIURLLAst;
searchResourcesAPIURL;
openCitationsAPIURL;
csvAPIURL;
searchCrossrefAPIURL;
searchDataciteAPIURL;
searchOrcidURL;
orcidURL;
doiURL;
pmcURL;
pmidURL;
handleURL;
cordisURL;
openDoarURL;
r3DataURL;
sherpaURL;
sherpaURLSuffix;
// Zenodo's url
zenodo;
zenodoCommunities;
// Open access link
openAccess;
// Open access repository link
openAccessRepo;
// FP7 link
fp7Guidlines;
// H2020 link
h2020Guidlines;
// ERC Guidlines
ercGuidlines;
// helpdesk link
helpdesk;
// helpdesk email
helpdeskEmail;
utilsService;
vocabulariesAPI;
piwikBaseUrl;
piwikSiteId;
loginUrl;
logoutUrl;
userInfoUrl;
cookieDomain;
feedbackmail;
feedbackmailForMissingEntities;
cacheUrl;
monitorServiceAPIURL;
adminToolsAPIURL;
adminToolsCommunity;
contextsAPI;
communityAPI;
communitiesAPI;
datasourcesAPI;
miningBackendURL;
csvLimit: number;
pagingLimit: number;
resultsPerPage: number;
//base url
baseLink;
//base url for OpenAIRE portal
baseOpenaireLink;
// after login redirect Link
afterLoginRedirectLink;
//landing Pages
searchLinkToPublication;
searchLinkToProject;
searchLinkToDataProvider;
searchLinkToDataset;
searchLinkToSoftwareLanding;
searchLinkToOrp;
searchLinkToOrganization;
export interface EnvProperties {
environment?: Environment;
dashboard?: Dashboard;
domain?: string;
enablePiwikTrack?: boolean;
useCache?: boolean;
showAddThis?: boolean;
showContent?: boolean;
metricsAPIURL?: string;
framesAPIURL?: string;
statisticsFrameAPIURL?: string;
statisticsFrameNewAPIURL?: string;
useNewStatistisTool?: boolean;
statisticsAPIURL?: string;
impactFactorsAPIURL?: string;
claimsAPIURL?: string;
searchAPIURLLAst?: string;
searchResourcesAPIURL?: string;
openCitationsAPIURL?: string;
csvAPIURL?: string;
searchCrossrefAPIURL?: string;
searchDataciteAPIURL?: string;
searchOrcidURL?: string;
orcidURL?: string;
doiURL?: string;
pmcURL?: string;
pmidURL?: string;
handleURL?: string;
cordisURL?: string;
openDoarURL?: string;
r3DataURL?: string;
sherpaURL?: string;
sherpaURLSuffix?: string;
zenodo?: string;
zenodoCommunities?: string;
openAccess?: string;
openAccessRepo?: string;
fp7Guidlines?: string;
h2020Guidlines?: string;
ercGuidlines?: string;
helpdesk?: string;
helpdeskEmail?: string;
utilsService?: string;
vocabulariesAPI?: string;
piwikBaseUrl?: string;
piwikSiteId?: string;
loginUrl?: string;
logoutUrl?: string;
userInfoUrl?: string;
cookieDomain?: string;
feedbackmail?: string;
feedbackmailForMissingEntities?: string;
cacheUrl?: string;
monitorServiceAPIURL?: string;
adminToolsAPIURL?: string;
adminToolsCommunity?: string;
contextsAPI?: string;
communityAPI?: string;
communitiesAPI?: string;
datasourcesAPI?: string;
miningBackendURL?: string;
csvLimit?: number;
pagingLimit?: number;
resultsPerPage?: number;
baseLink?: string;
baseOpenaireLink?: string;
afterLoginRedirectLink?: string;
searchLinkToPublication?: string;
searchLinkToProject?: string;
searchLinkToDataProvider?: string;
searchLinkToDataset?: string;
searchLinkToSoftwareLanding?: string;
searchLinkToOrp?: string;
searchLinkToOrganization?: string;
//Search pages
searchLinkToCommunities;
searchLinkToPublications;
searchLinkToDataProviders;
searchLinkToProjects;
searchLinkToDatasets;
searchLinkToSoftware;
searchLinkToOrps;
searchLinkToOrganizations;
searchLinkToCompatibleDataProviders;
searchLinkToEntityRegistriesDataProviders;
searchLinkToEntityRegistriesDataProvidersTable;
searchLinkToJournals;
searchLinkToJournalsTable;
searchLinkToResults;
searchLinkToCommunities?: string;
searchLinkToPublications?: string;
searchLinkToDataProviders?: string;
searchLinkToProjects?: string;
searchLinkToDatasets?: string;
searchLinkToSoftware?: string;
searchLinkToOrps?: string;
searchLinkToOrganizations?: string;
searchLinkToCompatibleDataProviders?: string;
searchLinkToEntityRegistriesDataProviders?: string;
searchLinkToEntityRegistriesDataProvidersTable?: string;
searchLinkToJournals?: string;
searchLinkToJournalsTable?: string;
searchLinkToResults?: string;
//Advanced Search for pages
searchLinkToAdvancedPublications;
searchLinkToAdvancedProjects;
searchLinkToAdvancedDatasets;
searchLinkToAdvancedSoftware;
searchLinkToAdvancedOrps;
searchLinkToAdvancedDataProviders;
searchLinkToAdvancedOrganizations;
searchLinkToAdvancedResults;
lastIndexInformationLink;
showLastIndexInformationLink;
widgetLink;
claimsInformationLink;
depositLearnHowPage;
depositSearchPage;
shareInZenodoPage;
searchLinkToAdvancedPublications?: string;
searchLinkToAdvancedProjects?: string;
searchLinkToAdvancedDatasets?: string;
searchLinkToAdvancedSoftware?: string;
searchLinkToAdvancedOrps?: string;
searchLinkToAdvancedDataProviders?: string;
searchLinkToAdvancedOrganizations?: string;
searchLinkToAdvancedResults?: string;
lastIndexInformationLink?: string;
showLastIndexInformationLink?: boolean;
widgetLink?: string;
claimsInformationLink?: string;
depositLearnHowPage?: string;
depositSearchPage?: string;
shareInZenodoPage?: string;
// recaptcha site key
reCaptchaSiteKey;
reCaptchaSiteKey?: string;
// contact us recipients
admins;
lastIndexUpdate: string;
indexInfoAPI: string;
altMetricsAPIURL: string;
b2noteAPIURL: string;
adminPortalURL: string;
admins?: string[];
lastIndexUpdate?: string;
indexInfoAPI?: string;
altMetricsAPIURL?: string;
b2noteAPIURL?: string;
adminPortalURL?: string;
}

View File

@ -1,13 +1,13 @@
import {Injectable, PLATFORM_ID, Inject, Optional} from '@angular/core';
import { isPlatformBrowser} from '@angular/common';
import {Inject, Injectable, Optional, PLATFORM_ID} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import { BehaviorSubject , of } from 'rxjs';
import {BehaviorSubject, of} from 'rxjs';
import {Request} from 'express';
import {REQUEST} from '@nguniversal/express-engine/tokens';
import { EnvProperties } from './env-properties';
import {EnvProperties} from './env-properties';
import {map} from "rxjs/operators";
import {properties} from "../../../../environments/environment";
//export const REQUEST_TOKEN = new InjectionToken<Request>('request');
@ -16,17 +16,11 @@ export class EnvironmentSpecificService {
public envSpecific: EnvProperties;
public domain: string;
public envSpecificNull: EnvProperties = null;
testBrowser: boolean;
private envSpecificSubject: BehaviorSubject<EnvProperties> = new BehaviorSubject<EnvProperties>(null);
private propertiesPath = "/assets/env-properties.json?v=2";
constructor(private http: HttpClient, @Inject(PLATFORM_ID) private platformId: string, /*private injector: Injector,*/
@Optional() @Inject(REQUEST) private request: Request) {
this.testBrowser = isPlatformBrowser(platformId);
if (this.testBrowser) {
//this is only executed on the browser
}
constructor(private http: HttpClient, @Optional() @Inject(REQUEST) private request: Request) {
properties.domain = this.getDomain();
}
public loadEnvironment() {