mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fixed core and shared module usage, lazy loading modules
This commit is contained in:
@@ -6,7 +6,7 @@ import { CollectionPageComponent } from './collection-page.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'collections/:id', component: CollectionPageComponent }
|
||||
{ path: ':id', component: CollectionPageComponent, pathMatch: 'full' }
|
||||
])
|
||||
]
|
||||
})
|
@@ -9,10 +9,9 @@ import { CollectionPageRoutingModule } from './collection-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CollectionPageRoutingModule,
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
TranslateModule,
|
||||
CollectionPageRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
CollectionPageComponent,
|
@@ -6,7 +6,7 @@ import { CommunityPageComponent } from './community-page.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'communities/:id', component: CommunityPageComponent }
|
||||
{ path: ':id', component: CommunityPageComponent, pathMatch: 'full' }
|
||||
])
|
||||
]
|
||||
})
|
@@ -1,6 +1,5 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@@ -11,11 +10,9 @@ import { CommunityPageRoutingModule } from './community-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommunityPageRoutingModule,
|
||||
CommonModule,
|
||||
TranslateModule,
|
||||
RouterModule,
|
||||
SharedModule,
|
||||
CommunityPageRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
CommunityPageComponent,
|
@@ -6,7 +6,7 @@ import { HomeComponent } from './home.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'home', component: HomeComponent }
|
||||
{ path: '', component: HomeComponent, pathMatch: 'full' }
|
||||
])
|
||||
]
|
||||
})
|
@@ -1,21 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
import { HomeRoutingModule } from './home-routing.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TopLevelCommunityListComponent } from './top-level-community-list/top-level-community-list.component';
|
||||
import { HomeNewsComponent } from './home-news/home-news.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
HomeRoutingModule,
|
||||
RouterModule,
|
||||
SharedModule,
|
||||
TranslateModule
|
||||
HomeRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
HomeComponent,
|
@@ -5,12 +5,13 @@ import { ItemPageComponent } from './simple/item-page.component';
|
||||
import { FullItemPageComponent } from './full/full-item-page.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'items/:id', pathMatch: 'full', component: ItemPageComponent },
|
||||
{ path: 'items/:id/full', component: FullItemPageComponent },
|
||||
])
|
||||
]
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: ':id', component: ItemPageComponent, pathMatch: 'full' },
|
||||
{ path: ':id/full', component: FullItemPageComponent }
|
||||
])
|
||||
]
|
||||
})
|
||||
export class ItemPageRoutingModule {
|
||||
|
||||
}
|
@@ -19,27 +19,28 @@ import { FullItemPageComponent } from './full/full-item-page.component';
|
||||
import { FullFileSectionComponent } from './full/field-components/file-section/full-file-section.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ItemPageComponent,
|
||||
FullItemPageComponent,
|
||||
MetadataValuesComponent,
|
||||
MetadataUriValuesComponent,
|
||||
MetadataFieldWrapperComponent,
|
||||
ItemPageAuthorFieldComponent,
|
||||
ItemPageDateFieldComponent,
|
||||
ItemPageAbstractFieldComponent,
|
||||
ItemPageUriFieldComponent,
|
||||
ItemPageTitleFieldComponent,
|
||||
ItemPageSpecificFieldComponent,
|
||||
FileSectionComponent,
|
||||
CollectionsComponent,
|
||||
FullFileSectionComponent
|
||||
],
|
||||
imports: [
|
||||
ItemPageRoutingModule,
|
||||
CommonModule,
|
||||
SharedModule
|
||||
]
|
||||
imports: [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
ItemPageRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
ItemPageComponent,
|
||||
FullItemPageComponent,
|
||||
MetadataValuesComponent,
|
||||
MetadataUriValuesComponent,
|
||||
MetadataFieldWrapperComponent,
|
||||
ItemPageAuthorFieldComponent,
|
||||
ItemPageDateFieldComponent,
|
||||
ItemPageAbstractFieldComponent,
|
||||
ItemPageUriFieldComponent,
|
||||
ItemPageTitleFieldComponent,
|
||||
ItemPageSpecificFieldComponent,
|
||||
FileSectionComponent,
|
||||
CollectionsComponent,
|
||||
FullFileSectionComponent
|
||||
]
|
||||
})
|
||||
export class ItemPageModule {
|
||||
|
||||
}
|
@@ -7,6 +7,10 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||
{ path: 'home', loadChildren: './+home/home.module#HomeModule' },
|
||||
{ path: 'communities', loadChildren: './+community-page/community-page.module#CommunityPageModule' },
|
||||
{ path: 'collections', loadChildren: './+collection-page/collection-page.module#CollectionPageModule' },
|
||||
{ path: 'items', loadChildren: './+item-page/item-page.module#ItemPageModule' },
|
||||
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
||||
])
|
||||
],
|
||||
|
@@ -1,10 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
import { appReducers } from './app.reducer';
|
||||
import { appEffects } from './app.effects';
|
||||
|
||||
@@ -15,13 +21,9 @@ import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
import { TransferHttpModule } from '../modules/transfer-http/transfer-http.module';
|
||||
|
||||
import { HomeModule } from './home/home.module';
|
||||
import { ItemPageModule } from './item-page/item-page.module';
|
||||
import { CollectionPageModule } from './collection-page/collection-page.module';
|
||||
import { CommunityPageModule } from './community-page/community-page.module';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { HeaderComponent } from './header/header.component';
|
||||
import { FooterComponent } from './footer/footer.component';
|
||||
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
|
||||
|
||||
import { GLOBAL_CONFIG, ENV_CONFIG } from '../config';
|
||||
@@ -34,27 +36,27 @@ export function getConfig() {
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
CoreModule.forRoot(),
|
||||
HttpModule,
|
||||
TransferHttpModule,
|
||||
HomeModule,
|
||||
ItemPageModule,
|
||||
CollectionPageModule,
|
||||
CommunityPageModule,
|
||||
RouterModule,
|
||||
AppRoutingModule,
|
||||
TransferHttpModule,
|
||||
CoreModule.forRoot(),
|
||||
NgbModule.forRoot(),
|
||||
TranslateModule.forRoot(),
|
||||
EffectsModule.forRoot(appEffects),
|
||||
StoreModule.forRoot(appReducers, { metaReducers: appMetaReducers }),
|
||||
StoreDevtoolsModule.instrument({ maxAge: 50 }),
|
||||
EffectsModule.forRoot(appEffects)
|
||||
StoreDevtoolsModule.instrument({ maxAge: 50 })
|
||||
],
|
||||
providers: [
|
||||
{ provide: GLOBAL_CONFIG, useFactory: (getConfig) },
|
||||
{ provide: GLOBAL_CONFIG, useFactory: (getConfig) }
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HeaderComponent,
|
||||
PageNotFoundComponent,
|
||||
FooterComponent,
|
||||
PageNotFoundComponent
|
||||
],
|
||||
exports: [AppComponent]
|
||||
})
|
||||
|
@@ -3,15 +3,12 @@ import { Http } from '@angular/http';
|
||||
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { IdlePreload, IdlePreloadModule } from '@angularclass/idle-preload';
|
||||
|
||||
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
|
||||
import { TransferState } from '../modules/transfer-state/transfer-state';
|
||||
@@ -36,7 +33,7 @@ export function init(cache: TransferState) {
|
||||
}
|
||||
|
||||
export function createTranslateLoader(http: HttpClient) {
|
||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
@@ -55,14 +52,12 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
deps: [HttpClient]
|
||||
}
|
||||
}),
|
||||
NgbModule.forRoot(),
|
||||
BrowserCookiesModule,
|
||||
BrowserDataLoaderModule,
|
||||
BrowserTransferStateModule,
|
||||
BrowserTransferStoreModule,
|
||||
EffectsModule.forRoot([BrowserTransferStoreEffects]),
|
||||
StoreRouterConnectingModule,
|
||||
BrowserAnimationsModule,
|
||||
AppModule
|
||||
],
|
||||
providers: [
|
||||
|
@@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
import { isNotEmpty } from '../shared/empty.util';
|
||||
import { FooterComponent } from './footer/footer.component';
|
||||
import { DSpaceRESTv2Service } from './dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { ObjectCacheService } from './cache/object-cache.service';
|
||||
import { ResponseCacheService } from './cache/response-cache.service';
|
||||
@@ -19,31 +18,41 @@ import { EffectsModule } from '@ngrx/effects';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
import { coreReducers } from './core.reducers';
|
||||
|
||||
import { ApiService } from '../shared/api.service';
|
||||
|
||||
import { HostWindowService } from '../shared/host-window.service';
|
||||
import { NativeWindowFactory, NativeWindowService } from '../shared/window.service';
|
||||
|
||||
import { ServerResponseService } from '../shared/server-response.service';
|
||||
|
||||
const IMPORTS = [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
StoreModule.forFeature('core', coreReducers, { }),
|
||||
StoreModule.forFeature('core', coreReducers, {}),
|
||||
EffectsModule.forFeature(coreEffects)
|
||||
];
|
||||
|
||||
const DECLARATIONS = [
|
||||
FooterComponent
|
||||
|
||||
];
|
||||
|
||||
const EXPORTS = [
|
||||
FooterComponent
|
||||
|
||||
];
|
||||
|
||||
const PROVIDERS = [
|
||||
ApiService,
|
||||
CommunityDataService,
|
||||
CollectionDataService,
|
||||
ItemDataService,
|
||||
DSpaceRESTv2Service,
|
||||
HostWindowService,
|
||||
ItemDataService,
|
||||
ObjectCacheService,
|
||||
PaginationComponentOptions,
|
||||
ResponseCacheService,
|
||||
RequestService,
|
||||
RemoteDataBuildService
|
||||
RemoteDataBuildService,
|
||||
ServerResponseService,
|
||||
{ provide: NativeWindowService, useFactory: NativeWindowFactory }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@@ -1,5 +1,5 @@
|
||||
@import '../../../styles/variables.scss';
|
||||
@import '../../../../node_modules/bootstrap/scss/_variables.scss';
|
||||
@import '../../styles/variables.scss';
|
||||
@import '../../../node_modules/bootstrap/scss/_variables.scss';
|
||||
$footer-bg: $gray-lighter;
|
||||
$footer-border: 1px solid darken($footer-bg, 10%);
|
||||
$footer-padding: $spacer * 1.5;
|
@@ -5,7 +5,6 @@ import { ApplicationRef, NgModule, APP_BOOTSTRAP_LISTENER } from '@angular/core'
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ServerModule } from '@angular/platform-server';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { Request } from 'express';
|
||||
|
||||
@@ -13,8 +12,6 @@ import { REQUEST } from '@nguniversal/express-engine/tokens';
|
||||
|
||||
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
||||
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
|
||||
@@ -67,14 +64,12 @@ export function createTranslateLoader() {
|
||||
deps: []
|
||||
}
|
||||
}),
|
||||
NgbModule.forRoot(),
|
||||
ServerModule,
|
||||
ServerCookiesModule,
|
||||
ServerDataLoaderModule,
|
||||
ServerTransferStateModule,
|
||||
ServerTransferStoreModule,
|
||||
EffectsModule.forRoot([ServerTransferStoreEffects]),
|
||||
NoopAnimationsModule,
|
||||
AppModule
|
||||
],
|
||||
providers: [
|
||||
|
@@ -186,10 +186,10 @@ export class PaginationComponent implements OnChanges, OnDestroy, OnInit {
|
||||
this.checkConfig(this.paginationOptions);
|
||||
|
||||
if (this.pageInfoState) {
|
||||
this.subs.push(this.pageInfoState.subscribe((pageInfo) => {
|
||||
/* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */
|
||||
this.currentPageState = pageInfo.currentPage + 1;
|
||||
}));
|
||||
this.subs.push(this.pageInfoState.subscribe((pageInfo) => {
|
||||
/* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */
|
||||
this.currentPageState = pageInfo.currentPage + 1;
|
||||
}));
|
||||
}
|
||||
|
||||
this.id = this.paginationOptions.id || null;
|
||||
|
@@ -7,13 +7,11 @@ import { NgxPaginationModule } from 'ngx-pagination';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { ApiService } from './api.service';
|
||||
import { PaginationComponent } from './pagination/pagination.component';
|
||||
import { FileSizePipe } from './utils/file-size-pipe';
|
||||
import { ThumbnailComponent } from '../thumbnail/thumbnail.component';
|
||||
import { SafeUrlPipe } from './utils/safe-url-pipe';
|
||||
import { HostWindowService } from './host-window.service';
|
||||
import { NativeWindowFactory, NativeWindowService } from './window.service';
|
||||
|
||||
import { ComcolPageContentComponent } from './comcol-page-content/comcol-page-content.component';
|
||||
import { ComcolPageHeaderComponent } from './comcol-page-header/comcol-page-header.component';
|
||||
import { ComcolPageLogoComponent } from './comcol-page-logo/comcol-page-logo.component';
|
||||
@@ -24,7 +22,6 @@ import { ItemListElementComponent } from '../object-list/item-list-element/item-
|
||||
import { CommunityListElementComponent } from '../object-list/community-list-element/community-list-element.component';
|
||||
import { CollectionListElementComponent } from '../object-list/collection-list-element/collection-list-element.component';
|
||||
import { TruncatePipe } from './utils/truncate.pipe';
|
||||
import { ServerResponseService } from './server-response.service';
|
||||
|
||||
const MODULES = [
|
||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||
@@ -38,11 +35,11 @@ const MODULES = [
|
||||
];
|
||||
|
||||
const PIPES = [
|
||||
// put shared pipes here
|
||||
FileSizePipe,
|
||||
SafeUrlPipe,
|
||||
EnumKeysPipe,
|
||||
TruncatePipe
|
||||
// put pipes here
|
||||
];
|
||||
|
||||
const COMPONENTS = [
|
||||
@@ -60,10 +57,7 @@ const COMPONENTS = [
|
||||
];
|
||||
|
||||
const PROVIDERS = [
|
||||
ApiService,
|
||||
HostWindowService,
|
||||
{ provide: NativeWindowService, useFactory: NativeWindowFactory },
|
||||
ServerResponseService
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"angularCompilerOptions": {
|
||||
"genDir": ".",
|
||||
"entryModule": "./app/browser-app.module#BrowserAppModule"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"angularCompilerOptions": {
|
||||
"genDir": ".",
|
||||
"entryModule": "./app/server-app.module#ServerAppModule"
|
||||
}
|
||||
}
|
||||
|
@@ -8,10 +8,6 @@ const {
|
||||
getAotPlugin
|
||||
} = require('./webpack/webpack.aot');
|
||||
|
||||
const {
|
||||
root
|
||||
} = require('./webpack/helpers');
|
||||
|
||||
module.exports = function(options, webpackOptions) {
|
||||
options = options || {};
|
||||
|
||||
|
Reference in New Issue
Block a user