A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
refactor constant
Jonas Winkler2d974bc02640
diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.tsindex 21537d224..0f18a8a65 100644--- a/src-ui/src/app/components/document-list/document-list.component.ts+++ b/src-ui/src/app/components/document-list/document-list.component.ts@@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';import { NgbModal } from '@ng-bootstrap/ng-bootstrap';import { cloneFilterRules, FilterRule } from 'src/app/data/filter-rule';import { SavedViewConfig } from 'src/app/data/saved-view-config';-import { DocumentListViewService } from 'src/app/services/document-list-view.service';+import { DocumentListViewService, SORT_FIELDS } from 'src/app/services/document-list-view.service';import { SavedViewConfigService } from 'src/app/services/saved-view-config.service';import { SaveViewConfigDialogComponent } from './save-view-config-dialog/save-view-config-dialog.component';@@ -26,7 +26,7 @@ export class DocumentListComponent implements OnInit {showFilter = falsegetSortFields() {- return DocumentListViewService.SORT_FIELDS+ return SORT_FIELDS}setSort(field: string) {diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.tsindex 323a0a38e..91ac52d13 100644--- a/src-ui/src/app/services/document-list-view.service.ts+++ b/src-ui/src/app/services/document-list-view.service.ts@@ -5,6 +5,15 @@ import { PaperlessDocument } from '../data/paperless-document';import { SavedViewConfig } from '../data/saved-view-config';import { DocumentService } from './rest/document.service';+export const SORT_FIELDS = [+ {field: "correspondent__name", name: "Correspondent"},+ {field: 'title', name: 'Title'},+ {field: 'archive_serial_number', name: 'ASN'},+ {field: 'created', name: 'Created'},+ {field: 'added', name: 'Added'},+ {field: 'modified', name: 'Modified'}+]+@Injectable({providedIn: 'root'})@@ -12,15 +21,6 @@ export class DocumentListViewService {static DEFAULT_SORT_FIELD = 'created'- static SORT_FIELDS = [- {field: "correspondent__name", name: "Correspondent"},- {field: 'title', name: 'Title'},- {field: 'archive_serial_number', name: 'ASN'},- {field: 'created', name: 'Created'},- {field: 'added', name: 'Added'},- {field: 'modified', name: 'Modified'}- ]-documents: PaperlessDocument[] = []currentPage = 1collectionSize: number@@ -63,14 +63,13 @@ export class DocumentListViewService {}getOrderingQueryParam(sortField: string, sortDirection: string) {- if (DocumentListViewService.SORT_FIELDS.find(f => f.field == sortField)) {+ if (SORT_FIELDS.find(f => f.field == sortField)) {return (sortDirection == 'des' ? '-' : '') + sortField} else {return DocumentListViewService.DEFAULT_SORT_FIELD}}- //TODO: refactorsetFilterRules(filterRules: FilterRule[]) {this.currentFilterRules = cloneFilterRules(filterRules)}