[ADF-2569] fix reload app.config.json (#3124)

* fix reload app.config.json

* improve style mobile
fix test

* test karma setup update

* fix core providers test

* remove unused providers

* use mock api in service test

* skip test in the wrong place

* remove comma

* remove fdescribe
This commit is contained in:
Eugenio Romano
2018-03-28 11:01:04 +01:00
committed by Denys Vuika
parent 21b8cd30ce
commit 9e2969b955
93 changed files with 228 additions and 436 deletions

View File

@@ -16,24 +16,15 @@
*/
import { HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { NgModule } from '@angular/core';
import { AppConfigService } from './app-config.service';
import { startupServiceFactory } from './startup-service-factory';
@NgModule({
imports: [
HttpClientModule
],
providers: [
AppConfigService,
{
provide: APP_INITIALIZER,
useFactory: startupServiceFactory,
deps: [
AppConfigService
],
multi: true
}
AppConfigService
]
})
export class AppConfigModule {

View File

@@ -54,6 +54,7 @@ describe('AppConfigService', () => {
beforeEach(
inject([AppConfigService], (appConfig: AppConfigService) => {
appConfigService = appConfig;
appConfigService.load();
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,

View File

@@ -31,7 +31,7 @@ export class AppConfigService {
ecmHost: 'http://{hostname}{:port}/ecm',
bpmHost: 'http://{hostname}{:port}/bpm',
logLevel: 'silent',
alfrescoRepositoryName : 'alfresco-1'
alfrescoRepositoryName: 'alfresco-1'
};
constructor(private http: HttpClient) {
@@ -60,8 +60,8 @@ export class AppConfigService {
return location.port ? prefix + location.port : '';
}
async load(): Promise<any> {
await new Promise(resolve => {
load(): Promise<any> {
return new Promise(resolve => {
this.http.get('app.config.json').subscribe(
(data: any) => {
this.config = Object.assign({}, this.config, data || {});

View File

@@ -1,22 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppConfigService } from './app-config.service';
export function startupServiceFactory(configService: AppConfigService): Function {
return () => configService.load();
}