mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge pull request #726 from darmiel/feature/664-filter-by-asn
Implemented 'Filter by: ASN'
This commit is contained in:
		| @@ -8,12 +8,13 @@ import { DocumentTypeService } from 'src/app/services/rest/document-type.service | ||||
| import { TagService } from 'src/app/services/rest/tag.service'; | ||||
| import { CorrespondentService } from 'src/app/services/rest/correspondent.service'; | ||||
| import { FilterRule } from 'src/app/data/filter-rule'; | ||||
| import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE, FILTER_TITLE_CONTENT } from 'src/app/data/filter-rule-type'; | ||||
| import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_ASN, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE, FILTER_TITLE_CONTENT } from 'src/app/data/filter-rule-type'; | ||||
| import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component'; | ||||
| import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component'; | ||||
|  | ||||
| const TEXT_FILTER_TARGET_TITLE = "title" | ||||
| const TEXT_FILTER_TARGET_TITLE_CONTENT = "title-content" | ||||
| const TEXT_FILTER_TARGET_ASN = "asn" | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-filter-editor', | ||||
| @@ -51,6 +52,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|  | ||||
|         case FILTER_TITLE: | ||||
|           return $localize`Title: ${rule.value}` | ||||
|  | ||||
|         case FILTER_ASN: | ||||
|           return $localize`ASN: ${rule.value}` | ||||
|       } | ||||
|     } | ||||
|  | ||||
| @@ -71,7 +75,8 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|  | ||||
|   textFilterTargets = [ | ||||
|     {id: TEXT_FILTER_TARGET_TITLE, name: $localize`Title`}, | ||||
|     {id: TEXT_FILTER_TARGET_TITLE_CONTENT, name: $localize`Title & content`} | ||||
|     {id: TEXT_FILTER_TARGET_TITLE_CONTENT, name: $localize`Title & content`}, | ||||
|     {id: TEXT_FILTER_TARGET_ASN, name: $localize`ASN`} | ||||
|   ] | ||||
|  | ||||
|   textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT | ||||
| @@ -111,6 +116,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|           this._textFilter = rule.value | ||||
|           this.textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT | ||||
|           break | ||||
|         case FILTER_ASN: | ||||
|           this._textFilter = rule.value | ||||
|           this.textFilterTarget = TEXT_FILTER_TARGET_ASN | ||||
|           break | ||||
|         case FILTER_CREATED_AFTER: | ||||
|           this.dateCreatedAfter = rule.value | ||||
|           break | ||||
| @@ -147,6 +156,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|     if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) { | ||||
|       filterRules.push({rule_type: FILTER_TITLE, value: this._textFilter}) | ||||
|     } | ||||
|     if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_ASN) { | ||||
|       filterRules.push({rule_type: FILTER_ASN, value: this._textFilter}) | ||||
|     } | ||||
|     if (this.tagSelectionModel.isNoneSelected()) { | ||||
|       filterRules.push({rule_type: FILTER_HAS_ANY_TAG, value: "false"}) | ||||
|     } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jonas Winkler
					Jonas Winkler