diff --git a/src/app/app-routes.ts b/src/app/app-routes.ts new file mode 100644 index 0000000000..342e1731af --- /dev/null +++ b/src/app/app-routes.ts @@ -0,0 +1,295 @@ +import { importProvidersFrom } from '@angular/core'; +import { + ExtraOptions, + NoPreloading, + Route, +} from '@angular/router'; +import { EffectsModule } from '@ngrx/effects'; +import { + Action, + StoreConfig, + StoreModule, +} from '@ngrx/store'; + +import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths'; +import { storeModuleConfig } from './app.reducer'; +import { + ACCESS_CONTROL_MODULE_PATH, + ADMIN_MODULE_PATH, + BITSTREAM_MODULE_PATH, + ERROR_PAGE, + FORBIDDEN_PATH, + FORGOT_PASSWORD_PATH, + HEALTH_PAGE_PATH, + INFO_MODULE_PATH, + INTERNAL_SERVER_ERROR, + LEGACY_BITSTREAM_MODULE_PATH, + PROFILE_MODULE_PATH, + REGISTER_PATH, + REQUEST_COPY_MODULE_PATH, + WORKFLOW_ITEM_MODULE_PATH, +} from './app-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 { AuthBlockingGuard } from './core/auth/auth-blocking.guard'; +import { AuthenticatedGuard } from './core/auth/authenticated.guard'; +import { GroupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard'; +import { SiteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard'; +import { EndUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-user-agreement-current-user.guard'; +import { ReloadGuard } from './core/reload/reload.guard'; +import { ForgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard'; +import { ServerCheckGuard } from './core/server-check/server-check.guard'; +import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component'; +import { ITEM_MODULE_PATH } from './item-page/item-page-routing-paths'; +import { MenuResolver } from './menu.resolver'; +import { ThemedPageErrorComponent } from './page-error/themed-page-error.component'; +import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component'; +import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.component'; +import { PROCESS_MODULE_PATH } from './process-page/process-page-routing.paths'; +import { submissionEffects } from './submission/submission.effects'; +import { + submissionReducers, + SubmissionState, +} from './submission/submission.reducers'; +import { SUGGESTION_MODULE_PATH } from './suggestions-page/suggestions-page-routing-paths'; + +export const APP_ROUTES: Route[] = [ + { path: INTERNAL_SERVER_ERROR, component: ThemedPageInternalServerErrorComponent }, + { path: ERROR_PAGE, component: ThemedPageErrorComponent }, + { + path: '', + canActivate: [AuthBlockingGuard], + canActivateChild: [ServerCheckGuard], + resolve: [MenuResolver], + children: [ + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { + path: 'reload/:rnd', + component: ThemedPageNotFoundComponent, + pathMatch: 'full', + canActivate: [ReloadGuard], + }, + { + path: 'home', + loadChildren: () => import('./home-page/home-page-routes') + .then((m) => m.ROUTES), + data: { showBreadcrumbs: false }, + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'community-list', + loadChildren: () => import('./community-list-page/community-list-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'id', + loadChildren: () => import('./lookup-by-id/lookup-by-id-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'handle', + loadChildren: () => import('./lookup-by-id/lookup-by-id-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: REGISTER_PATH, + loadChildren: () => import('./register-page/register-page-routes') + .then((m) => m.ROUTES), + canActivate: [SiteRegisterGuard], + }, + { + path: FORGOT_PASSWORD_PATH, + loadChildren: () => import('./forgot-password/forgot-password-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard, ForgotPasswordCheckGuard], + }, + { + path: COMMUNITY_MODULE_PATH, + loadChildren: () => import('./community-page/community-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: COLLECTION_MODULE_PATH, + loadChildren: () => import('./collection-page/collection-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: ITEM_MODULE_PATH, + loadChildren: () => import('./item-page/item-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'entities/:entity-type', + loadChildren: () => import('./item-page/item-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: LEGACY_BITSTREAM_MODULE_PATH, + loadChildren: () => import('./bitstream-page/bitstream-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: BITSTREAM_MODULE_PATH, + loadChildren: () => import('./bitstream-page/bitstream-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'mydspace', + loadChildren: () => import('./my-dspace-page/my-dspace-page-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: 'search', + loadChildren: () => import('./search-page/search-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'browse', + loadChildren: () => import('./browse-by/browse-by-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: ADMIN_MODULE_PATH, + loadChildren: () => import('./admin/admin-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: NOTIFICATIONS_MODULE_PATH, + loadChildren: () => import('./admin/admin-notifications/admin-notifications-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: NOTIFICATIONS_MODULE_PATH, + loadChildren: () => import('./quality-assurance-notifications-pages/notifications-pages-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: 'login', + loadChildren: () => import('./login-page/login-page-routes') + .then((m) => m.ROUTES), + }, + { + path: 'logout', + loadChildren: () => import('./logout-page/logout-page-routes') + .then((m) => m.ROUTES), + }, + { + path: 'submit', + loadChildren: () => import('./submit-page/submit-page-routes') + .then((m) => m.ROUTES), + providers: [ + importProvidersFrom( + StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), + EffectsModule.forFeature(submissionEffects), + )], + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'import-external', + loadChildren: () => import('./import-external-page/import-external-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: 'workspaceitems', + loadChildren: () => import('./workspaceitems-edit-page/workspaceitems-edit-page-routes') + .then((m) => m.ROUTES), + providers: [ + importProvidersFrom( + StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), + EffectsModule.forFeature(submissionEffects), + )], + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: WORKFLOW_ITEM_MODULE_PATH, + providers: [ + importProvidersFrom( + StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), + EffectsModule.forFeature(submissionEffects), + )], + loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: PROFILE_MODULE_PATH, + loadChildren: () => import('./profile-page/profile-page-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: PROCESS_MODULE_PATH, + loadChildren: () => import('./process-page/process-page-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: SUGGESTION_MODULE_PATH, + loadChildren: () => import('./suggestions-page/suggestions-page-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: INFO_MODULE_PATH, + loadChildren: () => import('./info/info-routes').then((m) => m.ROUTES), + }, + { + path: REQUEST_COPY_MODULE_PATH, + loadChildren: () => import('./request-copy/request-copy-routes').then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: FORBIDDEN_PATH, + component: ThemedForbiddenComponent, + }, + { + path: 'statistics', + loadChildren: () => import('./statistics-page/statistics-page-routes') + .then((m) => m.ROUTES), + canActivate: [EndUserAgreementCurrentUserGuard], + }, + { + path: HEALTH_PAGE_PATH, + loadChildren: () => import('./health-page/health-page-routes') + .then((m) => m.ROUTES), + }, + { + path: ACCESS_CONTROL_MODULE_PATH, + loadChildren: () => import('./access-control/access-control-routes').then((m) => m.ROUTES), + canActivate: [GroupAdministratorGuard, EndUserAgreementCurrentUserGuard], + }, + { + path: 'subscriptions', + loadChildren: () => import('./subscriptions-page/subscriptions-page-routes') + .then((m) => m.ROUTES), + canActivate: [AuthenticatedGuard], + }, + { path: '**', pathMatch: 'full', component: ThemedPageNotFoundComponent }, + ], + }, +]; +export const APP_ROUTING_CONF: ExtraOptions = { + // enableTracing: true, + useHash: false, + scrollPositionRestoration: 'enabled', + anchorScrolling: 'enabled', + initialNavigation: 'enabledBlocking', + preloadingStrategy: NoPreloading, + onSameUrlNavigation: 'reload', +}; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts deleted file mode 100644 index 5fc32c9808..0000000000 --- a/src/app/app-routing.module.ts +++ /dev/null @@ -1,304 +0,0 @@ -import { - importProvidersFrom, - NgModule, -} from '@angular/core'; -import { - NoPreloading, - RouterModule, -} from '@angular/router'; -import { EffectsModule } from '@ngrx/effects'; -import { - Action, - StoreConfig, - StoreModule, -} from '@ngrx/store'; - -import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths'; -import { storeModuleConfig } from './app.reducer'; -import { - ACCESS_CONTROL_MODULE_PATH, - ADMIN_MODULE_PATH, - BITSTREAM_MODULE_PATH, - ERROR_PAGE, - FORBIDDEN_PATH, - FORGOT_PASSWORD_PATH, - HEALTH_PAGE_PATH, - INFO_MODULE_PATH, - INTERNAL_SERVER_ERROR, - LEGACY_BITSTREAM_MODULE_PATH, - PROFILE_MODULE_PATH, - REGISTER_PATH, - REQUEST_COPY_MODULE_PATH, - WORKFLOW_ITEM_MODULE_PATH, -} from './app-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 { AuthBlockingGuard } from './core/auth/auth-blocking.guard'; -import { AuthenticatedGuard } from './core/auth/authenticated.guard'; -import { GroupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard'; -import { SiteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard'; -import { EndUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-user-agreement-current-user.guard'; -import { ReloadGuard } from './core/reload/reload.guard'; -import { ForgotPasswordCheckGuard } from './core/rest-property/forgot-password-check-guard.guard'; -import { ServerCheckGuard } from './core/server-check/server-check.guard'; -import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component'; -import { ITEM_MODULE_PATH } from './item-page/item-page-routing-paths'; -import { MenuResolver } from './menu.resolver'; -import { ThemedPageErrorComponent } from './page-error/themed-page-error.component'; -import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component'; -import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.component'; -import { PROCESS_MODULE_PATH } from './process-page/process-page-routing.paths'; -import { submissionEffects } from './submission/submission.effects'; -import { - submissionReducers, - SubmissionState, -} from './submission/submission.reducers'; -import { SUGGESTION_MODULE_PATH } from './suggestions-page/suggestions-page-routing-paths'; - -@NgModule({ - imports: [ - RouterModule.forRoot([ - { path: INTERNAL_SERVER_ERROR, component: ThemedPageInternalServerErrorComponent }, - { path: ERROR_PAGE, component: ThemedPageErrorComponent }, - { - path: '', - canActivate: [AuthBlockingGuard], - canActivateChild: [ServerCheckGuard], - resolve: [MenuResolver], - children: [ - { path: '', redirectTo: '/home', pathMatch: 'full' }, - { - path: 'reload/:rnd', - component: ThemedPageNotFoundComponent, - pathMatch: 'full', - canActivate: [ReloadGuard], - }, - { - path: 'home', - loadChildren: () => import('./home-page/home-page-routes') - .then((m) => m.ROUTES), - data: { showBreadcrumbs: false }, - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'community-list', - loadChildren: () => import('./community-list-page/community-list-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'id', - loadChildren: () => import('./lookup-by-id/lookup-by-id-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'handle', - loadChildren: () => import('./lookup-by-id/lookup-by-id-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: REGISTER_PATH, - loadChildren: () => import('./register-page/register-page-routes') - .then((m) => m.ROUTES), - canActivate: [SiteRegisterGuard], - }, - { - path: FORGOT_PASSWORD_PATH, - loadChildren: () => import('./forgot-password/forgot-password-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard, ForgotPasswordCheckGuard], - }, - { - path: COMMUNITY_MODULE_PATH, - loadChildren: () => import('./community-page/community-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: COLLECTION_MODULE_PATH, - loadChildren: () => import('./collection-page/collection-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: ITEM_MODULE_PATH, - loadChildren: () => import('./item-page/item-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'entities/:entity-type', - loadChildren: () => import('./item-page/item-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: LEGACY_BITSTREAM_MODULE_PATH, - loadChildren: () => import('./bitstream-page/bitstream-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: BITSTREAM_MODULE_PATH, - loadChildren: () => import('./bitstream-page/bitstream-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'mydspace', - loadChildren: () => import('./my-dspace-page/my-dspace-page-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: 'search', - loadChildren: () => import('./search-page/search-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'browse', - loadChildren: () => import('./browse-by/browse-by-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: ADMIN_MODULE_PATH, - loadChildren: () => import('./admin/admin-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: NOTIFICATIONS_MODULE_PATH, - loadChildren: () => import('./admin/admin-notifications/admin-notifications-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: NOTIFICATIONS_MODULE_PATH, - loadChildren: () => import('./quality-assurance-notifications-pages/notifications-pages-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: 'login', - loadChildren: () => import('./login-page/login-page-routes') - .then((m) => m.ROUTES), - }, - { - path: 'logout', - loadChildren: () => import('./logout-page/logout-page-routes') - .then((m) => m.ROUTES), - }, - { - path: 'submit', - loadChildren: () => import('./submit-page/submit-page-routes') - .then((m) => m.ROUTES), - providers: [ - importProvidersFrom( - StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), - EffectsModule.forFeature(submissionEffects), - )], - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'import-external', - loadChildren: () => import('./import-external-page/import-external-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: 'workspaceitems', - loadChildren: () => import('./workspaceitems-edit-page/workspaceitems-edit-page-routes') - .then((m) => m.ROUTES), - providers: [ - importProvidersFrom( - StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), - EffectsModule.forFeature(submissionEffects), - )], - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: WORKFLOW_ITEM_MODULE_PATH, - providers: [ - importProvidersFrom( - StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), - EffectsModule.forFeature(submissionEffects), - )], - loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: PROFILE_MODULE_PATH, - loadChildren: () => import('./profile-page/profile-page-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: PROCESS_MODULE_PATH, - loadChildren: () => import('./process-page/process-page-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: SUGGESTION_MODULE_PATH, - loadChildren: () => import('./suggestions-page/suggestions-page-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: INFO_MODULE_PATH, - loadChildren: () => import('./info/info-routes').then((m) => m.ROUTES), - }, - { - path: REQUEST_COPY_MODULE_PATH, - loadChildren: () => import('./request-copy/request-copy-routes').then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: FORBIDDEN_PATH, - component: ThemedForbiddenComponent, - }, - { - path: 'statistics', - loadChildren: () => import('./statistics-page/statistics-page-routes') - .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], - }, - { - path: HEALTH_PAGE_PATH, - loadChildren: () => import('./health-page/health-page-routes') - .then((m) => m.ROUTES), - }, - { - path: ACCESS_CONTROL_MODULE_PATH, - loadChildren: () => import('./access-control/access-control-routes').then((m) => m.ROUTES), - canActivate: [GroupAdministratorGuard, EndUserAgreementCurrentUserGuard], - }, - { - path: 'subscriptions', - loadChildren: () => import('./subscriptions-page/subscriptions-page-routes') - .then((m) => m.ROUTES), - canActivate: [AuthenticatedGuard], - }, - { path: '**', pathMatch: 'full', component: ThemedPageNotFoundComponent }, - ], - }, - ], { - // enableTracing: true, - useHash: false, - scrollPositionRestoration: 'enabled', - anchorScrolling: 'enabled', - initialNavigation: 'enabledBlocking', - preloadingStrategy: NoPreloading, - onSameUrlNavigation: 'reload', - }), - ], - exports: [RouterModule], -}) -export class AppRoutingModule { - -} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 54790cf2db..d631a1d252 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,6 +9,10 @@ import { } from '@angular/common/http'; import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; +import { + provideRouter, + withRouterConfig, +} from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { DYNAMIC_MATCHER_PROVIDERS } from '@ng-dynamic-forms/core'; import { EffectsModule } from '@ngrx/effects'; @@ -43,7 +47,10 @@ import { AppState, storeModuleConfig, } from './app.reducer'; -import { AppRoutingModule } from './app-routing.module'; +import { + APP_ROUTES, + APP_ROUTING_CONF, +} from './app-routes'; import { BROWSE_BY_DECORATOR_MAP } from './browse-by/browse-by-switcher/browse-by-decorator'; import { AuthInterceptor } from './core/auth/auth.interceptor'; import { LocaleInterceptor } from './core/locale/locale.interceptor'; @@ -83,7 +90,6 @@ export function getMetaReducers(appConfig: AppConfig): MetaReducer[] { const IMPORTS = [ CommonModule, HttpClientModule, - AppRoutingModule, ScrollToModule.forRoot(), NgbModule, TranslateModule.forRoot(), @@ -97,6 +103,7 @@ const IMPORTS = [ ]; const PROVIDERS = [ + provideRouter(APP_ROUTES, withRouterConfig(APP_ROUTING_CONF)), { provide: APP_BASE_HREF, useFactory: getBaseHref, diff --git a/src/app/community-page/sections/sub-com-col-section/sub-com-col-section.component.ts b/src/app/community-page/sections/sub-com-col-section/sub-com-col-section.component.ts index ea21c66b54..7aed3be076 100644 --- a/src/app/community-page/sections/sub-com-col-section/sub-com-col-section.component.ts +++ b/src/app/community-page/sections/sub-com-col-section/sub-com-col-section.component.ts @@ -1,4 +1,7 @@ -import { AsyncPipe } from '@angular/common'; +import { + AsyncPipe, + NgIf, +} from '@angular/common'; import { Component, OnInit, @@ -23,6 +26,7 @@ import { ThemedCommunityPageSubCommunityListComponent } from './sub-community-li ThemedCommunityPageSubCommunityListComponent, ThemedCollectionPageSubCollectionListComponent, AsyncPipe, + NgIf, ], standalone: true, }) diff --git a/src/app/core/data/system-wide-alert-data.service.ts b/src/app/core/data/system-wide-alert-data.service.ts index b0c0488ab0..afff0ef9ef 100644 --- a/src/app/core/data/system-wide-alert-data.service.ts +++ b/src/app/core/data/system-wide-alert-data.service.ts @@ -33,7 +33,7 @@ import { RequestService } from './request.service'; /** * Dataservice representing a system-wide alert */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class SystemWideAlertDataService extends IdentifiableDataService implements FindAllData, CreateData, PutData, SearchData { private findAllData: FindAllDataImpl; private createData: CreateDataImpl; diff --git a/src/app/root.module.ts b/src/app/root.module.ts index a3e32489ef..ba70f5ec70 100644 --- a/src/app/root.module.ts +++ b/src/app/root.module.ts @@ -28,11 +28,9 @@ import { ThemedRootComponent } from './root/themed-root.component'; import { IdleModalComponent } from './shared/idle-modal/idle-modal.component'; import { NotificationComponent } from './shared/notifications/notification/notification.component'; import { NotificationsBoardComponent } from './shared/notifications/notifications-board/notifications-board.component'; -import { SystemWideAlertModule } from './system-wide-alert/system-wide-alert.module'; const IMPORTS = [ CommonModule, - SystemWideAlertModule, NgbModule, ]; diff --git a/src/app/shared/subscriptions/subscriptions.module.ts b/src/app/shared/subscriptions/subscriptions.module.ts deleted file mode 100644 index 46a18f46c2..0000000000 --- a/src/app/shared/subscriptions/subscriptions.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; -import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; -import { TranslateModule } from '@ngx-translate/core'; - -import { SubscriptionModalComponent } from './subscription-modal/subscription-modal.component'; -import { SubscriptionViewComponent } from './subscription-view/subscription-view.component'; - -const COMPONENTS = [ - SubscriptionViewComponent, - SubscriptionModalComponent, -]; - -@NgModule({ - imports: [ - CommonModule, - NgbModalModule, - ReactiveFormsModule, - TranslateModule, - RouterModule, - ...COMPONENTS, - ], - exports: [ - ...COMPONENTS, - ], -}) -export class SubscriptionsModule { -} diff --git a/src/app/shared/upload/upload.module.ts b/src/app/shared/upload/upload.module.ts deleted file mode 100644 index a5538b6afd..0000000000 --- a/src/app/shared/upload/upload.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * The contents of this file are subject to the license and copyright - * detailed in the LICENSE and NOTICE files at the root of the source - * tree and available online at - * - * http://www.dspace.org/license/ - */ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FileUploadModule } from 'ng2-file-upload'; - -import { FileDropzoneNoUploaderComponent } from './file-dropzone-no-uploader/file-dropzone-no-uploader.component'; -import { UploaderComponent } from './uploader/uploader.component'; - -const COMPONENTS = [ - UploaderComponent, - FileDropzoneNoUploaderComponent, -]; - -@NgModule({ - imports: [ - CommonModule, - FileUploadModule, - ...COMPONENTS, - ], - providers: [ - ...COMPONENTS, - ], - exports: [ - ...COMPONENTS, - FileUploadModule, - ], -}) -export class UploadModule { -} diff --git a/src/app/statistics-page/statistics-page.module.ts b/src/app/statistics-page/statistics-page.module.ts deleted file mode 100644 index e1ca4dc7a1..0000000000 --- a/src/app/statistics-page/statistics-page.module.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; - -import { UsageReportDataService } from '../core/statistics/usage-report-data.service'; -import { StatisticsModule } from '../statistics/statistics.module'; -import { CollectionStatisticsPageComponent } from './collection-statistics-page/collection-statistics-page.component'; -import { ThemedCollectionStatisticsPageComponent } from './collection-statistics-page/themed-collection-statistics-page.component'; -import { CommunityStatisticsPageComponent } from './community-statistics-page/community-statistics-page.component'; -import { ThemedCommunityStatisticsPageComponent } from './community-statistics-page/themed-community-statistics-page.component'; -import { ItemStatisticsPageComponent } from './item-statistics-page/item-statistics-page.component'; -import { ThemedItemStatisticsPageComponent } from './item-statistics-page/themed-item-statistics-page.component'; -import { SiteStatisticsPageComponent } from './site-statistics-page/site-statistics-page.component'; -import { ThemedSiteStatisticsPageComponent } from './site-statistics-page/themed-site-statistics-page.component'; -import { StatisticsTableComponent } from './statistics-table/statistics-table.component'; - -const components = [ - StatisticsTableComponent, - SiteStatisticsPageComponent, - ItemStatisticsPageComponent, - CollectionStatisticsPageComponent, - CommunityStatisticsPageComponent, - ThemedCollectionStatisticsPageComponent, - ThemedCommunityStatisticsPageComponent, - ThemedItemStatisticsPageComponent, - ThemedSiteStatisticsPageComponent, -]; - -@NgModule({ - imports: [ - CommonModule, - StatisticsModule.forRoot(), - ...components, - ], - providers: [ - UsageReportDataService, - ], - exports: components, -}) - -/** - * This module handles all components and pipes that are necessary for the search page - */ -export class StatisticsPageModule { -} diff --git a/src/app/statistics/statistics.module.ts b/src/app/statistics/statistics.module.ts deleted file mode 100644 index ccaaa8f240..0000000000 --- a/src/app/statistics/statistics.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { - ModuleWithProviders, - NgModule, -} from '@angular/core'; - -import { ViewTrackerComponent } from './angulartics/dspace/view-tracker.component'; -import { StatisticsEndpoint } from './statistics-endpoint.model'; - -/** - * Declaration needed to make sure all decorator functions are called in time - */ -export const models = [ - StatisticsEndpoint, -]; - -@NgModule({ - imports: [ - CommonModule, - ViewTrackerComponent, - ], - exports: [ - ViewTrackerComponent, - ], -}) -/** - * This module handles the statistics - */ -export class StatisticsModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: StatisticsModule, - }; - } -} diff --git a/src/app/submission/submission.module.ts b/src/app/submission/submission.module.ts deleted file mode 100644 index 0a7b073d6b..0000000000 --- a/src/app/submission/submission.module.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { - CommonModule, - NgOptimizedImage, -} from '@angular/common'; -import { NgModule } from '@angular/core'; -import { - NgbAccordionModule, - NgbCollapseModule, - NgbModalModule, -} from '@ng-bootstrap/ng-bootstrap'; -import { EffectsModule } from '@ngrx/effects'; -import { - Action, - StoreConfig, - StoreModule, -} from '@ngrx/store'; - -import { LdnServicesService } from '../admin/admin-ldn-services/ldn-services-data/ldn-services-data.service'; -import { storeModuleConfig } from '../app.reducer'; -import { SubmissionAccessesConfigDataService } from '../core/config/submission-accesses-config-data.service'; -import { SubmissionUploadsConfigDataService } from '../core/config/submission-uploads-config-data.service'; -import { UploadModule } from '../shared/upload/upload.module'; -import { SubmissionEditComponent } from './edit/submission-edit.component'; -import { ThemedSubmissionEditComponent } from './edit/themed-submission-edit.component'; -import { SubmissionFormCollectionComponent } from './form/collection/submission-form-collection.component'; -import { SubmissionFormFooterComponent } from './form/footer/submission-form-footer.component'; -import { SubmissionFormSectionAddComponent } from './form/section-add/submission-form-section-add.component'; -import { SubmissionFormComponent } from './form/submission-form.component'; -import { SubmissionUploadFilesComponent } from './form/submission-upload-files/submission-upload-files.component'; -import { SubmissionImportExternalCollectionComponent } from './import-external/import-external-collection/submission-import-external-collection.component'; -import { SubmissionImportExternalPreviewComponent } from './import-external/import-external-preview/submission-import-external-preview.component'; -import { SubmissionImportExternalSearchbarComponent } from './import-external/import-external-searchbar/submission-import-external-searchbar.component'; -import { SubmissionImportExternalComponent } from './import-external/submission-import-external.component'; -import { ThemedSubmissionImportExternalComponent } from './import-external/themed-submission-import-external.component'; -import { SubmissionSectionAccessesComponent } from './sections/accesses/section-accesses.component'; -import { SectionAccessesService } from './sections/accesses/section-accesses.service'; -import { SubmissionSectionCcLicensesComponent } from './sections/cc-license/submission-section-cc-licenses.component'; -import { SubmissionSectionContainerComponent } from './sections/container/section-container.component'; -import { SubmissionSectionDuplicatesComponent } from './sections/duplicates/section-duplicates.component'; -import { SubmissionSectionFormComponent } from './sections/form/section-form.component'; -import { SectionFormOperationsService } from './sections/form/section-form-operations.service'; -import { SubmissionSectionIdentifiersComponent } from './sections/identifiers/section-identifiers.component'; -import { SubmissionSectionLicenseComponent } from './sections/license/section-license.component'; -import { CoarNotifyConfigDataService } from './sections/section-coar-notify/coar-notify-config-data.service'; -import { SubmissionSectionCoarNotifyComponent } from './sections/section-coar-notify/section-coar-notify.component'; -import { SectionsDirective } from './sections/sections.directive'; -import { SectionsService } from './sections/sections.service'; -import { ContentAccordionComponent } from './sections/sherpa-policies/content-accordion/content-accordion.component'; -import { MetadataInformationComponent } from './sections/sherpa-policies/metadata-information/metadata-information.component'; -import { PublicationInformationComponent } from './sections/sherpa-policies/publication-information/publication-information.component'; -import { PublisherPolicyComponent } from './sections/sherpa-policies/publisher-policy/publisher-policy.component'; -import { SubmissionSectionSherpaPoliciesComponent } from './sections/sherpa-policies/section-sherpa-policies.component'; -import { SubmissionSectionUploadAccessConditionsComponent } from './sections/upload/accessConditions/submission-section-upload-access-conditions.component'; -import { SubmissionSectionUploadFileEditComponent } from './sections/upload/file/edit/section-upload-file-edit.component'; -import { SubmissionSectionUploadFileComponent } from './sections/upload/file/section-upload-file.component'; -import { ThemedSubmissionSectionUploadFileComponent } from './sections/upload/file/themed-section-upload-file.component'; -import { SubmissionSectionUploadFileViewComponent } from './sections/upload/file/view/section-upload-file-view.component'; -import { SubmissionSectionUploadComponent } from './sections/upload/section-upload.component'; -import { SectionUploadService } from './sections/upload/section-upload.service'; -import { submissionEffects } from './submission.effects'; -import { - submissionReducers, - SubmissionState, -} from './submission.reducers'; -import { SubmissionSubmitComponent } from './submit/submission-submit.component'; -import { ThemedSubmissionSubmitComponent } from './submit/themed-submission-submit.component'; - -const ENTRY_COMPONENTS = [ - // put only entry components that use custom decorator - SubmissionSectionUploadComponent, - SubmissionSectionFormComponent, - SubmissionSectionLicenseComponent, - SubmissionSectionCcLicensesComponent, - SubmissionSectionAccessesComponent, - SubmissionSectionSherpaPoliciesComponent, - SubmissionSectionCoarNotifyComponent, - SubmissionSectionDuplicatesComponent, -]; - -const DECLARATIONS = [ - ...ENTRY_COMPONENTS, - SectionsDirective, - SubmissionEditComponent, - ThemedSubmissionEditComponent, - SubmissionFormSectionAddComponent, - SubmissionFormCollectionComponent, - SubmissionFormComponent, - SubmissionFormFooterComponent, - SubmissionSubmitComponent, - ThemedSubmissionSubmitComponent, - SubmissionUploadFilesComponent, - SubmissionSectionContainerComponent, - SubmissionSectionUploadAccessConditionsComponent, - SubmissionSectionUploadFileComponent, - SubmissionSectionUploadFileEditComponent, - SubmissionSectionUploadFileViewComponent, - SubmissionSectionIdentifiersComponent, - SubmissionSectionDuplicatesComponent, - SubmissionImportExternalComponent, - ThemedSubmissionImportExternalComponent, - SubmissionImportExternalSearchbarComponent, - SubmissionImportExternalPreviewComponent, - SubmissionImportExternalCollectionComponent, - ContentAccordionComponent, - PublisherPolicyComponent, - PublicationInformationComponent, - MetadataInformationComponent, - ThemedSubmissionSectionUploadFileComponent, -]; - -@NgModule({ - imports: [ - CommonModule, - StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig), - EffectsModule.forFeature(), - EffectsModule.forFeature(submissionEffects), - NgbModalModule, - NgbCollapseModule, - NgbAccordionModule, - UploadModule, - NgOptimizedImage, - ...DECLARATIONS, - ], - exports: [ - ...DECLARATIONS, - ], - providers: [ - SectionUploadService, - SectionsService, - SubmissionUploadsConfigDataService, - SubmissionAccessesConfigDataService, - SectionAccessesService, - SectionFormOperationsService, - CoarNotifyConfigDataService, - LdnServicesService, - ], -}) - -/** - * This module handles all components that are necessary for the submission process - */ -export class SubmissionModule { - /** - * NOTE: this method allows to resolve issue with components that using a custom decorator - * which are not loaded during SSR otherwise - */ - static withEntryComponents() { - return { - ngModule: SubmissionModule, - providers: ENTRY_COMPONENTS.map((component) => ({ provide: component })), - }; - } -} diff --git a/src/app/subscriptions-page/subscriptions-page.module.ts b/src/app/subscriptions-page/subscriptions-page.module.ts deleted file mode 100644 index 12187ad79e..0000000000 --- a/src/app/subscriptions-page/subscriptions-page.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; - -import { SubscriptionsModule } from '../shared/subscriptions/subscriptions.module'; -import { SubscriptionsPageComponent } from './subscriptions-page.component'; - -@NgModule({ - imports: [ - CommonModule, - SubscriptionsModule, - SubscriptionsPageComponent, - ], -}) -export class SubscriptionsPageModule { } diff --git a/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.spec.ts b/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.spec.ts index 32afa2cb4c..5804b469b8 100644 --- a/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.spec.ts +++ b/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.spec.ts @@ -23,7 +23,6 @@ import { NotificationsServiceStub } from '../../shared/testing/notifications-ser import { RouterStub } from '../../shared/testing/router.stub'; import { createPaginatedList } from '../../shared/testing/utils.test'; import { SystemWideAlert } from '../system-wide-alert.model'; -import { SystemWideAlertModule } from '../system-wide-alert.module'; import { SystemWideAlertFormComponent } from './system-wide-alert-form.component'; describe('SystemWideAlertFormComponent', () => { @@ -63,7 +62,7 @@ describe('SystemWideAlertFormComponent', () => { router = new RouterStub(); TestBed.configureTestingModule({ - imports: [FormsModule, SystemWideAlertModule, UiSwitchModule, TranslateModule.forRoot(), SystemWideAlertFormComponent], + imports: [FormsModule, UiSwitchModule, TranslateModule.forRoot(), SystemWideAlertFormComponent], providers: [ { provide: SystemWideAlertDataService, useValue: systemWideAlertDataService }, { provide: NotificationsService, useValue: notificationsService }, diff --git a/src/app/system-wide-alert/system-wide-alert.module.ts b/src/app/system-wide-alert/system-wide-alert.module.ts deleted file mode 100644 index d974a89d50..0000000000 --- a/src/app/system-wide-alert/system-wide-alert.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { - NgbDatepickerModule, - NgbTimepickerModule, -} from '@ng-bootstrap/ng-bootstrap'; -import { UiSwitchModule } from 'ngx-ui-switch'; - -import { SystemWideAlertDataService } from '../core/data/system-wide-alert-data.service'; -import { SystemWideAlertBannerComponent } from './alert-banner/system-wide-alert-banner.component'; -import { SystemWideAlertFormComponent } from './alert-form/system-wide-alert-form.component'; - -@NgModule({ - imports: [ - FormsModule, - UiSwitchModule, - NgbTimepickerModule, - NgbDatepickerModule, - SystemWideAlertBannerComponent, - SystemWideAlertFormComponent, - ], - exports: [ - SystemWideAlertBannerComponent, - ], - providers: [ - SystemWideAlertDataService, - ], -}) -export class SystemWideAlertModule { - -} diff --git a/src/modules/app/browser-app.module.ts b/src/modules/app/browser-app.module.ts index d35a6e1df2..cb8431beb8 100644 --- a/src/modules/app/browser-app.module.ts +++ b/src/modules/app/browser-app.module.ts @@ -50,12 +50,11 @@ import { HardRedirectService } from '../../app/core/services/hard-redirect.servi import { ReferrerService } from '../../app/core/services/referrer.service'; import { BrowserKlaroService } from '../../app/shared/cookies/browser-klaro.service'; import { KlaroService } from '../../app/shared/cookies/klaro.service'; +import { MissingTranslationHelper } from '../../app/shared/translate/missing-translation.helper'; import { GoogleAnalyticsService } from '../../app/statistics/google-analytics.service'; -import { StatisticsModule } from '../../app/statistics/statistics.module'; import { SubmissionService } from '../../app/submission/submission.service'; import { TranslateBrowserLoader } from '../../ngx-translate-loaders/translate-browser.loader'; import { BrowserInitService } from './browser-init.service'; -import { MissingTranslationHelper } from '../../app/shared/translate/missing-translation.helper'; export const REQ_KEY = makeStateKey('req'); @@ -76,7 +75,6 @@ export function getRequest(transferState: TransferState): any { HttpClientModule, // forRoot ensures the providers are only created once IdlePreloadModule.forRoot(), - StatisticsModule.forRoot(), Angulartics2RouterlessModule.forRoot(), BrowserAnimationsModule, StoreModule.forFeature('core', coreReducers, storeModuleConfig as StoreConfig), diff --git a/src/themes/custom/lazy-theme.module.ts b/src/themes/custom/lazy-theme.module.ts index 7d630d7821..18e90974a6 100644 --- a/src/themes/custom/lazy-theme.module.ts +++ b/src/themes/custom/lazy-theme.module.ts @@ -14,10 +14,6 @@ import { IdlePreloadModule } from 'angular-idle-preload'; import { AppModule } from '../../app/app.module'; import { RootModule } from '../../app/root.module'; -import { StatisticsModule } from '../../app/statistics/statistics.module'; -import { StatisticsPageModule } from '../../app/statistics-page/statistics-page.module'; -import { SubmissionModule } from '../../app/submission/submission.module'; -import { SystemWideAlertModule } from '../../app/system-wide-alert/system-wide-alert.module'; import { AdminSidebarComponent } from './app/admin/admin-sidebar/admin-sidebar.component'; import { EditBitstreamPageComponent } from './app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component'; import { BreadcrumbsComponent } from './app/breadcrumbs/breadcrumbs.component'; @@ -200,14 +196,10 @@ const DECLARATIONS = [ NgbModule, RouterModule, ScrollToModule, - StatisticsModule, - StatisticsPageModule, StoreModule, StoreRouterConnectingModule, TranslateModule, - SubmissionModule, FormsModule, - SystemWideAlertModule, NgxGalleryModule, ...DECLARATIONS, ], diff --git a/src/themes/dspace/lazy-theme.module.ts b/src/themes/dspace/lazy-theme.module.ts index 5cfc988000..c568fb7e09 100644 --- a/src/themes/dspace/lazy-theme.module.ts +++ b/src/themes/dspace/lazy-theme.module.ts @@ -13,9 +13,6 @@ import { IdlePreloadModule } from 'angular-idle-preload'; import { AppModule } from '../../app/app.module'; import { RootModule } from '../../app/root.module'; -import { StatisticsModule } from '../../app/statistics/statistics.module'; -import { StatisticsPageModule } from '../../app/statistics-page/statistics-page.module'; -import { SubmissionModule } from '../../app/submission/submission.module'; const DECLARATIONS = [ ]; @@ -32,12 +29,9 @@ const DECLARATIONS = [ NgbModule, RouterModule, ScrollToModule, - StatisticsModule, - StatisticsPageModule, StoreModule, StoreRouterConnectingModule, TranslateModule, - SubmissionModule, FormsModule, ], declarations: DECLARATIONS,