let OpenDocumentsService handle nav

This commit is contained in:
Michael Shamoon
2022-05-15 23:25:46 -07:00
parent d0f70c8f18
commit c1fb277f25
10 changed files with 38 additions and 65 deletions

View File

@@ -11,7 +11,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let doc of documents" (click)="clickDoc(doc)">
<tr *ngFor="let doc of documents" (click)="openDocumentsService.openDocument(doc)">
<td>{{doc.created | customDate}}</td>
<td>{{doc.title | documentTitle}}<app-tag [tag]="t" *ngFor="let t of doc.tags$ | async" class="ms-1" (click)="clickTag(t); $event.stopPropagation();"></app-tag></td>
</tr>

View File

@@ -1,6 +1,6 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { first, Subscription } from 'rxjs'
import { Subscription } from 'rxjs'
import { PaperlessDocument } from 'src/app/data/paperless-document'
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view'
import { ConsumerStatusService } from 'src/app/services/consumer-status.service'
@@ -23,7 +23,7 @@ export class SavedViewWidgetComponent implements OnInit, OnDestroy {
private router: Router,
private queryParamsService: QueryParamsService,
private consumerStatusService: ConsumerStatusService,
private openDocumentsService: OpenDocumentsService
public openDocumentsService: OpenDocumentsService
) {}
@Input()
@@ -72,15 +72,6 @@ export class SavedViewWidgetComponent implements OnInit, OnDestroy {
}
}
clickDoc(doc: PaperlessDocument) {
this.openDocumentsService
.openDocument(doc)
.pipe(first())
.subscribe((open) => {
if (open) this.router.navigate(['documents', doc.id])
})
}
clickTag(tag: PaperlessTag) {
this.queryParamsService.navigateWithFilterRules([
{ rule_type: FILTER_HAS_TAGS_ALL, value: tag.id.toString() },