]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix save view error for filter_rules 616/head
authorMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sat, 2 Apr 2022 04:50:53 +0000 (21:50 -0700)
committerMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sun, 3 Apr 2022 02:49:58 +0000 (19:49 -0700)
see #601

src-ui/src/app/components/document-list/document-list.component.ts
src-ui/src/app/components/document-list/save-view-config-dialog/save-view-config-dialog.component.html

index fac5e353591031c24e05d38d2a9328d37fa522fe..9e058fb647b9b8f870e58dbe70e5bd2d3d74c94a 100644 (file)
@@ -243,8 +243,12 @@ export class DocumentListComponent implements OnInit, OnDestroy, AfterViewInit {
               $localize`View "${savedView.name}" created successfully.`
             )
           },
-          error: (error) => {
-            modal.componentInstance.error = error.error
+          error: (httpError) => {
+            let error = httpError.error
+            if (error.filter_rules) {
+              error.filter_rules = error.filter_rules.map((r) => r.value)
+            }
+            modal.componentInstance.error = error
             modal.componentInstance.buttonsEnabled = true
           },
         })
index d035885897875f75888a3557f94ec079af2a8204..ae20031a21d48edc5dc580a417cdc62aeec8b267 100644 (file)
@@ -8,6 +8,11 @@
     <app-input-text i18n-title title="Name" formControlName="name" [error]="error?.name"></app-input-text>
     <app-input-check i18n-title title="Show in sidebar" formControlName="showInSideBar"></app-input-check>
     <app-input-check i18n-title title="Show on dashboard" formControlName="showOnDashboard"></app-input-check>
+    <div *ngIf="error?.filter_rules" class="alert alert-danger" role="alert">
+      <h6 class="alert-heading" i18n>Filter rules error occurred while saving this view</h6>
+      <ng-container i18n>The error returned was</ng-container>:<br/>
+      {{ error.filter_rules }}
+    </div>
   </div>
   <div class="modal-footer">
     <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n [disabled]="!buttonsEnabled">Cancel</button>