diff --git a/src-ui/src/app/app-routing.module.ts b/src-ui/src/app/app-routing.module.ts index cdd225497..f65514f74 100644 --- a/src-ui/src/app/app-routing.module.ts +++ b/src-ui/src/app/app-routing.module.ts @@ -36,7 +36,13 @@ export const routes: Routes = [ component: AppFrameComponent, canDeactivate: [DirtyDocGuard], children: [ - { path: 'dashboard', component: DashboardComponent }, + { + path: 'dashboard', + component: DashboardComponent, + data: { + componentName: 'AppFrameComponent', + }, + }, { path: 'documents', component: DocumentListComponent, @@ -47,6 +53,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Document, }, + componentName: 'DocumentListComponent', }, }, { @@ -59,6 +66,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.SavedView, }, + componentName: 'DocumentListComponent', }, }, { @@ -70,6 +78,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Document, }, + componentName: 'DocumentDetailComponent', }, }, { @@ -81,6 +90,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Document, }, + componentName: 'DocumentDetailComponent', }, }, { @@ -92,6 +102,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Document, }, + componentName: 'DocumentAsnComponent', }, }, { @@ -103,6 +114,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Tag, }, + componentName: 'TagListComponent', }, }, { @@ -114,6 +126,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.DocumentType, }, + componentName: 'DocumentTypeListComponent', }, }, { @@ -125,6 +138,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Correspondent, }, + componentName: 'CorrespondentListComponent', }, }, { @@ -136,6 +150,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.StoragePath, }, + componentName: 'StoragePathListComponent', }, }, { @@ -144,6 +159,7 @@ export const routes: Routes = [ canActivate: [PermissionsGuard], data: { requireAdmin: true, + componentName: 'LogsComponent', }, }, { @@ -155,6 +171,7 @@ export const routes: Routes = [ action: PermissionAction.Delete, type: PermissionType.Document, }, + componentName: 'TrashComponent', }, }, // redirect old paths @@ -180,6 +197,7 @@ export const routes: Routes = [ action: PermissionAction.Change, type: PermissionType.UISettings, }, + componentName: 'SettingsComponent', }, }, { @@ -192,6 +210,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.UISettings, }, + componentName: 'SettingsComponent', }, }, { @@ -203,6 +222,7 @@ export const routes: Routes = [ action: PermissionAction.Change, type: PermissionType.AppConfig, }, + componentName: 'ConfigComponent', }, }, { @@ -214,6 +234,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.PaperlessTask, }, + componentName: 'TasksComponent', }, }, { @@ -225,6 +246,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.CustomField, }, + componentName: 'CustomFieldsComponent', }, }, { @@ -236,6 +258,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.Workflow, }, + componentName: 'WorkflowsComponent', }, }, { @@ -247,6 +270,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.MailAccount, }, + componentName: 'MailComponent', }, }, { @@ -258,6 +282,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.User, }, + componentName: 'UsersAndGroupsComponent', }, }, { @@ -269,6 +294,7 @@ export const routes: Routes = [ action: PermissionAction.View, type: PermissionType.SavedView, }, + componentName: 'SavedViewsComponent', }, }, ], diff --git a/src-ui/src/app/services/component-router.service.spec.ts b/src-ui/src/app/services/component-router.service.spec.ts index b11fc8197..760493a33 100644 --- a/src-ui/src/app/services/component-router.service.spec.ts +++ b/src-ui/src/app/services/component-router.service.spec.ts @@ -29,7 +29,7 @@ describe('ComponentRouterService', () => { eventsSubject.next( new ActivationStart({ url: 'test-url', - component: { name: 'TestComponent' }, + data: { componentName: 'TestComponent' }, } as any) ) @@ -41,13 +41,13 @@ describe('ComponentRouterService', () => { eventsSubject.next( new ActivationStart({ url: 'test-url-1', - component: { name: 'TestComponent' }, + data: { componentName: 'TestComponent' }, } as any) ) eventsSubject.next( new ActivationStart({ url: 'test-url-2', - component: { name: 'TestComponent' }, + data: { componentName: 'TestComponent' }, } as any) ) @@ -59,13 +59,13 @@ describe('ComponentRouterService', () => { eventsSubject.next( new ActivationStart({ url: 'test-url-1', - component: { name: 'TestComponent1' }, + data: { componentName: 'TestComponent1' }, } as any) ) eventsSubject.next( new ActivationStart({ url: 'test-url-2', - component: { name: 'TestComponent2' }, + data: { componentName: 'TestComponent2' }, } as any) ) @@ -76,13 +76,13 @@ describe('ComponentRouterService', () => { eventsSubject.next( new ActivationStart({ url: 'test-url-1', - component: { name: 'TestComponent' }, + data: { componentName: 'TestComponent' }, } as any) ) eventsSubject.next( new ActivationStart({ url: 'test-url-2', - component: { name: 'TestComponent' }, + data: { componentName: 'TestComponent' }, } as any) ) @@ -93,7 +93,7 @@ describe('ComponentRouterService', () => { eventsSubject.next( new ActivationStart({ url: 'test-url', - component: { name: 'TestComponent' }, + data: { componentName: 'TestComponent' }, } as any) ) diff --git a/src-ui/src/app/services/component-router.service.ts b/src-ui/src/app/services/component-router.service.ts index 0589ef61f..d520c36f2 100644 --- a/src-ui/src/app/services/component-router.service.ts +++ b/src-ui/src/app/services/component-router.service.ts @@ -17,11 +17,11 @@ export class ComponentRouterService { .subscribe((event: ActivationStart) => { if ( this.componentHistory[this.componentHistory.length - 1] !== - event.snapshot.component.name && - !EXCLUDE_COMPONENTS.includes(event.snapshot.component.name) + event.snapshot.data.componentName && + !EXCLUDE_COMPONENTS.includes(event.snapshot.data.componentName) ) { this.history.push(event.snapshot.url.toString()) - this.componentHistory.push(event.snapshot.component.name) + this.componentHistory.push(event.snapshot.data.componentName) } else { // Update the URL of the current component in case the same component was loaded via a different URL this.history[this.history.length - 1] = event.snapshot.url.toString()