From b9cf517cd139f4cf8f3194cb60e9384718c57c5e Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Fri, 25 Dec 2020 19:06:12 +0100 Subject: [PATCH] front end client support for filtering for no correspondent/document type --- src-ui/src/app/data/filter-rule-type.ts | 5 +++-- src-ui/src/app/services/rest/document.service.ts | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src-ui/src/app/data/filter-rule-type.ts b/src-ui/src/app/data/filter-rule-type.ts index ea8e60eee..173425c92 100644 --- a/src-ui/src/app/data/filter-rule-type.ts +++ b/src-ui/src/app/data/filter-rule-type.ts @@ -25,8 +25,8 @@ export const FILTER_RULE_TYPES: FilterRuleType[] = [ {id: FILTER_ASN, name: "ASN is", filtervar: "archive_serial_number", datatype: "number", multi: false}, - {id: FILTER_CORRESPONDENT, name: "Correspondent is", filtervar: "correspondent__id", datatype: "correspondent", multi: false}, - {id: FILTER_DOCUMENT_TYPE, name: "Document type is", filtervar: "document_type__id", datatype: "document_type", multi: false}, + {id: FILTER_CORRESPONDENT, name: "Correspondent is", filtervar: "correspondent__id", isnull_filtervar: "correspondent__isnull", datatype: "correspondent", multi: false}, + {id: FILTER_DOCUMENT_TYPE, name: "Document type is", filtervar: "document_type__id", isnull_filtervar: "document_type__isnull", datatype: "document_type", multi: false}, {id: FILTER_IS_IN_INBOX, name: "Is in Inbox", filtervar: "is_in_inbox", datatype: "boolean", multi: false, default: true}, {id: FILTER_HAS_TAG, name: "Has tag", filtervar: "tags__id__all", datatype: "tag", multi: true}, @@ -51,6 +51,7 @@ export interface FilterRuleType { id: number name: string filtervar: string + isnull_filtervar?: string datatype: string //number, string, boolean, date multi: boolean default?: any diff --git a/src-ui/src/app/services/rest/document.service.ts b/src-ui/src/app/services/rest/document.service.ts index ec5c7689b..ff17e972e 100644 --- a/src-ui/src/app/services/rest/document.service.ts +++ b/src-ui/src/app/services/rest/document.service.ts @@ -38,6 +38,8 @@ export class DocumentService extends AbstractPaperlessService let ruleType = FILTER_RULE_TYPES.find(t => t.id == rule.rule_type) if (ruleType.multi) { params[ruleType.filtervar] = params[ruleType.filtervar] ? params[ruleType.filtervar] + "," + rule.value : rule.value + } else if (ruleType.isnull_filtervar && rule.value == null) { + params[ruleType.isnull_filtervar] = true } else { params[ruleType.filtervar] = rule.value }