mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Merge branch 'dev' into feature-ocrmypdf
This commit is contained in:
		@@ -1,6 +1,9 @@
 | 
			
		||||
<app-widget-frame [title]="savedView.title">
 | 
			
		||||
 | 
			
		||||
  <table class="table table-sm table-hover table-borderless">
 | 
			
		||||
  <a header-buttons [routerLink]="" (click)="showAll()">Show all</a>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  <table content class="table table-sm table-hover table-borderless">
 | 
			
		||||
    <thead>
 | 
			
		||||
      <tr>
 | 
			
		||||
        <th>Created</th>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
import { Component, Input, OnInit } from '@angular/core';
 | 
			
		||||
import { Router } from '@angular/router';
 | 
			
		||||
import { PaperlessDocument } from 'src/app/data/paperless-document';
 | 
			
		||||
import { SavedViewConfig } from 'src/app/data/saved-view-config';
 | 
			
		||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service';
 | 
			
		||||
import { DocumentService } from 'src/app/services/rest/document.service';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
@@ -10,7 +12,10 @@ import { DocumentService } from 'src/app/services/rest/document.service';
 | 
			
		||||
})
 | 
			
		||||
export class SavedViewWidgetComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
  constructor(private documentService: DocumentService) { }
 | 
			
		||||
  constructor(
 | 
			
		||||
    private documentService: DocumentService,
 | 
			
		||||
    private router: Router,
 | 
			
		||||
    private list: DocumentListViewService) { }
 | 
			
		||||
  
 | 
			
		||||
  @Input()
 | 
			
		||||
  savedView: SavedViewConfig
 | 
			
		||||
