From 6535a20b21714cd8db84a5f460e5e6665559c796 Mon Sep 17 00:00:00 2001 From: darmiel <71837281+darmiel@users.noreply.github.com> Date: Mon, 8 Mar 2021 17:11:25 +0100 Subject: [PATCH] Implemented 'Filter by: ASN' --- .../filter-editor/filter-editor.component.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts index 3ac9df1ff..43387c08f 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts @@ -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 {