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

View File

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