mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Handle page parameter on saved views
This commit is contained in:
@@ -147,6 +147,15 @@ export class DocumentListViewService {
|
||||
}
|
||||
}
|
||||
|
||||
activateSavedViewWithQueryParams(
|
||||
view: PaperlessSavedView,
|
||||
queryParams: ParamMap
|
||||
) {
|
||||
let params = parseParams(queryParams)
|
||||
this.activateSavedView(view)
|
||||
this.activeListViewState.currentPage = params.currentPage
|
||||
}
|
||||
|
||||
loadSavedView(view: PaperlessSavedView, closeCurrentView: boolean = false) {
|
||||
if (closeCurrentView) {
|
||||
this._activeSavedViewId = null
|
||||
@@ -212,12 +221,16 @@ export class DocumentListViewService {
|
||||
this.isReloading = false
|
||||
activeListViewState.collectionSize = result.count
|
||||
activeListViewState.documents = result.results
|
||||
|
||||
if (updateQueryParams && !this._activeSavedViewId) {
|
||||
let base = ['/documents']
|
||||
this.router.navigate(base, {
|
||||
queryParams: generateParams(activeListViewState),
|
||||
})
|
||||
} else if (this._activeSavedViewId) {
|
||||
this.router.navigate([], {
|
||||
queryParams: generateParams(activeListViewState, true),
|
||||
queryParamsHandling: 'merge',
|
||||
})
|
||||
}
|
||||
|
||||
if (onFinish) {
|
||||
@@ -305,7 +318,6 @@ export class DocumentListViewService {
|
||||
|
||||
set currentPage(page: number) {
|
||||
if (this.activeListViewState.currentPage == page) return
|
||||
this._activeSavedViewId = null
|
||||
this.activeListViewState.currentPage = page
|
||||
this.reload()
|
||||
this.saveDocumentListView()
|
||||
|
Reference in New Issue
Block a user