1
0
Files
yel-dspace-angular/src/app/app.module.ts
Giuseppe Digilio ff97a4cc8b Merge remote-tracking branch 'remotes/origin/master' into submission
# Conflicts:
#	package.json
#	src/app/+admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts
#	src/app/+search-page/search-service/search.service.spec.ts
#	src/app/app.module.ts
#	src/app/core/auth/auth.interceptor.ts
#	src/app/core/cache/response-cache.service.spec.ts
#	src/app/core/data/browse-response-parsing.service.spec.ts
#	src/app/core/data/data.service.spec.ts
#	src/app/core/data/request.service.spec.ts
#	src/app/core/data/request.service.ts
#	src/app/core/dspace-rest-v2/dspace-rest-v2.service.ts
#	src/app/core/integration/integration.service.ts
#	src/app/core/metadata/metadata.service.spec.ts
#	src/app/core/registry/registry.service.spec.ts
#	src/app/core/shared/collection.model.ts
#	src/app/core/shared/item.model.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-group/dynamic-group.component.spec.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-group/dynamic-group.components.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.ts
#	src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.ts
#	src/app/shared/form/builder/form-builder.service.spec.ts
#	src/app/shared/form/form.service.spec.ts
#	src/app/shared/notifications/notification/notification.component.spec.ts
#	src/app/shared/services/route.service.spec.ts
#	src/app/shared/services/route.service.ts
#	src/app/shared/shared.module.ts
#	yarn.lock
2018-12-13 20:28:11 +01:00

120 lines
3.1 KiB
TypeScript
Executable File

import { APP_BASE_HREF, CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { EffectsModule } from '@ngrx/effects';
import { RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router-store';
import { META_REDUCERS, MetaReducer, StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { TranslateModule } from '@ngx-translate/core';
import { storeFreeze } from 'ngrx-store-freeze';
import { ENV_CONFIG, GLOBAL_CONFIG, GlobalConfig } from '../config';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { appEffects } from './app.effects';
import { appMetaReducers, debugMetaReducers } from './app.metareducers';
import { appReducers, AppState } from './app.reducer';
import { CoreModule } from './core/core.module';
import { FooterComponent } from './footer/footer.component';
import { HeaderComponent } from './header/header.component';
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
import { DSpaceRouterStateSerializer } from './shared/ngrx/dspace-router-state-serializer';
import { NotificationsBoardComponent } from './shared/notifications/notifications-board/notifications-board.component';
import { NotificationComponent } from './shared/notifications/notification/notification.component';
import { SharedModule } from './shared/shared.module';
import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';
export function getConfig() {
return ENV_CONFIG;
}
export function getBase() {
return ENV_CONFIG.ui.nameSpace;
}
export function getMetaReducers(config: GlobalConfig): Array<MetaReducer<AppState>> {
const metaReducers: Array<MetaReducer<AppState>> = config.production ? appMetaReducers : [...appMetaReducers, storeFreeze];
return config.debug ? [...metaReducers, ...debugMetaReducers] : metaReducers;
}
const IMPORTS = [
CommonModule,
SharedModule,
HttpClientModule,
AppRoutingModule,
CoreModule.forRoot(),
ScrollToModule.forRoot(),
NgbModule.forRoot(),
TranslateModule.forRoot(),
EffectsModule.forRoot(appEffects),
StoreModule.forRoot(appReducers),
StoreRouterConnectingModule,
];
IMPORTS.push(
StoreDevtoolsModule.instrument({
maxAge: 100,
logOnly: ENV_CONFIG.production,
})
);
const PROVIDERS = [
{
provide: GLOBAL_CONFIG,
useFactory: (getConfig)
},
{
provide: APP_BASE_HREF,
useFactory: (getBase)
},
{
provide: META_REDUCERS,
useFactory: getMetaReducers,
deps: [GLOBAL_CONFIG]
},
{
provide: RouterStateSerializer,
useClass: DSpaceRouterStateSerializer
}
];
const DECLARATIONS = [
AppComponent,
HeaderComponent,
FooterComponent,
PageNotFoundComponent,
NotificationComponent,
NotificationsBoardComponent
];
const EXPORTS = [
AppComponent
];
@NgModule({
imports: [
...IMPORTS
],
providers: [
...PROVIDERS
],
declarations: [
...DECLARATIONS
],
exports: [
...EXPORTS
]
})
export class AppModule {
}