mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-26 01:09:34 -06:00
Compare commits
1 Commits
feature-te
...
fix-max-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0914a4b34d |
@@ -62,9 +62,9 @@
|
|||||||
|
|
||||||
@if (!loading) {
|
@if (!loading) {
|
||||||
<div class="d-flex mb-2">
|
<div class="d-flex mb-2">
|
||||||
@if (displayCollectionSize > 0) {
|
@if (collectionSize > 0) {
|
||||||
<div>
|
<div>
|
||||||
<ng-container i18n>{displayCollectionSize, plural, =1 {One {{typeName}}} other {{{displayCollectionSize || 0}} total {{typeNamePlural}}}}</ng-container>
|
<ng-container i18n>{collectionSize, plural, =1 {One {{typeName}}} other {{{collectionSize || 0}} total {{typeNamePlural}}}}</ng-container>
|
||||||
@if (selectedObjects.size > 0) {
|
@if (selectedObjects.size > 0) {
|
||||||
({{selectedObjects.size}} selected)
|
({{selectedObjects.size}} selected)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ describe('ManagementListComponent', () => {
|
|||||||
expect(reloadSpy).toHaveBeenCalled()
|
expect(reloadSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should use API count for pagination and all ids for displayed total', fakeAsync(() => {
|
it('should use the all list length for collection size when provided', fakeAsync(() => {
|
||||||
jest.spyOn(tagService, 'listFiltered').mockReturnValueOnce(
|
jest.spyOn(tagService, 'listFiltered').mockReturnValueOnce(
|
||||||
of({
|
of({
|
||||||
count: 1,
|
count: 1,
|
||||||
@@ -241,8 +241,7 @@ describe('ManagementListComponent', () => {
|
|||||||
component.reloadData()
|
component.reloadData()
|
||||||
tick(100)
|
tick(100)
|
||||||
|
|
||||||
expect(component.collectionSize).toBe(1)
|
expect(component.collectionSize).toBe(3)
|
||||||
expect(component.displayCollectionSize).toBe(3)
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
it('should support quick filter for objects', () => {
|
it('should support quick filter for objects', () => {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import {
|
|||||||
MatchingModel,
|
MatchingModel,
|
||||||
} from 'src/app/data/matching-model'
|
} from 'src/app/data/matching-model'
|
||||||
import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
|
import { ObjectWithPermissions } from 'src/app/data/object-with-permissions'
|
||||||
import { Results } from 'src/app/data/results'
|
|
||||||
import {
|
import {
|
||||||
SortableDirective,
|
SortableDirective,
|
||||||
SortEvent,
|
SortEvent,
|
||||||
@@ -89,7 +88,6 @@ export abstract class ManagementListComponent<T extends MatchingModel>
|
|||||||
public page = 1
|
public page = 1
|
||||||
|
|
||||||
public collectionSize = 0
|
public collectionSize = 0
|
||||||
public displayCollectionSize = 0
|
|
||||||
|
|
||||||
public sortField: string
|
public sortField: string
|
||||||
public sortReverse: boolean
|
public sortReverse: boolean
|
||||||
@@ -143,14 +141,6 @@ export abstract class ManagementListComponent<T extends MatchingModel>
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getCollectionSize(results: Results<T>): number {
|
|
||||||
return results.all?.length ?? results.count
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getDisplayCollectionSize(results: Results<T>): number {
|
|
||||||
return this.getCollectionSize(results)
|
|
||||||
}
|
|
||||||
|
|
||||||
getDocumentCount(object: MatchingModel): number {
|
getDocumentCount(object: MatchingModel): number {
|
||||||
return (
|
return (
|
||||||
object.document_count ??
|
object.document_count ??
|
||||||
@@ -181,8 +171,7 @@ export abstract class ManagementListComponent<T extends MatchingModel>
|
|||||||
tap((c) => {
|
tap((c) => {
|
||||||
this.unfilteredData = c.results
|
this.unfilteredData = c.results
|
||||||
this.data = this.filterData(c.results)
|
this.data = this.filterData(c.results)
|
||||||
this.collectionSize = this.getCollectionSize(c)
|
this.collectionSize = c.all?.length ?? c.count
|
||||||
this.displayCollectionSize = this.getDisplayCollectionSize(c)
|
|
||||||
}),
|
}),
|
||||||
delay(100)
|
delay(100)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
} from '@ng-bootstrap/ng-bootstrap'
|
} from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
import { FILTER_HAS_TAGS_ALL } from 'src/app/data/filter-rule-type'
|
import { FILTER_HAS_TAGS_ALL } from 'src/app/data/filter-rule-type'
|
||||||
import { Results } from 'src/app/data/results'
|
|
||||||
import { Tag } from 'src/app/data/tag'
|
import { Tag } from 'src/app/data/tag'
|
||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { SortableDirective } from 'src/app/directives/sortable.directive'
|
import { SortableDirective } from 'src/app/directives/sortable.directive'
|
||||||
@@ -78,16 +77,6 @@ export class TagListComponent extends ManagementListComponent<Tag> {
|
|||||||
return data.filter((tag) => !tag.parent || !availableIds.has(tag.parent))
|
return data.filter((tag) => !tag.parent || !availableIds.has(tag.parent))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override getCollectionSize(results: Results<Tag>): number {
|
|
||||||
// Tag list pages are requested with is_root=true (when unfiltered), so
|
|
||||||
// pagination must follow root count even though `all` includes descendants
|
|
||||||
return results.count
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override getDisplayCollectionSize(results: Results<Tag>): number {
|
|
||||||
return super.getCollectionSize(results)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override getSelectableIDs(tags: Tag[]): number[] {
|
protected override getSelectableIDs(tags: Tag[]): number[] {
|
||||||
const ids: number[] = []
|
const ids: number[] = []
|
||||||
for (const tag of tags.filter(Boolean)) {
|
for (const tag of tags.filter(Boolean)) {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Generated by Django 5.2.7 on 2026-02-23 21:54
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("paperless", "0004_applicationconfiguration_barcode_asn_prefix_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="applicationconfiguration",
|
||||||
|
name="barcode_max_pages",
|
||||||
|
field=models.PositiveIntegerField(
|
||||||
|
null=True,
|
||||||
|
verbose_name="Sets the maximum pages for barcode",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -250,7 +250,6 @@ class ApplicationConfiguration(AbstractSingletonModel):
|
|||||||
barcode_max_pages = models.PositiveIntegerField(
|
barcode_max_pages = models.PositiveIntegerField(
|
||||||
verbose_name=_("Sets the maximum pages for barcode"),
|
verbose_name=_("Sets the maximum pages for barcode"),
|
||||||
null=True,
|
null=True,
|
||||||
validators=[MinValueValidator(1)],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# PAPERLESS_CONSUMER_ENABLE_TAG_BARCODE
|
# PAPERLESS_CONSUMER_ENABLE_TAG_BARCODE
|
||||||
|
|||||||
Reference in New Issue
Block a user