Merge branch 'dev' into feature-autocolor

This commit is contained in:
jonaswinkler
2021-02-24 23:10:59 +01:00
378 changed files with 37340 additions and 5324 deletions

View File

@@ -16,38 +16,45 @@ export const FILTER_ADDED_AFTER = 14
export const FILTER_MODIFIED_BEFORE = 15
export const FILTER_MODIFIED_AFTER = 16
export const FILTER_DOES_NOT_HAVE_TAG = 17
export const FILTER_ASN_ISNULL = 18
export const FILTER_RULE_TYPES: FilterRuleType[] = [
{id: FILTER_TITLE, name: "Title contains", filtervar: "title__icontains", datatype: "string", multi: false},
{id: FILTER_CONTENT, name: "Content contains", filtervar: "content__icontains", datatype: "string", multi: false},
{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_TITLE, filtervar: "title__icontains", datatype: "string", multi: false, default: ""},
{id: FILTER_CONTENT, filtervar: "content__icontains", datatype: "string", multi: false, default: ""},
{id: FILTER_IS_IN_INBOX, name: "Is in Inbox", filtervar: "is_in_inbox", datatype: "boolean", multi: false},
{id: FILTER_HAS_TAG, name: "Has tag", filtervar: "tags__id__all", datatype: "tag", multi: true},
{id: FILTER_HAS_ANY_TAG, name: "Has any tag", filtervar: "is_tagged", datatype: "boolean", multi: false},
{id: FILTER_ASN, filtervar: "archive_serial_number", datatype: "number", multi: false},
{id: FILTER_CREATED_BEFORE, name: "Created before", filtervar: "created__date__lt", datatype: "date", multi: false},
{id: FILTER_CREATED_AFTER, name: "Created after", filtervar: "created__date__gt", datatype: "date", multi: false},
{id: FILTER_CORRESPONDENT, filtervar: "correspondent__id", isnull_filtervar: "correspondent__isnull", datatype: "correspondent", multi: false},
{id: FILTER_DOCUMENT_TYPE, filtervar: "document_type__id", isnull_filtervar: "document_type__isnull", datatype: "document_type", multi: false},
{id: FILTER_CREATED_YEAR, name: "Year created is", filtervar: "created__year", datatype: "number", multi: false},
{id: FILTER_CREATED_MONTH, name: "Month created is", filtervar: "created__month", datatype: "number", multi: false},
{id: FILTER_CREATED_DAY, name: "Day created is", filtervar: "created__day", datatype: "number", multi: false},
{id: FILTER_IS_IN_INBOX, filtervar: "is_in_inbox", datatype: "boolean", multi: false, default: true},
{id: FILTER_HAS_TAG, filtervar: "tags__id__all", datatype: "tag", multi: true},
{id: FILTER_DOES_NOT_HAVE_TAG, filtervar: "tags__id__none", datatype: "tag", multi: true},
{id: FILTER_HAS_ANY_TAG, filtervar: "is_tagged", datatype: "boolean", multi: false, default: true},
{id: FILTER_ADDED_BEFORE, name: "Added before", filtervar: "added__date__lt", datatype: "date", multi: false},
{id: FILTER_ADDED_AFTER, name: "Added after", filtervar: "added__date__gt", datatype: "date", multi: false},
{id: FILTER_MODIFIED_BEFORE, name: "Modified before", filtervar: "modified__date__lt", datatype: "date", multi: false},
{id: FILTER_MODIFIED_AFTER, name: "Modified after", filtervar: "modified__date__gt", datatype: "date", multi: false},
{id: FILTER_CREATED_BEFORE, filtervar: "created__date__lt", datatype: "date", multi: false},
{id: FILTER_CREATED_AFTER, filtervar: "created__date__gt", datatype: "date", multi: false},
{id: FILTER_CREATED_YEAR, filtervar: "created__year", datatype: "number", multi: false},
{id: FILTER_CREATED_MONTH, filtervar: "created__month", datatype: "number", multi: false},
{id: FILTER_CREATED_DAY, filtervar: "created__day", datatype: "number", multi: false},
{id: FILTER_ADDED_BEFORE, filtervar: "added__date__lt", datatype: "date", multi: false},
{id: FILTER_ADDED_AFTER, filtervar: "added__date__gt", datatype: "date", multi: false},
{id: FILTER_MODIFIED_BEFORE, filtervar: "modified__date__lt", datatype: "date", multi: false},
{id: FILTER_MODIFIED_AFTER, filtervar: "modified__date__gt", datatype: "date", multi: false},
{id: FILTER_ASN_ISNULL, filtervar: "archive_serial_number__isnull", datatype: "boolean", multi: false}
]
export interface FilterRuleType {
id: number
name: string
filtervar: string
isnull_filtervar?: string
datatype: string //number, string, boolean, date
multi: boolean
}
default?: any
}

