[Library|Trunk]
Reload: properly reload when there is a baseUrl defined. Env properties service: clean up imports remove properties prefix fix issues when there is baseUrl defined git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58728 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
6a94908622
commit
c7cdd48987
|
@ -31,6 +31,8 @@ export class ReloadComponent {
|
|||
var host = URL["host"];
|
||||
var paramsObject = ((URL["params"] && URL["params"] != null)? Session.getParamsObj(URL["params"]):null);
|
||||
if(host == (location.protocol+"//"+location.host)){
|
||||
let baseUrl = (document && document.getElementsByTagName('base'))?document.getElementsByTagName('base')[0].href.split(document.location.host)[1]:"/";
|
||||
url = (baseUrl.length>1)?"/"+url.split(baseUrl)[1]:url;
|
||||
if(paramsObject && paramsObject != null){
|
||||
Session.setReloadUrl("","","")
|
||||
this._router.navigate([url],{ queryParams: paramsObject});
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
import {Injectable, OnInit, PLATFORM_ID, Inject, InjectionToken, Optional, Injector, inject} from '@angular/core';
|
||||
import {Injectable, PLATFORM_ID, Inject, Optional} from '@angular/core';
|
||||
import { isPlatformBrowser} from '@angular/common';
|
||||
import { Http, Response, Headers, RequestOptions } from '@angular/http';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import { Observable, Subscription, 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 { DOCUMENT } from '@angular/common';
|
||||
import {map} from "rxjs/operators";
|
||||
import {Type} from "@angular/compiler";
|
||||
|
||||
//export const REQUEST_TOKEN = new InjectionToken<Request>('request');
|
||||
|
||||
|
@ -22,7 +19,6 @@ export class EnvironmentSpecificService {
|
|||
public envSpecificNull: EnvProperties = null;
|
||||
testBrowser: boolean;
|
||||
private envSpecificSubject: BehaviorSubject<EnvProperties> = new BehaviorSubject<EnvProperties>(null);
|
||||
private propertiesPrefix = "";
|
||||
private propertiesPath = "/assets/env-properties.json?v=2";
|
||||
|
||||
constructor(private http: HttpClient, @Inject(PLATFORM_ID) private platformId: string, /*private injector: Injector,*/
|
||||
|
@ -39,7 +35,6 @@ export class EnvironmentSpecificService {
|
|||
if (this.envSpecific === null || this.envSpecific === undefined) {
|
||||
var domain = this.getDomain();
|
||||
var location = this.getFullUrl();
|
||||
// location = "http://dl170.madgik.di.uoa.gr/monitor/assets/env-properties.json";
|
||||
// console.log('loadEnvironment: Loading '+ location);
|
||||
return this.http.get<EnvProperties>(location)
|
||||
.pipe(map((data) => {
|
||||
|
@ -59,7 +54,6 @@ export class EnvironmentSpecificService {
|
|||
if (this.envSpecific === null || this.envSpecific === undefined) {
|
||||
var domain = this.getDomain();
|
||||
var location = this.getFullUrl();
|
||||
// location = "http://dl170.madgik.di.uoa.gr/monitor/assets/env-properties.json";
|
||||
// console.log('subscribeEnvironment: Loading '+ location);
|
||||
return this.http.get<EnvProperties>(location)
|
||||
.pipe(map((data) => {
|
||||
|
@ -80,9 +74,10 @@ export class EnvironmentSpecificService {
|
|||
//let req = this.injector.get('request');
|
||||
//let req: Request = this.injector.get(REQUEST_TOKEN);
|
||||
domain = this.request.get('host').split(":")[0];
|
||||
location = (domain.indexOf(".openaire.eu")!=-1?"https://":"http://")+ this.request.get('host') + this.propertiesPrefix + this.propertiesPath;
|
||||
location = (domain.indexOf(".openaire.eu")!=-1?"https://":"http://")+ this.request.get('host') + this.propertiesPath;
|
||||
}else{
|
||||
location = document.location.protocol +"//" + document.location.host + this.propertiesPrefix + this.propertiesPath;
|
||||
let baseUrl = (document && document.getElementsByTagName('base'))?document.getElementsByTagName('base')[0].href.split(document.location.host)[1]:"/";
|
||||
location = document.location.protocol +"//" + document.location.host + baseUrl + this.propertiesPath;
|
||||
domain = document.location.hostname;
|
||||
}
|
||||
return location;
|
||||
|
|
Loading…
Reference in New Issue