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>
 | 
					              </svg> <span class="d-block d-md-inline" i18n>View</span>
 | 
				
			||||||
            </a>
 | 
					            </a>
 | 
				
			||||||
            <ng-template #previewContent>
 | 
					            <ng-template #previewContent>
 | 
				
			||||||
              <ng-container *ngIf="getContentType() == 'application/pdf'">
 | 
					 | 
				
			||||||
              <object [data]="previewUrl | safe" class="preview" width="100%"></object>
 | 
					              <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>
 | 
					            </ng-template>
 | 
				
			||||||
            <a class="btn btn-sm btn-outline-secondary" [href]="getDownloadUrl()">
 | 
					            <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">
 | 
					              <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 { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
 | 
				
			||||||
import { DomSanitizer } from '@angular/platform-browser';
 | 
					import { DomSanitizer } from '@angular/platform-browser';
 | 
				
			||||||
import { PaperlessDocument } from 'src/app/data/paperless-document';
 | 
					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 { DocumentService } from 'src/app/services/rest/document.service';
 | 
				
			||||||
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
 | 
					import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
 | 
				
			||||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
 | 
					import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
 | 
				
			||||||
@@ -48,8 +47,6 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
				
			|||||||
  mouseOnPreview = false
 | 
					  mouseOnPreview = false
 | 
				
			||||||
  popoverHidden = true
 | 
					  popoverHidden = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  metadata: PaperlessDocumentMetadata
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  get searchScoreClass() {
 | 
					  get searchScoreClass() {
 | 
				
			||||||
    if (this.searchScore > 0.7) {
 | 
					    if (this.searchScore > 0.7) {
 | 
				
			||||||
      return "success"
 | 
					      return "success"
 | 
				
			||||||
@@ -61,9 +58,6 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit(): void {
 | 
					  ngOnInit(): void {
 | 
				
			||||||
    this.documentService.getMetadata(this.document?.id).subscribe(result => {
 | 
					 | 
				
			||||||
      this.metadata = result
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getIsThumbInverted() {
 | 
					  getIsThumbInverted() {
 | 
				
			||||||
@@ -95,10 +89,6 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
				
			|||||||
    return this.documentService.getPreviewUrl(this.document.id)
 | 
					    return this.documentService.getPreviewUrl(this.document.id)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getContentType() {
 | 
					 | 
				
			||||||
    return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  mouseEnterPreview() {
 | 
					  mouseEnterPreview() {
 | 
				
			||||||
    this.mouseOnPreview = true
 | 
					    this.mouseOnPreview = true
 | 
				
			||||||
    if (!this.popover.isOpen()) {
 | 
					    if (!this.popover.isOpen()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,12 +46,7 @@
 | 
				
			|||||||
            </svg>
 | 
					            </svg>
 | 
				
			||||||
          </a>
 | 
					          </a>
 | 
				
			||||||
          <ng-template #previewContent>
 | 
					          <ng-template #previewContent>
 | 
				
			||||||
            <ng-container *ngIf="getContentType() == 'application/pdf'">
 | 
					 | 
				
			||||||
            <object [data]="previewUrl | safe" class="preview" width="100%"></object>
 | 
					            <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>
 | 
					          </ng-template>
 | 
				
			||||||
          <a [href]="getDownloadUrl()" class="btn btn-sm btn-outline-secondary" title="Download" (click)="$event.stopPropagation()" i18n-title>
 | 
					          <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">
 | 
					            <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 { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
 | 
				
			||||||
import { map } from 'rxjs/operators';
 | 
					import { map } from 'rxjs/operators';
 | 
				
			||||||
import { PaperlessDocument } from 'src/app/data/paperless-document';
 | 
					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 { DocumentService } from 'src/app/services/rest/document.service';
 | 
				
			||||||
import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
 | 
					import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service';
 | 
				
			||||||
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
 | 
					import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
 | 
				
			||||||
@@ -37,12 +36,7 @@ export class DocumentCardSmallComponent implements OnInit {
 | 
				
			|||||||
  mouseOnPreview = false
 | 
					  mouseOnPreview = false
 | 
				
			||||||
  popoverHidden = true
 | 
					  popoverHidden = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  metadata: PaperlessDocumentMetadata
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ngOnInit(): void {
 | 
					  ngOnInit(): void {
 | 
				
			||||||
    this.documentService.getMetadata(this.document?.id).subscribe(result => {
 | 
					 | 
				
			||||||
      this.metadata = result
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getIsThumbInverted() {
 | 
					  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() {
 | 
					  mouseEnterPreview() {
 | 
				
			||||||
    this.mouseOnPreview = true
 | 
					    this.mouseOnPreview = true
 | 
				
			||||||
    if (!this.popover.isOpen()) {
 | 
					    if (!this.popover.isOpen()) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user