diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf
index d71bdbc2e..1e89a9408 100644
--- a/src-ui/messages.xlf
+++ b/src-ui/messages.xlf
@@ -394,53 +394,60 @@
2
+
+ Filter by:
+
+ src/app/components/manage/tag-list/tag-list.component.html
+ 8
+
+
Name
src/app/components/manage/tag-list/tag-list.component.html
- 13
+ 9
Color
src/app/components/manage/tag-list/tag-list.component.html
- 14
+ 20
Matching
src/app/components/manage/tag-list/tag-list.component.html
- 15
+ 21
Document count
src/app/components/manage/tag-list/tag-list.component.html
- 16
+ 22
Actions
src/app/components/manage/tag-list/tag-list.component.html
- 17
+ 23
Documents
src/app/components/manage/tag-list/tag-list.component.html
- 32
+ 38
Edit
src/app/components/manage/tag-list/tag-list.component.html
- 37
+ 43
@@ -713,7 +720,7 @@
Last correspondence
src/app/components/manage/correspondent-list/correspondent-list.component.html
- 15
+ 22
@@ -976,13 +983,6 @@
46
-
- Filter by:
-
- src/app/components/document-list/filter-editor/filter-editor.component.html
- 4
-
-
Filter tags
@@ -1670,35 +1670,35 @@
Automatic
src/app/components/manage/generic-list/generic-list.component.ts
- 33
+ 39
Do you really want to delete this element?
src/app/components/manage/generic-list/generic-list.component.ts
- 76
+ 97
Associated documents will not be deleted.
src/app/components/manage/generic-list/generic-list.component.ts
- 83
+ 104
Delete
src/app/components/manage/generic-list/generic-list.component.ts
- 85
+ 106
Error while deleting element:
src/app/components/manage/generic-list/generic-list.component.ts
- 93
+ 114
diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html
index ffe260d73..4cbafb817 100644
--- a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html
+++ b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html
@@ -2,8 +2,15 @@
-
-
+
diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html
index dd6e86592..613cc4fd4 100644
--- a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html
+++ b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html
@@ -2,9 +2,15 @@
-
-
+
diff --git a/src-ui/src/app/components/manage/generic-list/generic-list.component.ts b/src-ui/src/app/components/manage/generic-list/generic-list.component.ts
index e1d5226f3..7c5dbc8e3 100644
--- a/src-ui/src/app/components/manage/generic-list/generic-list.component.ts
+++ b/src-ui/src/app/components/manage/generic-list/generic-list.component.ts
@@ -1,17 +1,19 @@
-import { Directive, OnInit, QueryList, ViewChildren } from '@angular/core';
+import { Directive, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { Subject, Subscription } from 'rxjs';
+import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { MatchingModel, MATCHING_ALGORITHMS, MATCH_AUTO } from 'src/app/data/matching-model';
import { ObjectWithId } from 'src/app/data/object-with-id';
import { SortableDirective, SortEvent } from 'src/app/directives/sortable.directive';
-import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service';
+import { AbstractNameFilterService } from 'src/app/services/rest/abstract-name-filter-service';
import { ToastService } from 'src/app/services/toast.service';
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component';
@Directive()
-export abstract class GenericListComponent implements OnInit {
+export abstract class GenericListComponent implements OnInit, OnDestroy {
constructor(
- private service: AbstractPaperlessService,
+ private service: AbstractNameFilterService,
private modalService: NgbModal,
private editDialogComponent: any,
private toastService: ToastService) {
@@ -28,6 +30,10 @@ export abstract class GenericListComponent implements On
public sortField: string
public sortReverse: boolean
+ private nameFilterDebounce: Subject
+ private subscription: Subscription
+ private _nameFilter: string
+
getMatching(o: MatchingModel) {
if (o.matching_algorithm == MATCH_AUTO) {
return $localize`Automatic`
@@ -44,12 +50,27 @@ export abstract class GenericListComponent implements On
this.reloadData()
}
+
ngOnInit(): void {
this.reloadData()
+
+ this.nameFilterDebounce = new Subject()
+
+ this.subscription = this.nameFilterDebounce.pipe(
+ debounceTime(400),
+ distinctUntilChanged()
+ ).subscribe(title => {
+ this._nameFilter = title
+ this.reloadData()
+ })
+ }
+
+ ngOnDestroy() {
+ this.subscription.unsubscribe()
}
reloadData() {
- this.service.list(this.page, null, this.sortField, this.sortReverse).subscribe(c => {
+ this.service.listFiltered(this.page, null, this.sortField, this.sortReverse, this._nameFilter).subscribe(c => {
this.data = c.results
this.collectionSize = c.count
});
@@ -95,4 +116,12 @@ export abstract class GenericListComponent implements On
}
)
}
+
+ get nameFilter() {
+ return this._nameFilter
+ }
+
+ set nameFilter(nameFilter: string) {
+ this.nameFilterDebounce.next(nameFilter)
+ }
}
diff --git a/src-ui/src/app/components/manage/tag-list/tag-list.component.html b/src-ui/src/app/components/manage/tag-list/tag-list.component.html
index 4af22b3cd..036beccbc 100644
--- a/src-ui/src/app/components/manage/tag-list/tag-list.component.html
+++ b/src-ui/src/app/components/manage/tag-list/tag-list.component.html
@@ -2,9 +2,15 @@
-
-
+
diff --git a/src-ui/src/app/services/rest/abstract-name-filter-service.ts b/src-ui/src/app/services/rest/abstract-name-filter-service.ts
new file mode 100644
index 000000000..d605fef49
--- /dev/null
+++ b/src-ui/src/app/services/rest/abstract-name-filter-service.ts
@@ -0,0 +1,14 @@
+import { ObjectWithId } from 'src/app/data/object-with-id'
+import { AbstractPaperlessService } from './abstract-paperless-service'
+
+export abstract class AbstractNameFilterService extends AbstractPaperlessService {
+
+ listFiltered(page?: number, pageSize?: number, sortField?: string, sortReverse?: boolean, nameFilter?: string) {
+ let params = {}
+ if (nameFilter) {
+ params = {'name__icontains': nameFilter}
+ }
+ return this.list(page, pageSize, sortField, sortReverse, params)
+ }
+
+}
diff --git a/src-ui/src/app/services/rest/correspondent.service.ts b/src-ui/src/app/services/rest/correspondent.service.ts
index a609b7dd8..7eac24971 100644
--- a/src-ui/src/app/services/rest/correspondent.service.ts
+++ b/src-ui/src/app/services/rest/correspondent.service.ts
@@ -1,12 +1,12 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent';
-import { AbstractPaperlessService } from './abstract-paperless-service';
+import { AbstractNameFilterService } from './abstract-name-filter-service';
@Injectable({
providedIn: 'root'
})
-export class CorrespondentService extends AbstractPaperlessService {
+export class CorrespondentService extends AbstractNameFilterService {
constructor(http: HttpClient) {
super(http, 'correspondents')
diff --git a/src-ui/src/app/services/rest/document-type.service.ts b/src-ui/src/app/services/rest/document-type.service.ts
index a3ba0d858..4f5b7d0ce 100644
--- a/src-ui/src/app/services/rest/document-type.service.ts
+++ b/src-ui/src/app/services/rest/document-type.service.ts
@@ -1,12 +1,12 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type';
-import { AbstractPaperlessService } from './abstract-paperless-service';
+import { AbstractNameFilterService } from './abstract-name-filter-service';
@Injectable({
providedIn: 'root'
})
-export class DocumentTypeService extends AbstractPaperlessService {
+export class DocumentTypeService extends AbstractNameFilterService {
constructor(http: HttpClient) {
super(http, 'document_types')
diff --git a/src-ui/src/app/services/rest/tag.service.ts b/src-ui/src/app/services/rest/tag.service.ts
index b4151dbb9..7bc55b0c9 100644
--- a/src-ui/src/app/services/rest/tag.service.ts
+++ b/src-ui/src/app/services/rest/tag.service.ts
@@ -1,12 +1,12 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { PaperlessTag } from 'src/app/data/paperless-tag';
-import { AbstractPaperlessService } from './abstract-paperless-service';
+import { AbstractNameFilterService } from './abstract-name-filter-service';
@Injectable({
providedIn: 'root'
})
-export class TagService extends AbstractPaperlessService {
+export class TagService extends AbstractNameFilterService {
constructor(http: HttpClient) {
super(http, 'tags')