mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Save list view state across sessions
This commit is contained in:
parent
87d2209e6d
commit
e906bf58f0
@ -197,7 +197,7 @@ export class DocumentListViewService {
|
|||||||
sortField: this.activeListViewState.sortField,
|
sortField: this.activeListViewState.sortField,
|
||||||
sortReverse: this.activeListViewState.sortReverse
|
sortReverse: this.activeListViewState.sortReverse
|
||||||
}
|
}
|
||||||
sessionStorage.setItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG, JSON.stringify(savedState))
|
localStorage.setItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG, JSON.stringify(savedState))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ export class DocumentListViewService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(private documentService: DocumentService, private settings: SettingsService, private router: Router) {
|
constructor(private documentService: DocumentService, private settings: SettingsService, private router: Router) {
|
||||||
let documentListViewConfigJson = sessionStorage.getItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG)
|
let documentListViewConfigJson = localStorage.getItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG)
|
||||||
if (documentListViewConfigJson) {
|
if (documentListViewConfigJson) {
|
||||||
try {
|
try {
|
||||||
let savedState: ListViewState = JSON.parse(documentListViewConfigJson)
|
let savedState: ListViewState = JSON.parse(documentListViewConfigJson)
|
||||||
@ -332,7 +332,7 @@ export class DocumentListViewService {
|
|||||||
let newState = Object.assign(this.defaultListViewState(), savedState)
|
let newState = Object.assign(this.defaultListViewState(), savedState)
|
||||||
this.listViewStates.set(null, newState)
|
this.listViewStates.set(null, newState)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sessionStorage.removeItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG)
|
localStorage.removeItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user