Feature: customizable fields display for documents, saved views & dashboard widgets (#6439)

This commit is contained in:
shamoon
2024-04-26 06:41:12 -07:00
committed by GitHub
parent 7a0334f353
commit bd4476d484
50 changed files with 2929 additions and 1018 deletions

View File

@@ -7,6 +7,102 @@ import { ObjectWithPermissions } from './object-with-permissions'
import { DocumentNote } from './document-note'
import { CustomFieldInstance } from './custom-field-instance'
export enum DisplayMode {
TABLE = 'table',
SMALL_CARDS = 'smallCards',
LARGE_CARDS = 'largeCards',
}
export enum DisplayField {
TITLE = 'title',
CREATED = 'created',
ADDED = 'added',
TAGS = 'tag',
CORRESPONDENT = 'correspondent',
DOCUMENT_TYPE = 'documenttype',
STORAGE_PATH = 'storagepath',
CUSTOM_FIELD = 'custom_field_',
NOTES = 'note',
OWNER = 'owner',
SHARED = 'shared',
ASN = 'asn',
}
export const DEFAULT_DISPLAY_FIELDS = [
{
id: DisplayField.TITLE,
name: $localize`Title`,
},
{
id: DisplayField.CREATED,
name: $localize`Created`,
},
{
id: DisplayField.ADDED,
name: $localize`Added`,
},
{
id: DisplayField.TAGS,
name: $localize`Tags`,
},
{
id: DisplayField.CORRESPONDENT,
name: $localize`Correspondent`,
},
{
id: DisplayField.DOCUMENT_TYPE,
name: $localize`Document type`,
},
{
id: DisplayField.STORAGE_PATH,
name: $localize`Storage path`,
},
{
id: DisplayField.NOTES,
name: $localize`Notes`,
},
{
id: DisplayField.OWNER,
name: $localize`Owner`,
},
{
id: DisplayField.SHARED,
name: $localize`Shared`,
},
{
id: DisplayField.ASN,
name: $localize`ASN`,
},
]
export const DEFAULT_DASHBOARD_VIEW_PAGE_SIZE = 10
export const DEFAULT_DASHBOARD_DISPLAY_FIELDS = [
DisplayField.CREATED,
DisplayField.TITLE,
DisplayField.TAGS,
DisplayField.CORRESPONDENT,
]
export const DOCUMENT_SORT_FIELDS = [
{ field: 'archive_serial_number', name: $localize`ASN` },
{ field: 'correspondent__name', name: $localize`Correspondent` },
{ field: 'title', name: $localize`Title` },
{ field: 'document_type__name', name: $localize`Document type` },
{ field: 'created', name: $localize`Created` },
{ field: 'added', name: $localize`Added` },
{ field: 'modified', name: $localize`Modified` },
{ field: 'num_notes', name: $localize`Notes` },
{ field: 'owner', name: $localize`Owner` },
]
export const DOCUMENT_SORT_FIELDS_FULLTEXT = [
{
field: 'score',
name: $localize`:Score is a value returned by the full text search engine and specifies how well a result matches the given query:Search score`,
},
]
export interface SearchHit {
score?: number
rank?: number

View File

@@ -1,3 +1,4 @@
import { DisplayMode, DisplayField } from './document'
import { FilterRule } from './filter-rule'
import { ObjectWithPermissions } from './object-with-permissions'
@@ -13,4 +14,10 @@ export interface SavedView extends ObjectWithPermissions {
sort_reverse: boolean
filter_rules: FilterRule[]
page_size?: number
display_mode?: DisplayMode
display_fields?: DisplayField[]
}