mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Updated to work with new unified search interface
This commit is contained in:
		| @@ -290,9 +290,12 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|       distinctUntilChanged() | ||||
|     ).subscribe(text => { | ||||
|       this._textFilter = text | ||||
|       this.documentService.setSearchQuery(text) | ||||
|       this.documentService.searchQuery = text | ||||
|       this.updateRules() | ||||
|     }) | ||||
|  | ||||
|     if (this._textFilter) this.documentService.searchQuery = this._textFilter | ||||
|  | ||||
|   } | ||||
|  | ||||
|   ngOnDestroy() { | ||||
|   | ||||
| @@ -12,7 +12,6 @@ import { DocumentTypeService } from './document-type.service'; | ||||
| import { TagService } from './tag.service'; | ||||
| import { FILTER_RULE_TYPES } from 'src/app/data/filter-rule-type'; | ||||
| import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions'; | ||||
| import { ActivatedRoute } from '@angular/router'; | ||||
|  | ||||
| export const DOCUMENT_SORT_FIELDS = [ | ||||
|   { field: 'archive_serial_number', name: $localize`ASN` }, | ||||
| @@ -40,14 +39,10 @@ export interface SelectionData { | ||||
| }) | ||||
| export class DocumentService extends AbstractPaperlessService<PaperlessDocument> { | ||||
|  | ||||
|   private searchQuery: string | ||||
|   private _searchQuery: string | ||||
|  | ||||
|   constructor(http: HttpClient, private correspondentService: CorrespondentService, private documentTypeService: DocumentTypeService, private tagService: TagService, private route: ActivatedRoute) { | ||||
|   constructor(http: HttpClient, private correspondentService: CorrespondentService, private documentTypeService: DocumentTypeService, private tagService: TagService) { | ||||
|     super(http, 'documents') | ||||
|  | ||||
|     this.route.queryParamMap.subscribe(paramMap => { | ||||
|       this.searchQuery = paramMap.get('query') | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   private filterRulesToQueryParams(filterRules: FilterRule[]) { | ||||
| @@ -99,7 +94,7 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument> | ||||
|  | ||||
|   getPreviewUrl(id: number, original: boolean = false): string { | ||||
|     let url = this.getResourceUrl(id, 'preview') | ||||
|     if (this.searchQuery) url += `#search="${this.searchQuery}"` | ||||
|     if (this._searchQuery) url += `#search="${this._searchQuery}"` | ||||
|     if (original) { | ||||
|       url += "?original=true" | ||||
|     } | ||||
| @@ -146,8 +141,8 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument> | ||||
|     return this.http.post(this.getResourceUrl(null, 'bulk_download'), {"documents": ids, "content": content}, { responseType: 'blob' }) | ||||
|   } | ||||
|  | ||||
|   public setSearchQuery(query: string) { | ||||
|     this.searchQuery = query | ||||
|   public set searchQuery(query: string) { | ||||
|     this._searchQuery = query | ||||
|   } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon