mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
Warn on closing edited doc due to max open docs
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
Output,
|
||||
ViewChild,
|
||||
} from '@angular/core'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { first, map } from 'rxjs/operators'
|
||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import {
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
SETTINGS_KEYS,
|
||||
} from 'src/app/services/settings.service'
|
||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
import { Router } from '@angular/router'
|
||||
|
||||
@Component({
|
||||
selector: 'app-document-card-small',
|
||||
@@ -26,7 +28,9 @@ import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
|
||||
export class DocumentCardSmallComponent implements OnInit {
|
||||
constructor(
|
||||
private documentService: DocumentService,
|
||||
private settingsService: SettingsService
|
||||
private settingsService: SettingsService,
|
||||
private openDocumentsService: OpenDocumentsService,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
@Input()
|
||||
@@ -109,4 +113,13 @@ export class DocumentCardSmallComponent implements OnInit {
|
||||
mouseLeaveCard() {
|
||||
this.popover.close()
|
||||
}
|
||||
|
||||
clickEdit() {
|
||||
this.openDocumentsService
|
||||
.openDocument(this.document)
|
||||
.pipe(first())
|
||||
.subscribe((open) => {
|
||||
if (open) this.router.navigate(['documents', this.document.id])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user