]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: fix improved close behavior with production minified javascript
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sun, 9 Mar 2025 03:17:08 +0000 (19:17 -0800)
committershamoon <4887959+shamoon@users.noreply.github.com>
Sun, 9 Mar 2025 03:17:08 +0000 (19:17 -0800)
src-ui/src/app/app-routing.module.ts
src-ui/src/app/services/component-router.service.spec.ts
src-ui/src/app/services/component-router.service.ts

index cdd225497d29a0b0e0634c0386e0fbc15bfb9bf8..f65514f74450219bd83b2bcfd9e7b21bf0625234 100644 (file)
@@ -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',
         },
       },
     ],
index b11fc81977b7ff9d42a1d33cc0b018de199c7fb0..760493a331b962e8e988b47cde8d7b89c5c26673 100644 (file)
@@ -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)
     )
 
index 0589ef61f72889c098a89f04845151e71d2c389a..d520c36f29a3c5e188a2c55fdcf2c787bd111ab0 100644 (file)
@@ -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()