mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-16 19:46:48 +01:00
fixes an issue with open documents not refreshing after bulk operations
This commit is contained in:
parent
cd8f99d2c3
commit
2f599ca1d3
2 changed files with 19 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { PaperlessDocument } from '../data/paperless-document';
|
||||
import { OPEN_DOCUMENT_SERVICE } from '../data/storage-keys';
|
||||
import { DocumentService } from './rest/document.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
@ -9,7 +10,7 @@ export class OpenDocumentsService {
|
|||
|
||||
private MAX_OPEN_DOCUMENTS = 5
|
||||
|
||||
constructor() {
|
||||
constructor(private documentService: DocumentService) {
|
||||
if (sessionStorage.getItem(OPEN_DOCUMENT_SERVICE.DOCUMENTS)) {
|
||||
try {
|
||||
this.openDocuments = JSON.parse(sessionStorage.getItem(OPEN_DOCUMENT_SERVICE.DOCUMENTS))
|
||||
|
|
@ -22,6 +23,15 @@ export class OpenDocumentsService {
|
|||
|
||||
private openDocuments: PaperlessDocument[] = []
|
||||
|
||||
refreshDocument(id: number) {
|
||||
let index = this.openDocuments.findIndex(doc => doc.id == id)
|
||||
if (index > -1) {
|
||||
this.documentService.get(id).subscribe(doc => {
|
||||
this.openDocuments[index] = doc
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
getOpenDocuments(): PaperlessDocument[] {
|
||||
return this.openDocuments
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue