From 14a2ad2b0d12d18bad7db144cf8f94ee9ea65ef4 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com> Date: Wed, 6 Jan 2021 07:53:48 -0800 Subject: [PATCH] Change detection of modified filter rules to wait for filter editor changes only --- .../document-list/document-list.component.html | 2 +- .../document-list/document-list.component.ts | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.html index 90893baee..c391591b1 100644 --- a/src-ui/src/app/components/document-list/document-list.component.html +++ b/src-ui/src/app/components/document-list/document-list.component.html @@ -78,7 +78,7 @@
- +
diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.ts index a79c497fe..a9bdb4a83 100644 --- a/src-ui/src/app/components/document-list/document-list.component.ts +++ b/src-ui/src/app/components/document-list/document-list.component.ts @@ -66,9 +66,12 @@ export class DocumentListComponent implements OnInit { this.list.reload() }) + + this.rulesChanged() } loadViewConfig(view: PaperlessSavedView) { + this.filterRulesModified = false this.list.load(view) this.list.reload() } @@ -105,6 +108,7 @@ export class DocumentListComponent implements OnInit { } resetFilters(): void { + this.filterRulesModified = false; if (this.list.savedViewId) { this.savedViewService.getCached(this.list.savedViewId).subscribe(viewUntouched => { this.list.filterRules = viewUntouched.filter_rules @@ -116,12 +120,14 @@ export class DocumentListComponent implements OnInit { } } - get filterRulesModified(): boolean { + filterRulesModified: boolean = false + + rulesChanged() { + let modified = false if (this.list.savedView == null) { - return this.list.filterRules.length > 0 // documents list is modified if it has any filters + modified = this.list.filterRules.length > 0 // documents list is modified if it has any filters } else { // compare savedView current filters vs original - let modified = false this.savedViewService.getCached(this.list.savedViewId).subscribe(view => { let filterRulesInitial = view.filter_rules @@ -135,8 +141,8 @@ export class DocumentListComponent implements OnInit { }) } }) - return modified } + this.filterRulesModified = modified } clickTag(tagID: number) {