[DSC-287] reformat app-routing.module code

This commit is contained in:
Giuseppe Digilio
2021-11-15 19:02:10 +01:00
parent 25a51c9764
commit 81c4403ee6

View File

@@ -11,10 +11,11 @@ import {
FORBIDDEN_PATH, FORBIDDEN_PATH,
FORGOT_PASSWORD_PATH, FORGOT_PASSWORD_PATH,
INFO_MODULE_PATH, INFO_MODULE_PATH,
LEGACY_BITSTREAM_MODULE_PATH,
PROFILE_MODULE_PATH, PROFILE_MODULE_PATH,
REGISTER_PATH, REGISTER_PATH,
REQUEST_COPY_MODULE_PATH,
WORKFLOW_ITEM_MODULE_PATH, WORKFLOW_ITEM_MODULE_PATH,
LEGACY_BITSTREAM_MODULE_PATH, REQUEST_COPY_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';
@@ -29,187 +30,193 @@ import { GroupAdministratorGuard } from './core/data/feature-authorization/featu
import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component'; import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component';
import { ServerCheckGuard } from './core/server-check/server-check.guard'; import { ServerCheckGuard } from './core/server-check/server-check.guard';
@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: ThemedPageNotFoundComponent, pathMatch: 'full', canActivate: [ServerCheckGuard, ReloadGuard] }, {
{ path: 'reload/:rnd',
path: 'home', component: ThemedPageNotFoundComponent,
loadChildren: () => import('./home-page/home-page.module') pathMatch: 'full',
.then((m) => m.HomePageModule), canActivate: [ServerCheckGuard, ReloadGuard]
data: { showBreadcrumbs: false }, },
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] {
}, path: 'home',
{ loadChildren: () => import('./home-page/home-page.module')
path: 'community-list', .then((m) => m.HomePageModule),
loadChildren: () => import('./community-list-page/community-list-page.module') data: { showBreadcrumbs: false },
.then((m) => m.CommunityListPageModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: 'community-list',
path: 'id', loadChildren: () => import('./community-list-page/community-list-page.module')
loadChildren: () => import('./lookup-by-id/lookup-by-id.module') .then((m) => m.CommunityListPageModule),
.then((m) => m.LookupIdModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: 'id',
path: 'handle', loadChildren: () => import('./lookup-by-id/lookup-by-id.module')
loadChildren: () => import('./lookup-by-id/lookup-by-id.module') .then((m) => m.LookupIdModule),
.then((m) => m.LookupIdModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: 'handle',
path: REGISTER_PATH, loadChildren: () => import('./lookup-by-id/lookup-by-id.module')
loadChildren: () => import('./register-page/register-page.module') .then((m) => m.LookupIdModule),
.then((m) => m.RegisterPageModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, SiteRegisterGuard] },
}, {
{ path: REGISTER_PATH,
path: FORGOT_PASSWORD_PATH, loadChildren: () => import('./register-page/register-page.module')
loadChildren: () => import('./forgot-password/forgot-password.module') .then((m) => m.RegisterPageModule),
.then((m) => m.ForgotPasswordModule), canActivate: [ServerCheckGuard, SiteRegisterGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: FORGOT_PASSWORD_PATH,
path: COMMUNITY_MODULE_PATH, loadChildren: () => import('./forgot-password/forgot-password.module')
loadChildren: () => import('./community-page/community-page.module') .then((m) => m.ForgotPasswordModule),
.then((m) => m.CommunityPageModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: COMMUNITY_MODULE_PATH,
path: COLLECTION_MODULE_PATH, loadChildren: () => import('./community-page/community-page.module')
loadChildren: () => import('./collection-page/collection-page.module') .then((m) => m.CommunityPageModule),
.then((m) => m.CollectionPageModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: COLLECTION_MODULE_PATH,
path: ITEM_MODULE_PATH, loadChildren: () => import('./collection-page/collection-page.module')
loadChildren: () => import('./item-page/item-page.module') .then((m) => m.CollectionPageModule),
.then((m) => m.ItemPageModule), canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] },
}, {
{ path: 'entities/:entity-type', path: ITEM_MODULE_PATH,
loadChildren: () => import('./item-page/item-page.module') loadChildren: () => import('./item-page/item-page.module')
.then((m) => m.ItemPageModule), .then((m) => m.ItemPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: LEGACY_BITSTREAM_MODULE_PATH, path: 'entities/:entity-type',
loadChildren: () => import('./bitstream-page/bitstream-page.module') loadChildren: () => import('./item-page/item-page.module')
.then((m) => m.BitstreamPageModule), .then((m) => m.ItemPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: BITSTREAM_MODULE_PATH, path: LEGACY_BITSTREAM_MODULE_PATH,
loadChildren: () => import('./bitstream-page/bitstream-page.module') loadChildren: () => import('./bitstream-page/bitstream-page.module')
.then((m) => m.BitstreamPageModule), .then((m) => m.BitstreamPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: 'mydspace', path: BITSTREAM_MODULE_PATH,
loadChildren: () => import('./my-dspace-page/my-dspace-page.module') loadChildren: () => import('./bitstream-page/bitstream-page.module')
.then((m) => m.MyDSpacePageModule), .then((m) => m.BitstreamPageModule),
canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: 'search', path: 'mydspace',
loadChildren: () => import('./search-page/search-page-routing.module') loadChildren: () => import('./my-dspace-page/my-dspace-page.module')
.then((m) => m.SearchPageRoutingModule), .then((m) => m.MyDSpacePageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: 'browse', path: 'search',
loadChildren: () => import('./browse-by/browse-by-page.module') loadChildren: () => import('./search-page/search-page-routing.module')
.then((m) => m.BrowseByPageModule), .then((m) => m.SearchPageRoutingModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: ADMIN_MODULE_PATH, path: 'browse',
loadChildren: () => import('./admin/admin.module') loadChildren: () => import('./browse-by/browse-by-page.module')
.then((m) => m.AdminModule), .then((m) => m.BrowseByPageModule),
canActivate: [ServerCheckGuard, SiteAdministratorGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: 'login', path: ADMIN_MODULE_PATH,
loadChildren: () => import('./login-page/login-page.module') loadChildren: () => import('./admin/admin.module')
.then((m) => m.LoginPageModule), .then((m) => m.AdminModule),
canActivate: [ServerCheckGuard] canActivate: [ServerCheckGuard, SiteAdministratorGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: 'logout', path: 'login',
loadChildren: () => import('./logout-page/logout-page.module') loadChildren: () => import('./login-page/login-page.module')
.then((m) => m.LogoutPageModule), .then((m) => m.LoginPageModule),
canActivate: [ServerCheckGuard] canActivate: [ServerCheckGuard]
}, },
{ {
path: 'submit', path: 'logout',
loadChildren: () => import('./submit-page/submit-page.module') loadChildren: () => import('./logout-page/logout-page.module')
.then((m) => m.SubmitPageModule), .then((m) => m.LogoutPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard]
}, },
{ {
path: 'import-external', path: 'submit',
loadChildren: () => import('./import-external-page/import-external-page.module') loadChildren: () => import('./submit-page/submit-page.module')
.then((m) => m.ImportExternalPageModule), .then((m) => m.SubmitPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: 'workspaceitems', path: 'import-external',
loadChildren: () => import('./workspaceitems-edit-page/workspaceitems-edit-page.module') loadChildren: () => import('./import-external-page/import-external-page.module')
.then((m) => m.WorkspaceitemsEditPageModule), .then((m) => m.ImportExternalPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: WORKFLOW_ITEM_MODULE_PATH, path: 'workspaceitems',
loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page.module') loadChildren: () => import('./workspaceitems-edit-page/workspaceitems-edit-page.module')
.then((m) => m.WorkflowItemsEditPageModule), .then((m) => m.WorkspaceitemsEditPageModule),
canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: PROFILE_MODULE_PATH, path: WORKFLOW_ITEM_MODULE_PATH,
loadChildren: () => import('./profile-page/profile-page.module') loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page.module')
.then((m) => m.ProfilePageModule), .then((m) => m.WorkflowItemsEditPageModule),
canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: PROCESS_MODULE_PATH, path: PROFILE_MODULE_PATH,
loadChildren: () => import('./process-page/process-page.module') loadChildren: () => import('./profile-page/profile-page.module')
.then((m) => m.ProcessPageModule), .then((m) => m.ProfilePageModule),
canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard] canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
}, },
{ {
path: INFO_MODULE_PATH, path: PROCESS_MODULE_PATH,
loadChildren: () => import('./info/info.module').then((m) => m.InfoModule), loadChildren: () => import('./process-page/process-page.module')
canActivate: [ServerCheckGuard] .then((m) => m.ProcessPageModule),
}, canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
{ },
path: REQUEST_COPY_MODULE_PATH, {
loadChildren: () => import('./request-copy/request-copy.module').then((m) => m.RequestCopyModule), path: INFO_MODULE_PATH,
canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard] loadChildren: () => import('./info/info.module').then((m) => m.InfoModule),
}, canActivate: [ServerCheckGuard]
{ },
path: FORBIDDEN_PATH, {
component: ThemedForbiddenComponent path: REQUEST_COPY_MODULE_PATH,
}, loadChildren: () => import('./request-copy/request-copy.module').then((m) => m.RequestCopyModule),
{ canActivate: [ServerCheckGuard, AuthenticatedGuard, EndUserAgreementCurrentUserGuard]
path: 'statistics', },
loadChildren: () => import('./statistics-page/statistics-page-routing.module') {
.then((m) => m.StatisticsPageRoutingModule), path: FORBIDDEN_PATH,
canActivate: [ServerCheckGuard] component: ThemedForbiddenComponent
}, },
{ {
path: ACCESS_CONTROL_MODULE_PATH, path: 'statistics',
loadChildren: () => import('./access-control/access-control.module').then((m) => m.AccessControlModule), loadChildren: () => import('./statistics-page/statistics-page-routing.module')
canActivate: [ServerCheckGuard, GroupAdministratorGuard], .then((m) => m.StatisticsPageRoutingModule),
}, canActivate: [ServerCheckGuard]
{ path: '500', component: ThemedPageInternalServerErrorComponent }, },
{ path: '**', pathMatch: 'full', component: ThemedPageNotFoundComponent }, {
]} path: ACCESS_CONTROL_MODULE_PATH,
],{ loadChildren: () => import('./access-control/access-control.module').then((m) => m.AccessControlModule),
canActivate: [ServerCheckGuard, GroupAdministratorGuard],
},
{ path: '500', component: ThemedPageInternalServerErrorComponent },
{ path: '**', pathMatch: 'full', component: ThemedPageNotFoundComponent },
]
}
], {
onSameUrlNavigation: 'reload', onSameUrlNavigation: 'reload',
}) })
], ],