A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
adjustable page size fixes #8
Jonas Winklered5a4a2d3e91
diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.htmlindex b66cfbfa0..1455cabbc 100644--- a/src-ui/src/app/components/document-list/document-list.component.html+++ b/src-ui/src/app/components/document-list/document-list.component.html@@ -73,7 +73,7 @@</div></div>-<ngb-pagination [pageSize]="25" [collectionSize]="docs.collectionSize" [(page)]="docs.currentPage" [maxSize]="5"+<ngb-pagination [pageSize]="docs.currentPageSize" [collectionSize]="docs.collectionSize" [(page)]="docs.currentPage" [maxSize]="5"[rotate]="true" [boundaryLinks]="true" (pageChange)="reload()" aria-label="Default pagination"></ngb-pagination><div *ngIf="displayMode == 'largeCards'">diff --git a/src-ui/src/app/components/filter-editor/filter-editor.component.html b/src-ui/src/app/components/filter-editor/filter-editor.component.htmlindex 1cca0fd7f..48780e950 100644--- a/src-ui/src/app/components/filter-editor/filter-editor.component.html+++ b/src-ui/src/app/components/filter-editor/filter-editor.component.html@@ -1,8 +1,5 @@<div *ngFor="let rule of filterRules" class="form-row form-group"><div class="col-md-3 col-form-label">- <!-- <select class="form-control form-control-sm" [(ngModel)]="rule.type" (change)="rule.value = null">- <option *ngFor="let ruleType of getRuleTypes()" [ngValue]="ruleType">{{ruleType.name}}</option>- </select> --><span>{{rule.type.name}}</span></div><div class="col">diff --git a/src-ui/src/app/components/manage/settings/settings.component.html b/src-ui/src/app/components/manage/settings/settings.component.htmlindex e8931ccdf..146d0c1be 100644--- a/src-ui/src/app/components/manage/settings/settings.component.html+++ b/src-ui/src/app/components/manage/settings/settings.component.html@@ -3,37 +3,61 @@</app-page-header><!-- <p>items per page, documents per view type</p> -->-<ul ngbNav #nav="ngbNav" class="nav-tabs">- <li [ngbNavItem]="1">- <a ngbNavLink>Document List Settings</a>- <ng-template ngbNavContent>- </ng-template>- </li>- <li [ngbNavItem]="2">- <a ngbNavLink>Saved views</a>- <ng-template ngbNavContent>-- <table class="table table-striped">- <thead>- <tr>- <th scope="col">Title</th>- <th scope="col">Show in dashboard</th>- <th scope="col">Show in sidebar</th>- <th scope="col">Actions</th>- </tr>- </thead>- <tbody>- <tr *ngFor="let config of savedViewConfigService.getConfigs()">- <td>{{ config.title }}</td>- <td>{{ config.showInDashboard }}</td>- <td>{{ config.showInSideBar }}</td>- <td><button type="button" class="btn btn-sm btn-outline-danger" (click)="deleteViewConfig(config)">Delete</button></td>- </tr>- </tbody>- </table>-- </ng-template>- </li>-</ul>--<div [ngbNavOutlet]="nav" class="mt-2"></div>\ No newline at end of file+<form [formGroup]="settingsForm" (ngSubmit)="saveSettings()">++ <ul ngbNav #nav="ngbNav" class="nav-tabs">+ <li [ngbNavItem]="1">+ <a ngbNavLink>General settings</a>+ <ng-template ngbNavContent>++ <h4>Document list</h4>++ <div class="form-row form-group">+ <div class="col-md-3 col-form-label">+ <span>Items per page</span>+ </div>+ <div class="col">++ <select class="form-control" formControlName="documentListItemPerPage">+ <option [ngValue]="10">10</option>+ <option [ngValue]="25">25</option>+ <option [ngValue]="50">50</option>+ <option [ngValue]="100">100</option>+ </select>++ </div>+ </div>++ </ng-template>+ </li>+ <li [ngbNavItem]="2">+ <a ngbNavLink>Saved views</a>+ <ng-template ngbNavContent>++ <table class="table table-striped">+ <thead>+ <tr>+ <th scope="col">Title</th>+ <th scope="col">Show in dashboard</th>+ <th scope="col">Show in sidebar</th>+ <th scope="col">Actions</th>+ </tr>+ </thead>+ <tbody>+ <tr *ngFor="let config of savedViewConfigService.getConfigs()">+ <td>{{ config.title }}</td>+ <td>{{ config.showInDashboard }}</td>+ <td>{{ config.showInSideBar }}</td>+ <td><button type="button" class="btn btn-sm btn-outline-danger" (click)="deleteViewConfig(config)">Delete</button></td>+ </tr>+ </tbody>+ </table>++ </ng-template>+ </li>+ </ul>++ <div [ngbNavOutlet]="nav" class="mt-2"></div>++ <button type="submit" class="btn btn-primary">Save</button>+</form>\ No newline at end of filediff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.tsindex c56cd6a78..e14c2bd7b 100644--- a/src-ui/src/app/components/manage/settings/settings.component.ts+++ b/src-ui/src/app/components/manage/settings/settings.component.ts@@ -1,5 +1,8 @@import { Component, OnInit } from '@angular/core';+import { FormControl, FormGroup } from '@angular/forms';import { SavedViewConfig } from 'src/app/data/saved-view-config';+import { GENERAL_SETTINGS } from 'src/app/data/storage-keys';+import { DocumentListViewService } from 'src/app/services/document-list-view.service';import { SavedViewConfigService } from 'src/app/services/saved-view-config.service';@Component({@@ -9,12 +12,15 @@ import { SavedViewConfigService } from 'src/app/services/saved-view-config.servi})export class SettingsComponent implements OnInit {+ settingsForm = new FormGroup({+ 'documentListItemPerPage': new FormControl(+localStorage.getItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE) || GENERAL_SETTINGS.DOCUMENT_LIST_SIZE_DEFAULT)+ })+constructor(- private savedViewConfigService: SavedViewConfigService+ private savedViewConfigService: SavedViewConfigService,+ private documentListViewService: DocumentListViewService) { }- active-ngOnInit(): void {}@@ -22,4 +28,8 @@ export class SettingsComponent implements OnInit {this.savedViewConfigService.deleteConfig(config)}+ saveSettings() {+ localStorage.setItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage)+ this.documentListViewService.updatePageSize()+ }}diff --git a/src-ui/src/app/data/storage-keys.ts b/src-ui/src/app/data/storage-keys.tsindex aa39b31d1..cc4a05ec2 100644--- a/src-ui/src/app/data/storage-keys.ts+++ b/src-ui/src/app/data/storage-keys.ts@@ -1,3 +1,8 @@export const OPEN_DOCUMENT_SERVICE = {DOCUMENTS: 'open-documents-service:openDocuments'+}++export const GENERAL_SETTINGS = {+ DOCUMENT_LIST_SIZE: 'general-settings:documentListSize',+ DOCUMENT_LIST_SIZE_DEFAULT: 50}\ No newline at end of filediff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.tsindex 0ea509863..e554f2c8f 100644--- a/src-ui/src/app/services/document-list-view.service.ts+++ b/src-ui/src/app/services/document-list-view.service.ts@@ -3,6 +3,7 @@ import { Observable } from 'rxjs';import { cloneFilterRules, FilterRule } from '../data/filter-rule';import { PaperlessDocument } from '../data/paperless-document';import { SavedViewConfig } from '../data/saved-view-config';+import { GENERAL_SETTINGS } from '../data/storage-keys';import { DocumentService, SORT_DIRECTION_DESCENDING } from './rest/document.service';@@ -15,6 +16,7 @@ export class DocumentListViewService {documents: PaperlessDocument[] = []currentPage = 1+ currentPageSize: number = +localStorage.getItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE) || GENERAL_SETTINGS.DOCUMENT_LIST_SIZE_DEFAULTcollectionSize: numbercurrentFilterRules: FilterRule[] = []@@ -39,7 +41,7 @@ export class DocumentListViewService {this.documentService.list(this.currentPage,- null,+ this.currentPageSize,sortField,sortDirection,filterRules).subscribe(@@ -64,7 +66,7 @@ export class DocumentListViewService {}getLastPage(): number {- return Math.ceil(this.collectionSize / 25)+ return Math.ceil(this.collectionSize / this.currentPageSize)}hasNext(doc: number) {@@ -98,5 +100,13 @@ export class DocumentListViewService {})}+ updatePageSize() {+ let newPageSize = +localStorage.getItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE) || GENERAL_SETTINGS.DOCUMENT_LIST_SIZE_DEFAULT+ if (newPageSize != this.currentPageSize) {+ this.currentPageSize = newPageSize+ //this.reload()+ }+ }+constructor(private documentService: DocumentService) { }}