mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-13 01:57:08 +01:00
Implement warning for closeAll
This commit is contained in:
parent
d275a75517
commit
1950f805b3
3 changed files with 50 additions and 17 deletions
|
|
@ -25,9 +25,7 @@ export class AppFrameComponent implements OnInit, OnDestroy {
|
|||
private searchService: SearchService,
|
||||
public savedViewService: SavedViewService,
|
||||
private meta: Meta
|
||||
) {
|
||||
|
||||
}
|
||||
) { }
|
||||
|
||||
versionString = `${environment.appTitle} ${environment.version}`
|
||||
|
||||
|
|
@ -78,17 +76,21 @@ export class AppFrameComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
closeAll() {
|
||||
this.closeMenu()
|
||||
this.openDocumentsService.closeAll()
|
||||
// user may need to confirm losing unsaved changes
|
||||
this.openDocumentsService.closeAll().subscribe(confirmed => {
|
||||
if (confirmed) {
|
||||
this.closeMenu()
|
||||
|
||||
// TODO: is there a better way to do this?
|
||||
let route = this.activatedRoute
|
||||
while (route.firstChild) {
|
||||
route = route.firstChild
|
||||
}
|
||||
if (route.component == DocumentDetailComponent) {
|
||||
this.router.navigate([""])
|
||||
}
|
||||
// TODO: is there a better way to do this?
|
||||
let route = this.activatedRoute
|
||||
while (route.firstChild) {
|
||||
route = route.firstChild
|
||||
}
|
||||
if (route.component == DocumentDetailComponent) {
|
||||
this.router.navigate([""])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue