Working on config providor.

This commit is contained in:
William Welling
2017-03-24 16:57:11 -05:00
parent 415a52f011
commit 9b23393121
8 changed files with 15 additions and 20 deletions

View File

@@ -21,7 +21,7 @@ import { HostWindowState } from "./shared/host-window.reducer";
import { HostWindowResizeAction } from "./shared/host-window.actions";
import { MockTranslateLoader } from "./shared/testing/mock-translate-loader";
import { globalConfig } from '../config';
import { GLOBAL_CONFIG, config } from '../config';
let comp: AppComponent;
let fixture: ComponentFixture<AppComponent>;
@@ -39,8 +39,8 @@ describe('App component', () => {
})],
declarations: [AppComponent], // declare the test component
providers: [
AppComponent,
globalConfig
{ provide: GLOBAL_CONFIG, useValue: config },
AppComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})

View File

@@ -11,7 +11,7 @@ import { HostWindowState } from "./shared/host-window.reducer";
import { Store } from "@ngrx/store";
import { HostWindowResizeAction } from "./shared/host-window.actions";
import { GLOBAL_CONFIG, GlobalConfig, globalConfig } from '../config';
import { GLOBAL_CONFIG, GlobalConfig } from '../config';
@Component({
changeDetection: ChangeDetectionStrategy.Default,

View File

@@ -9,7 +9,7 @@ import { Actions, Effect } from "@ngrx/effects";
import { RequestCacheFindAllAction, RequestCacheFindByIDAction } from "../cache/request-cache.actions";
import { CollectionDataService } from "./collection-data.service";
import { GLOBAL_CONFIG, GlobalConfig, globalConfig } from '../../../config';
import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
@Injectable()
export class CollectionDataEffects extends DataEffects<Collection> {

View File

@@ -9,7 +9,7 @@ import { Actions, Effect } from "@ngrx/effects";
import { RequestCacheFindAllAction, RequestCacheFindByIDAction } from "../cache/request-cache.actions";
import { ItemDataService } from "./item-data.service";
import { GLOBAL_CONFIG, GlobalConfig, globalConfig } from '../../../config';
import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
@Injectable()
export class ItemDataEffects extends DataEffects<Item> {

View File

@@ -3,7 +3,7 @@ import { Http, RequestOptionsArgs } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { RESTURLCombiner } from "../url-combiner/rest-url-combiner";
import { GLOBAL_CONFIG, GlobalConfig, globalConfig } from '../../../config';
import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
/**
* Service to access DSpace's REST API

View File

@@ -67,9 +67,4 @@ for (let key in config) {
}
}
const globalConfig = {
provide: GLOBAL_CONFIG,
useValue: config
};
export { GLOBAL_CONFIG, GlobalConfig, globalConfig, config }
export { GLOBAL_CONFIG, GlobalConfig, config }

View File

@@ -23,7 +23,7 @@ import { effects } from '../../app/app.effects';
import { Meta } from '../angular2-meta';
import { RehydrateStoreAction } from "../../app/store.actions";
import { GLOBAL_CONFIG, GlobalConfig, globalConfig } from '../../config';
import { GLOBAL_CONFIG, config } from '../../config';
// import * as LRU from 'modern-lru';
@@ -72,6 +72,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
effects
],
providers: [
{ provide: GLOBAL_CONFIG, useValue: config },
{ provide: 'isBrowser', useValue: isBrowser },
{ provide: 'isNode', useValue: isNode },
@@ -80,9 +81,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
{ provide: 'LRU', useFactory: getLRU, deps: [] },
Meta,
globalConfig
Meta
// { provide: AUTO_PREBOOT, useValue: false } // turn off auto preboot complete
]

View File

@@ -21,7 +21,7 @@ import { effects } from '../../app/app.effects';
// see https://github.com/angular/angular/pull/12322
import { Meta } from '../angular2-meta';
import { globalConfig } from '../../config';
import { GLOBAL_CONFIG, config } from '../../config';
export function createTranslateLoader(http: Http) {
return new TranslateStaticLoader(http, './assets/i18n', '.json');
@@ -63,6 +63,8 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
effects
],
providers: [
{ provide: GLOBAL_CONFIG, useValue: config },
{ provide: 'res', useFactory: getResponse },
{ provide: 'isBrowser', useValue: isBrowser },
{ provide: 'isNode', useValue: isNode },
@@ -71,9 +73,8 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
{ provide: 'LRU', useFactory: getLRU, deps: [] },
Meta,
Meta
globalConfig
]
})
export class MainModule {