mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-07 07:19:22 +00:00
Fixhancement: rework saved view widget queue processing to expected (#14699)
* activateSavedViewWithDocuments, move most of loadSavedView to a helper * Consolidate the page size thing * Pass widget's documents to list service fpr next / previous * Tests for the page size + widget click * Fix close from a dashboard widget list
This commit is contained in:
1 parent
e88303cc16
commit
c5239f9f74
8 files changed
+150
-13
No files matched your search
+19
-2
@@ -132,7 +132,7 @@ export class SavedViewWidgetComponent
|
||||
ngOnInit(): void {
|
||||
this.placeholderRows = Array.from(
|
||||
{
|
||||
length: this.savedView?.page_size ?? DEFAULT_DASHBOARD_VIEW_PAGE_SIZE,
|
||||
length: this.pageSize,
|
||||
},
|
||||
(_, index) => index
|
||||
)
|
||||
@@ -187,7 +187,7 @@ export class SavedViewWidgetComponent
|
||||
this.documentService
|
||||
.listFiltered(
|
||||
1,
|
||||
this.savedView?.page_size ?? DEFAULT_DASHBOARD_VIEW_PAGE_SIZE,
|
||||
this.pageSize,
|
||||
this.savedView.sort_field,
|
||||
this.savedView.sort_reverse,
|
||||
this.savedView.filter_rules,
|
||||
@@ -292,7 +292,24 @@ export class SavedViewWidgetComponent
|
||||
])
|
||||
}
|
||||
|
||||
get pageSize(): number {
|
||||
return this.savedView?.page_size ?? DEFAULT_DASHBOARD_VIEW_PAGE_SIZE
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the widget's documents to the list service to enable next / previous.
|
||||
*/
|
||||
activateViewForNavigation() {
|
||||
this.documentListViewService.activateSavedViewWithDocuments(
|
||||
this.savedView,
|
||||
this.documents(),
|
||||
this.count(),
|
||||
this.pageSize
|
||||
)
|
||||
}
|
||||
|
||||
openDocumentDetail(document: Document) {
|
||||
this.activateViewForNavigation()
|
||||
this.router.navigate(['documents', document.id])
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user