@@ -23,4 +28,9 @@ export class SavedViewWidgetComponent implements OnInit {
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  showAll() {
 | 
			
		||||
    this.list.load(this.savedView)
 | 
			
		||||
    this.router.navigate(["documents"])
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
<app-widget-frame title="Statistics">
 | 
			
		||||
  <p class="card-text">Documents in inbox: {{statistics.documents_inbox}}</p>
 | 
			
		||||
  <p class="card-text">Total documents: {{statistics.documents_total}}</p>
 | 
			
		||||
  <ng-container content>
 | 
			
		||||
    <p class="card-text">Documents in inbox: {{statistics.documents_inbox}}</p>
 | 
			
		||||
    <p class="card-text">Total documents: {{statistics.documents_total}}</p>
 | 
			
		||||
  </ng-container>
 | 
			
		||||
</app-widget-frame>
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<app-widget-frame title="Upload new documents">
 | 
			
		||||
 | 
			
		||||
  <form>
 | 
			
		||||
  <form content>
 | 
			
		||||
    <ngx-file-drop 
 | 
			
		||||
      dropZoneLabel="Drop documents here or" (onFileDrop)="dropped($event)"
 | 
			
		||||
      (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,12 @@
 | 
			
		||||
<div class="card mb-3 shadow">
 | 
			
		||||
  <div class="card-header">
 | 
			
		||||
    <h5 class="card-title mb-0">{{title}}</h5>
 | 
			
		||||
    <div class="d-flex justify-content-between align-items-center">
 | 
			
		||||
      <h5 class="card-title mb-0">{{title}}</h5>
 | 
			
		||||
      <ng-content select ="[header-buttons]"></ng-content>
 | 
			
		||||
    </div>
 | 
			
		||||
    
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="card-body text-dark">
 | 
			
		||||
    <ng-content></ng-content>
 | 
			
		||||
    <ng-content select ="[content]"></ng-content>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -9,9 +9,11 @@
 | 
			
		||||
        <div class="d-flex justify-content-between align-items-center">
 | 
			
		||||
          <h5 class="card-title">    
 | 
			
		||||
            <ng-container *ngIf="document.correspondent">
 | 
			
		||||
              <a [routerLink]="" title="Filter by correspondent" (click)="clickCorrespondent.emit(document.correspondent)" class="font-weight-bold">{{document.correspondent.name}}</a>:
 | 
			
		||||
              <a *ngIf="clickCorrespondent.observers.length ; else nolink" [routerLink]="" title="Filter by correspondent" (click)="clickCorrespondent.emit(document.correspondent)" class="font-weight-bold">{{document.correspondent.name}}</a>
 | 
			
		||||
              <ng-template #nolink>{{document.correspondent.name}}</ng-template>:
 | 
			
		||||
            </ng-container>
 | 
			
		||||
            {{document.title}}<app-tag [tag]="t" linkTitle="Filter by tag" *ngFor="let t of document.tags" class="ml-1" (click)="clickTag.emit(t)" [clickable]="true"></app-tag>
 | 
			
		||||
            {{document.title}}
 | 
			
		||||
            <app-tag [tag]="t" linkTitle="Filter by tag" *ngFor="let t of document.tags" class="ml-1" (click)="clickTag.emit(t)" [clickable]="clickTag.observers.length"></app-tag>
 | 
			
		||||
          </h5>
 | 
			
		||||
          <h5 class="card-title" *ngIf="document.archive_serial_number">#{{document.archive_serial_number}}</h5>
 | 
			
		||||
        </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,21 @@
 | 
			
		||||
<app-page-header title="Search results">
 | 
			
		||||
</app-page-header>
 | 
			
		||||
 | 
			
		||||
<p>Search string: <i>{{query}}</i></p>
 | 
			
		||||
<div *ngIf="errorMessage" class="alert alert-danger">Invalid search query: {{errorMessage}}</div>
 | 
			
		||||
 | 
			
		||||
<div [class.result-content-searching]="searching" infiniteScroll (scrolled)="onScroll()">
 | 
			
		||||
<p>
 | 
			
		||||
    Search string: <i>{{query}}</i>
 | 
			
		||||
    <ng-container *ngIf="correctedQuery">
 | 
			
		||||
        - Did you mean "<a [routerLink]="" (click)="searchCorrectedQuery()">{{correctedQuery}}</a>"?
 | 
			
		||||
    </ng-container>
 | 
			
		||||
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<div *ngIf="!errorMessage" [class.result-content-searching]="searching" infiniteScroll (scrolled)="onScroll()">
 | 
			
		||||
    <p>{{resultCount}} result(s)</p>
 | 
			
		||||
    <app-document-card-large *ngFor="let result of results"
 | 
			
		||||
        [document]="result.document"
 | 
			
		||||
        [details]="result.highlights">
 | 
			
		||||
 | 
			
		||||
</app-document-card-large>
 | 
			
		||||
</div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { ActivatedRoute } from '@angular/router';
 | 
			
		||||
import { ActivatedRoute, Router } from '@angular/router';
 | 
			
		||||
import { SearchHit } from 'src/app/data/search-result';
 | 
			
		||||
import { SearchService } from 'src/app/services/rest/search.service';
 | 
			
		||||
 | 
			
		||||
@@ -9,7 +9,7 @@ import { SearchService } from 'src/app/services/rest/search.service';
 | 
			
		||||
  styleUrls: ['./search.component.scss']
 | 
			
		||||
})
 | 
			
		||||
export class SearchComponent implements OnInit {
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  results: SearchHit[] = []
 | 
			
		||||
 | 
			
		||||
  query: string = ""
 | 
			
		||||
@@ -22,7 +22,11 @@ export class SearchComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
  resultCount
 | 
			
		||||
 | 
			
		||||
  constructor(private searchService: SearchService, private route: ActivatedRoute) { }
 | 
			
		||||
  correctedQuery: string = null
 | 
			
		||||
 | 
			
		||||
  errorMessage: string
 | 
			
		||||
 | 
			
		||||
  constructor(private searchService: SearchService, private route: ActivatedRoute, private router: Router) { }
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
    this.route.queryParamMap.subscribe(paramMap => {
 | 
			
		||||
@@ -31,10 +35,16 @@ export class SearchComponent implements OnInit {
 | 
			
		||||
      this.currentPage = 1
 | 
			
		||||
      this.loadPage()
 | 
			
		||||
    })
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  searchCorrectedQuery() {
 | 
			
		||||
    this.router.navigate(["search"], {queryParams: {query: this.correctedQuery}})
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  loadPage(append: boolean = false) {
 | 
			
		||||
    this.errorMessage = null
 | 
			
		||||
    this.correctedQuery = null
 | 
			
		||||
    this.searchService.search(this.query, this.currentPage).subscribe(result => {
 | 
			
		||||
      if (append) {
 | 
			
		||||
        this.results.push(...result.results)
 | 
			
		||||
@@ -44,12 +54,17 @@ export class SearchComponent implements OnInit {
 | 
			
		||||
      this.pageCount = result.page_count
 | 
			
		||||
      this.searching = false
 | 
			
		||||
      this.resultCount = result.count
 | 
			
		||||
      this.correctedQuery = result.corrected_query
 | 
			
		||||
    }, error => {
 | 
			
		||||
      this.searching = false
 | 
			
		||||
      this.resultCount = 1
 | 
			
		||||
      this.pageCount = 1
 | 
			
		||||
      this.results = []
 | 
			
		||||
      this.errorMessage = error.error
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  onScroll() {
 | 
			
		||||
    console.log(this.currentPage)
 | 
			
		||||
    console.log(this.pageCount)
 | 
			
		||||
    if (this.currentPage < this.pageCount) {
 | 
			
		||||
      this.currentPage += 1
 | 
			
		||||
      this.loadPage(true)
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,9 @@ export interface SearchResult {
 | 
			
		||||
  page?: number
 | 
			
		||||
  page_count?: number
 | 
			
		||||
 | 
			
		||||
  corrected_query?: string
 | 
			
		||||
 | 
			
		||||
  results?: SearchHit[]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user