View File

@@ -1,10 +1,8 @@
import { FilterRuleType } from './filter-rule-type';
export function cloneFilterRules(filterRules: FilterRule[]): FilterRule[] {
if (filterRules) {
let newRules: FilterRule[] = []
for (let rule of filterRules) {
newRules.push({type: rule.type, value: rule.value})
newRules.push({rule_type: rule.rule_type, value: rule.value})
}
return newRules
} else {
@@ -13,6 +11,6 @@ export function cloneFilterRules(filterRules: FilterRule[]): FilterRule[] {
}
export interface FilterRule {
type: FilterRuleType
value: any
rule_type: number
value: string
}

View File

@@ -9,12 +9,12 @@ export const MATCH_FUZZY = 5
export const MATCH_AUTO = 6
export const MATCHING_ALGORITHMS = [
{id: MATCH_ANY, name: "Any"},
{id: MATCH_ALL, name: "All"},
{id: MATCH_LITERAL, name: "Literal"},
{id: MATCH_REGEX, name: "Regular Expression"},
{id: MATCH_FUZZY, name: "Fuzzy Match"},
{id: MATCH_AUTO, name: "Auto"},
{id: MATCH_ANY, shortName: $localize`Any word`, name: $localize`Any: Document contains any of these words (space separated)`},
{id: MATCH_ALL, shortName: $localize`All words`, name: $localize`All: Document contains all of these words (space separated)`},
{id: MATCH_LITERAL, shortName: $localize`Exact match`, name: $localize`Exact: Document contains this string`},
{id: MATCH_REGEX, shortName: $localize`Regular expression`, name: $localize`Regular expression: Document matches this regular expression`},
{id: MATCH_FUZZY, shortName: $localize`Fuzzy word`, name: $localize`Fuzzy: Document contains a word similar to this word`},
{id: MATCH_AUTO, shortName: $localize`Automatic`, name: $localize`Auto: Learn matching automatically`},
]
export interface MatchingModel extends ObjectWithId {
@@ -29,4 +29,6 @@ export interface MatchingModel extends ObjectWithId {
is_insensitive?: boolean
document_count?: number
}

View File

@@ -1,8 +1,6 @@
import { MatchingModel } from './matching-model';
export interface PaperlessCorrespondent extends MatchingModel {
document_count?: number
last_correspondence?: Date

View File

@@ -1,11 +1,13 @@
export interface PaperlessDocumentMetadata {
paperless__checksum?: string
original_checksum?: string
paperless__mime_type?: string
archived_checksum?: string
paperless__filename?: string
original_mime_type?: string
paperless__has_archive_version?: boolean
media_filename?: string
has_archive_version?: boolean
}

View File

@@ -0,0 +1,9 @@
export interface PaperlessDocumentSuggestions {
tags?: number[]
correspondents?: number[]
document_types?: number[]
}

View File

@@ -2,6 +2,4 @@ import { MatchingModel } from './matching-model';
export interface PaperlessDocumentType extends MatchingModel {
document_count?: number
}

View File

@@ -2,16 +2,17 @@ import { PaperlessCorrespondent } from './paperless-correspondent'
import { ObjectWithId } from './object-with-id'
import { PaperlessTag } from './paperless-tag'
import { PaperlessDocumentType } from './paperless-document-type'
import { Observable } from 'rxjs'
export interface PaperlessDocument extends ObjectWithId {
correspondent?: PaperlessCorrespondent
correspondent$?: Observable<PaperlessCorrespondent>
correspondent_id?: number
correspondent?: number
document_type?: PaperlessDocumentType
document_type$?: Observable<PaperlessDocumentType>
document_type_id?: number
document_type?: number
title?: string
@@ -19,9 +20,9 @@ export interface PaperlessDocument extends ObjectWithId {
file_type?: string
tags?: PaperlessTag[]
tags$?: Observable<PaperlessTag[]>
tags_id?: number[]
tags?: number[]
checksum?: string

View File

@@ -1,27 +0,0 @@
export const LOG_LEVEL_DEBUG = 10
export const LOG_LEVEL_INFO = 20
export const LOG_LEVEL_WARNING = 30
export const LOG_LEVEL_ERROR = 40
export const LOG_LEVEL_CRITICAL = 50
export const LOG_LEVELS = [
{id: LOG_LEVEL_DEBUG, name: "DEBUG"},
{id: LOG_LEVEL_INFO, name: "INFO"},
{id: LOG_LEVEL_WARNING, name: "WARNING"},
{id: LOG_LEVEL_ERROR, name: "ERROR"},
{id: LOG_LEVEL_CRITICAL, name: "CRITICAL"}
]
export interface PaperlessLog {
id?: number
group?: string
message?: string
created?: Date
level?: number
}

View File

@@ -0,0 +1,18 @@
import { FilterRule } from './filter-rule';
import { ObjectWithId } from './object-with-id';
export interface PaperlessSavedView extends ObjectWithId {
name?: string
show_on_dashboard?: boolean
show_in_sidebar?: boolean
sort_field: string
sort_reverse: boolean
filter_rules: FilterRule[]
}

View File

@@ -4,19 +4,19 @@ import { ObjectWithId } from './object-with-id';
export const TAG_COLOURS = [
{ id: "", name: "Auto", textColor: "#000000" },
{ id: "#a6cee3", name: "Light Blue", textColor: "#000000" },
{ id: "#1f78b4", name: "Blue", textColor: "#ffffff" },
{ id: "#b2df8a", name: "Light Green", textColor: "#000000" },
{ id: "#33a02c", name: "Green", textColor: "#000000" },
{ id: "#fb9a99", name: "Light Red", textColor: "#000000" },
{ id: "#e31a1c", name: "Red ", textColor: "#ffffff" },
{ id: "#fdbf6f", name: "Light Orange", textColor: "#000000" },
{ id: "#ff7f00", name: "Orange", textColor: "#000000" },
{ id: "#cab2d6", name: "Light Violet", textColor: "#000000" },
{ id: "#6a3d9a", name: "Violet", textColor: "#ffffff" },
{ id: "#b15928", name: "Brown", textColor: "#000000" },
{ id: "#000000", name: "Black", textColor: "#ffffff" },
{ id: "#cccccc", name: "Light Grey", textColor: "#000000" }
{ id: "#a6cee3", name: $localize`Light blue`, textColor: "#000000" },
{ id: "#1f78b4", name: $localize`Blue`, textColor: "#ffffff" },
{ id: "#b2df8a", name: $localize`Light green`, textColor: "#000000" },
{ id: "#33a02c", name: $localize`Green`, textColor: "#ffffff" },
{ id: "#fb9a99", name: $localize`Light red`, textColor: "#000000" },
{ id: "#e31a1c", name: $localize`Red `, textColor: "#ffffff" },
{ id: "#fdbf6f", name: $localize`Light orange`, textColor: "#000000" },
{ id: "#ff7f00", name: $localize`Orange`, textColor: "#000000" },
{ id: "#cab2d6", name: $localize`Light violet`, textColor: "#000000" },
{ id: "#6a3d9a", name: $localize`Violet`, textColor: "#ffffff" },
{ id: "#b15928", name: $localize`Brown`, textColor: "#ffffff" },
{ id: "#000000", name: $localize`Black`, textColor: "#ffffff" },
{ id: "#cccccc", name: $localize`Light grey`, textColor: "#000000" }
]
export interface PaperlessTag extends MatchingModel {
@@ -25,5 +25,4 @@ export interface PaperlessTag extends MatchingModel {
is_inbox_tag?: boolean
document_count?: number
}

View File

@@ -1,19 +0,0 @@
import { FilterRule } from './filter-rule';
export interface SavedViewConfig {
id?: string
filterRules: FilterRule[]
sortField: string
sortDirection: string
title?: string
showInSideBar?: boolean
showInDashboard?: boolean
}

View File

@@ -5,8 +5,3 @@ export const OPEN_DOCUMENT_SERVICE = {
export const DOCUMENT_LIST_SERVICE = {
CURRENT_VIEW_CONFIG: 'document-list-service:currentViewConfig'
}
export const GENERAL_SETTINGS = {
DOCUMENT_LIST_SIZE: 'general-settings:documentListSize',
DOCUMENT_LIST_SIZE_DEFAULT: 50
}

View File

@@ -0,0 +1,11 @@
export interface WebsocketConsumerStatusMessage {
filename?: string
task_id?: string
current_progress?: number
max_progress?: number
status?: string
message?: string
document_id: number
}