mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
using dynamic imports for lazy loaded modules via the router
This commit is contained in:
@@ -28,7 +28,8 @@ import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
|||||||
{
|
{
|
||||||
path: BITSTREAMFORMATS_MODULE_PATH,
|
path: BITSTREAMFORMATS_MODULE_PATH,
|
||||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||||
loadChildren: './bitstream-formats/bitstream-formats.module#BitstreamFormatsModule',
|
loadChildren: () => import('./bitstream-formats/bitstream-formats.module')
|
||||||
|
.then((m) => m.BitstreamFormatsModule),
|
||||||
data: {title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats'}
|
data: {title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats'}
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
@@ -13,11 +13,13 @@ import { ACCESS_CONTROL_MODULE_PATH, REGISTRIES_MODULE_PATH } from './admin-rout
|
|||||||
RouterModule.forChild([
|
RouterModule.forChild([
|
||||||
{
|
{
|
||||||
path: REGISTRIES_MODULE_PATH,
|
path: REGISTRIES_MODULE_PATH,
|
||||||
loadChildren: './admin-registries/admin-registries.module#AdminRegistriesModule'
|
loadChildren: () => import('./admin-registries/admin-registries.module')
|
||||||
|
.then((m) => m.AdminRegistriesModule),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ACCESS_CONTROL_MODULE_PATH,
|
path: ACCESS_CONTROL_MODULE_PATH,
|
||||||
loadChildren: './admin-access-control/admin-access-control.module#AdminAccessControlModule'
|
loadChildren: () => import('./admin-access-control/admin-access-control.module')
|
||||||
|
.then((m) => m.AdminAccessControlModule),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'search',
|
path: 'search',
|
||||||
|
@@ -41,7 +41,8 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: COLLECTION_EDIT_PATH,
|
path: COLLECTION_EDIT_PATH,
|
||||||
loadChildren: './edit-collection-page/edit-collection-page.module#EditCollectionPageModule',
|
loadChildren: () => import('./edit-collection-page/edit-collection-page.module')
|
||||||
|
.then((m) => m.EditCollectionPageModule),
|
||||||
canActivate: [CollectionPageAdministratorGuard]
|
canActivate: [CollectionPageAdministratorGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -33,7 +33,8 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: COMMUNITY_EDIT_PATH,
|
path: COMMUNITY_EDIT_PATH,
|
||||||
loadChildren: './edit-community-page/edit-community-page.module#EditCommunityPageModule',
|
loadChildren: () => import('./edit-community-page/edit-community-page.module')
|
||||||
|
.then((m) => m.EditCommunityPageModule),
|
||||||
canActivate: [CommunityPageAdministratorGuard]
|
canActivate: [CommunityPageAdministratorGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -36,7 +36,8 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ITEM_EDIT_PATH,
|
path: ITEM_EDIT_PATH,
|
||||||
loadChildren: './edit-item-page/edit-item-page.module#EditItemPageModule',
|
loadChildren: () => import('./edit-item-page/edit-item-page.module')
|
||||||
|
.then((m) => m.EditItemPageModule),
|
||||||
canActivate: [ItemPageAdministratorGuard]
|
canActivate: [ItemPageAdministratorGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -7,14 +7,14 @@ import { AuthenticatedGuard } from './core/auth/authenticated.guard';
|
|||||||
import { SiteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
import { SiteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||||
import {
|
import {
|
||||||
UNAUTHORIZED_PATH,
|
|
||||||
WORKFLOW_ITEM_MODULE_PATH,
|
|
||||||
FORGOT_PASSWORD_PATH,
|
|
||||||
REGISTER_PATH,
|
|
||||||
PROFILE_MODULE_PATH,
|
|
||||||
ADMIN_MODULE_PATH,
|
ADMIN_MODULE_PATH,
|
||||||
BITSTREAM_MODULE_PATH,
|
BITSTREAM_MODULE_PATH,
|
||||||
INFO_MODULE_PATH
|
FORGOT_PASSWORD_PATH,
|
||||||
|
INFO_MODULE_PATH,
|
||||||
|
PROFILE_MODULE_PATH,
|
||||||
|
REGISTER_PATH,
|
||||||
|
UNAUTHORIZED_PATH,
|
||||||
|
WORKFLOW_ITEM_MODULE_PATH
|
||||||
} from './app-routing-paths';
|
} from './app-routing-paths';
|
||||||
import { COLLECTION_MODULE_PATH } from './+collection-page/collection-page-routing-paths';
|
import { COLLECTION_MODULE_PATH } from './+collection-page/collection-page-routing-paths';
|
||||||
import { COMMUNITY_MODULE_PATH } from './+community-page/community-page-routing-paths';
|
import { COMMUNITY_MODULE_PATH } from './+community-page/community-page-routing-paths';
|
||||||
@@ -25,58 +25,158 @@ import { SiteRegisterGuard } from './core/data/feature-authorization/feature-aut
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forRoot([
|
RouterModule.forRoot([{
|
||||||
{ path: '', canActivate: [AuthBlockingGuard],
|
path: '', canActivate: [AuthBlockingGuard],
|
||||||
children: [
|
children: [
|
||||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||||
{ path: 'reload/:rnd', component: PageNotFoundComponent, pathMatch: 'full', canActivate: [ReloadGuard] },
|
{ path: 'reload/:rnd', component: PageNotFoundComponent, pathMatch: 'full', canActivate: [ReloadGuard] },
|
||||||
{ path: 'home', loadChildren: './+home-page/home-page.module#HomePageModule', data: { showBreadcrumbs: false }, canActivate: [EndUserAgreementCurrentUserGuard] },
|
{
|
||||||
{ path: 'community-list', loadChildren: './community-list-page/community-list-page.module#CommunityListPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
path: 'home',
|
||||||
{ path: 'id', loadChildren: './+lookup-by-id/lookup-by-id.module#LookupIdModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
loadChildren: () => import('./+home-page/home-page.module')
|
||||||
{ path: 'handle', loadChildren: './+lookup-by-id/lookup-by-id.module#LookupIdModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
.then((m) => m.HomePageModule),
|
||||||
{ path: REGISTER_PATH, loadChildren: './register-page/register-page.module#RegisterPageModule', canActivate: [SiteRegisterGuard] },
|
data: { showBreadcrumbs: false },
|
||||||
{ path: FORGOT_PASSWORD_PATH, loadChildren: './forgot-password/forgot-password.module#ForgotPasswordModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
{ path: COMMUNITY_MODULE_PATH, loadChildren: './+community-page/community-page.module#CommunityPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
},
|
||||||
{ path: COLLECTION_MODULE_PATH, loadChildren: './+collection-page/collection-page.module#CollectionPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
{
|
||||||
{ path: ITEM_MODULE_PATH, loadChildren: './+item-page/item-page.module#ItemPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
path: 'community-list',
|
||||||
{ path: BITSTREAM_MODULE_PATH, loadChildren: './+bitstream-page/bitstream-page.module#BitstreamPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
loadChildren: () => import('./community-list-page/community-list-page.module')
|
||||||
{
|
.then((m) => m.CommunityListPageModule),
|
||||||
path: 'mydspace',
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
loadChildren: './+my-dspace-page/my-dspace-page.module#MyDSpacePageModule',
|
},
|
||||||
canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
|
{
|
||||||
},
|
path: 'id',
|
||||||
{ path: 'search', loadChildren: './+search-page/search-page-routing.module#SearchPageRoutingModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
loadChildren: () => import('./+lookup-by-id/lookup-by-id.module')
|
||||||
{ path: 'browse', loadChildren: './+browse-by/browse-by.module#BrowseByModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
.then((m) => m.LookupIdModule),
|
||||||
{ path: ADMIN_MODULE_PATH, loadChildren: './+admin/admin.module#AdminModule', canActivate: [SiteAdministratorGuard, EndUserAgreementCurrentUserGuard] },
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
{ path: 'login', loadChildren: './+login-page/login-page.module#LoginPageModule' },
|
},
|
||||||
{ path: 'logout', loadChildren: './+logout-page/logout-page.module#LogoutPageModule' },
|
{
|
||||||
{ path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
path: 'handle',
|
||||||
{ path: 'import-external', loadChildren: './+import-external-page/import-external-page.module#ImportExternalPageModule', canActivate: [EndUserAgreementCurrentUserGuard] },
|
loadChildren: () => import('./+lookup-by-id/lookup-by-id.module')
|
||||||
{
|
.then((m) => m.LookupIdModule),
|
||||||
path: 'workspaceitems',
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule',
|
},
|
||||||
canActivate: [EndUserAgreementCurrentUserGuard]
|
{
|
||||||
},
|
path: REGISTER_PATH,
|
||||||
{
|
loadChildren: () => import('./register-page/register-page.module')
|
||||||
path: WORKFLOW_ITEM_MODULE_PATH,
|
.then((m) => m.RegisterPageModule),
|
||||||
loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule',
|
canActivate: [SiteRegisterGuard]
|
||||||
canActivate: [EndUserAgreementCurrentUserGuard]
|
},
|
||||||
},
|
{
|
||||||
{
|
path: FORGOT_PASSWORD_PATH,
|
||||||
path: PROFILE_MODULE_PATH,
|
loadChildren: () => import('./forgot-password/forgot-password.module')
|
||||||
loadChildren: './profile-page/profile-page.module#ProfilePageModule', canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
|
.then((m) => m.ForgotPasswordModule),
|
||||||
},
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
{ path: 'processes', loadChildren: './process-page/process-page.module#ProcessPageModule', canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard] },
|
},
|
||||||
{ path: INFO_MODULE_PATH, loadChildren: './info/info.module#InfoModule' },
|
{
|
||||||
{ path: UNAUTHORIZED_PATH, component: UnauthorizedComponent },
|
path: COMMUNITY_MODULE_PATH,
|
||||||
{
|
loadChildren: () => import('./+community-page/community-page.module')
|
||||||
path: 'statistics',
|
.then((m) => m.CommunityPageModule),
|
||||||
loadChildren: './statistics-page/statistics-page-routing.module#StatisticsPageRoutingModule',
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
},
|
},
|
||||||
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
{
|
||||||
]}
|
path: COLLECTION_MODULE_PATH,
|
||||||
],
|
loadChildren: () => import('./+collection-page/collection-page.module')
|
||||||
{
|
.then((m) => m.CollectionPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ITEM_MODULE_PATH,
|
||||||
|
loadChildren: () => import('./+item-page/item-page.module')
|
||||||
|
.then((m) => m.ItemPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: BITSTREAM_MODULE_PATH,
|
||||||
|
loadChildren: () => import('./+bitstream-page/bitstream-page.module')
|
||||||
|
.then((m) => m.BitstreamPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'mydspace',
|
||||||
|
loadChildren: () => import('./+my-dspace-page/my-dspace-page.module')
|
||||||
|
.then((m) => m.MyDSpacePageModule),
|
||||||
|
canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'search',
|
||||||
|
loadChildren: () => import('./+search-page/search-page-routing.module')
|
||||||
|
.then((m) => m.SearchPageRoutingModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'browse',
|
||||||
|
loadChildren: () => import('./+browse-by/browse-by.module')
|
||||||
|
.then((m) => m.BrowseByModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ADMIN_MODULE_PATH,
|
||||||
|
loadChildren: () => import('./+admin/admin.module')
|
||||||
|
.then((m) => m.AdminModule),
|
||||||
|
canActivate: [SiteAdministratorGuard, EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'login',
|
||||||
|
loadChildren: () => import('./+login-page/login-page.module')
|
||||||
|
.then((m) => m.LoginPageModule),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'logout',
|
||||||
|
loadChildren: () => import('./+logout-page/logout-page.module')
|
||||||
|
.then((m) => m.LogoutPageModule),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'submit',
|
||||||
|
loadChildren: () => import('./+submit-page/submit-page.module')
|
||||||
|
.then((m) => m.SubmitPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'import-external',
|
||||||
|
loadChildren: () => import('./+import-external-page/import-external-page.module')
|
||||||
|
.then((m) => m.ImportExternalPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'workspaceitems',
|
||||||
|
loadChildren: () => import('./+workspaceitems-edit-page/workspaceitems-edit-page.module')
|
||||||
|
.then((m) => m.WorkspaceitemsEditPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: WORKFLOW_ITEM_MODULE_PATH,
|
||||||
|
loadChildren: () => import('./+workflowitems-edit-page/workflowitems-edit-page.module')
|
||||||
|
.then((m) => m.WorkflowItemsEditPageModule),
|
||||||
|
canActivate: [EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: PROFILE_MODULE_PATH,
|
||||||
|
loadChildren: () => import('./profile-page/profile-page.module')
|
||||||
|
.then((m) => m.ProfilePageModule),
|
||||||
|
canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'processes',
|
||||||
|
loadChildren: () => import('./process-page/process-page.module')
|
||||||
|
.then((m) => m.ProcessPageModule),
|
||||||
|
canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: INFO_MODULE_PATH,
|
||||||
|
loadChildren: () => import('./info/info.module').then((m) => m.InfoModule),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: UNAUTHORIZED_PATH,
|
||||||
|
component: UnauthorizedComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'statistics',
|
||||||
|
loadChildren: () => import('./statistics-page/statistics-page-routing.module')
|
||||||
|
.then((m) => m.StatisticsPageRoutingModule),
|
||||||
|
},
|
||||||
|
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
|
||||||
|
]}
|
||||||
|
],{
|
||||||
onSameUrlNavigation: 'reload',
|
onSameUrlNavigation: 'reload',
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./out-tsc/app",
|
"outDir": "./out-tsc/app",
|
||||||
|
"module": "esnext",
|
||||||
"types": []
|
"types": []
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
Reference in New Issue
Block a user