mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Remove metadata API calls
This commit is contained in:
		@@ -52,12 +52,7 @@
 | 
			
		||||
              </svg> <span class="d-block d-md-inline" i18n>View</span>
 | 
			
		||||
            </a>
 | 
			
		||||
            <ng-template #previewContent>
 | 
			
		||||
              <ng-container *ngIf="getContentType() == 'application/pdf'">
 | 
			
		||||
              <object [data]="previewUrl | safe" class="preview" width="100%"></object>
 | 
			
		||||
              </ng-container>
 | 
			
		||||
              <ng-container *ngIf="getContentType() == 'text/plain'">
 | 
			
		||||
                  <object [data]="previewUrl | safe" type="text/plain" class="preview" width="100%"></object>
 | 
			
		||||
              </ng-container>
 | 
			
		||||
            </ng-template>
 | 
			
		||||
            <a class="btn btn-sm btn-outline-secondary" [href]="getDownloadUrl()">
 | 
			
		||||
              <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-download" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
 | 
			
		||||
import { DomSanitizer } from '@angular/platform-browser';
 | 
			
		||||
import { PaperlessDocument } from 'src/app/data/paperless-document';
 | 
			
		||||
import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata';
 | 
			
		||||
import { DocumentService } from 'src/app/services/rest/document.service';
 | 
			
		||||
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
 | 
			
		||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
@@ -48,8 +47,6 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
			
		||||
  mouseOnPreview = false
 | 
			
		||||
  popoverHidden = true
 | 
			
		||||
 | 
			
		||||
  metadata: PaperlessDocumentMetadata
 | 
			
		||||
 | 
			
		||||
  get searchScoreClass() {
 | 
			
		||||
    if (this.searchScore > 0.7) {
 | 
			
		||||
      return "success"
 | 
			
		||||
@@ -61,9 +58,6 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.documentService.getMetadata(this.document?.id).subscribe(result => {
 | 
			
		||||
      this.metadata = result
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getIsThumbInverted() {
 | 
			
		||||
@@ -95,10 +89,6 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
			
		||||
    return this.documentService.getPreviewUrl(this.document.id)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getContentType() {
 | 
			
		||||
    return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  mouseEnterPreview() {
 | 
			
		||||
    this.mouseOnPreview = true
 | 
			
		||||
    if (!this.popover.isOpen()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -46,12 +46,7 @@
 | 
			
		||||
            </svg>
 | 
			
		||||
          </a>
 | 
			
		||||
          <ng-template #previewContent>
 | 
			
		||||
            <ng-container *ngIf="getContentType() == 'application/pdf'">
 | 
			
		||||
            <object [data]="previewUrl | safe" class="preview" width="100%"></object>
 | 
			
		||||
            </ng-container>
 | 
			
		||||
            <ng-container *ngIf="getContentType() == 'text/plain'">
 | 
			
		||||
                <object [data]="previewUrl | safe" type="text/plain" class="preview" width="100%"></object>
 | 
			
		||||
            </ng-container>
 | 
			
		||||
          </ng-template>
 | 
			
		||||
          <a [href]="getDownloadUrl()" class="btn btn-sm btn-outline-secondary" title="Download" (click)="$event.stopPropagation()" i18n-title>
 | 
			
		||||
            <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-download" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
 | 
			
		||||
import { map } from 'rxjs/operators';
 | 
			
		||||
import { PaperlessDocument } from 'src/app/data/paperless-document';
 | 
			
		||||
import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata';
 | 
			
		||||
import { DocumentService } from 'src/app/services/rest/document.service';
 | 
			
		||||
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
 | 
			
		||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
@@ -37,12 +36,7 @@ export class DocumentCardSmallComponent implements OnInit {
 | 
			
		||||
  mouseOnPreview = false
 | 
			
		||||
  popoverHidden = true
 | 
			
		||||
 | 
			
		||||
  metadata: PaperlessDocumentMetadata
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.documentService.getMetadata(this.document?.id).subscribe(result => {
 | 
			
		||||
      this.metadata = result
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getIsThumbInverted() {
 | 
			
		||||
@@ -74,10 +68,6 @@ export class DocumentCardSmallComponent implements OnInit {
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getContentType() {
 | 
			
		||||
    return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  mouseEnterPreview() {
 | 
			
		||||
    this.mouseOnPreview = true
 | 
			
		||||
    if (!this.popover.isOpen()) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user