[ADF-847] upgrade to use application configuration service (#1986)

* migrate core lib to use server-side app config

* fix unit tests

* update Search tests

- update tests
- upgrade tests to use TestBed

* update UserInfo tests

* update Social tests

* update tests

* update unit tests

* cleanup old code

* update about page

* update demo shell readme

* dev and prod configurations
This commit is contained in:
Denys Vuika
2017-06-20 11:47:01 +01:00
committed by Eugenio Romano
parent f5b94e1bb4
commit d5f64fa9fc
45 changed files with 469 additions and 760 deletions

View File

@@ -17,31 +17,23 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { AppConfigService } from './app-config.service';
@Injectable()
export class AlfrescoSettingsService {
static DEFAULT_ECM_ADDRESS: string = 'http://' + window.location.hostname + ':8080';
static DEFAULT_BPM_ADDRESS: string = 'http://' + window.location.hostname + ':9999';
static DEFAULT_CSRF_CONFIG: boolean = false;
static DEFAULT_BPM_CONTEXT_PATH: string = '/activiti-app';
private _ecmHost: string = AlfrescoSettingsService.DEFAULT_ECM_ADDRESS;
private _bpmHost: string = AlfrescoSettingsService.DEFAULT_BPM_ADDRESS;
private _csrfDisabled: boolean = AlfrescoSettingsService.DEFAULT_CSRF_CONFIG;
private _bpmContextPath = AlfrescoSettingsService.DEFAULT_BPM_CONTEXT_PATH;
private providers: string = 'ALL'; // ECM, BPM , ALL
public bpmHostSubject: Subject<string> = new Subject<string>();
public ecmHostSubject: Subject<string> = new Subject<string>();
public csrfSubject: Subject<boolean> = new Subject<boolean>();
public providerSubject: Subject<string> = new Subject<string>();
constructor(private appConfig: AppConfigService) {}
public get ecmHost(): string {
return this._ecmHost;
return this.appConfig.get<string>('ecmHost');
}
public set csrfDisabled(csrfDisabled: boolean) {
@@ -49,22 +41,24 @@ export class AlfrescoSettingsService {
this._csrfDisabled = csrfDisabled;
}
/* @deprecated in 1.6.0 */
public set ecmHost(ecmHostUrl: string) {
this.ecmHostSubject.next(ecmHostUrl);
this._ecmHost = ecmHostUrl;
console.log('AlfrescoSettingsService.ecmHost is deprecated. Use AppConfigService instead.');
}
public get bpmHost(): string {
return this._bpmHost;
return this.appConfig.get<string>('bpmHost');
}
/* @deprecated in 1.6.0 */
public set bpmHost(bpmHostUrl: string) {
this.bpmHostSubject.next(bpmHostUrl);
this._bpmHost = bpmHostUrl;
console.log('AlfrescoSettingsService.bpmHost is deprecated. Use AppConfigService instead.');
}
/* @deprecated in 1.6.0 */
public getBPMApiBaseUrl(): string {
return this._bpmHost + this._bpmContextPath;
console.log('AlfrescoSettingsService.getBPMApiBaseUrl is deprecated.');
return this.bpmHost + '/activiti-app';
}
public getProviders(): string {