mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge pull request #248 from shamoon/fix/issue-164
Hide matching pattern if algorithm is auto
This commit is contained in:
		| @@ -2,7 +2,7 @@ import { Directive, EventEmitter, Input, OnInit, Output } from '@angular/core'; | |||||||
| import { FormGroup } from '@angular/forms'; | import { FormGroup } from '@angular/forms'; | ||||||
| import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||||||
| import { Observable } from 'rxjs'; | import { Observable } from 'rxjs'; | ||||||
| import { MATCHING_ALGORITHMS } from 'src/app/data/matching-model'; | import { MATCHING_ALGORITHMS, MATCH_AUTO } from 'src/app/data/matching-model'; | ||||||
| import { ObjectWithId } from 'src/app/data/object-with-id'; | import { ObjectWithId } from 'src/app/data/object-with-id'; | ||||||
| import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service'; | import { AbstractPaperlessService } from 'src/app/services/rest/abstract-paperless-service'; | ||||||
| import { ToastService } from 'src/app/services/toast.service'; | import { ToastService } from 'src/app/services/toast.service'; | ||||||
| @@ -61,6 +61,10 @@ export abstract class EditDialogComponent<T extends ObjectWithId> implements OnI | |||||||
|     return MATCHING_ALGORITHMS |     return MATCHING_ALGORITHMS | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   get patternRequired(): boolean { | ||||||
|  |     return this.objectForm?.value.matching_algorithm !== MATCH_AUTO | ||||||
|  |   } | ||||||
|  |  | ||||||
|   save() { |   save() { | ||||||
|     var newObject = Object.assign(Object.assign({}, this.object), this.objectForm.value) |     var newObject = Object.assign(Object.assign({}, this.object), this.objectForm.value) | ||||||
|     var serverResponse: Observable<T> |     var serverResponse: Observable<T> | ||||||
|   | |||||||
| @@ -6,14 +6,14 @@ | |||||||
|     </button> |     </button> | ||||||
|   </div> |   </div> | ||||||
|   <div class="modal-body"> |   <div class="modal-body"> | ||||||
|      |  | ||||||
|     <app-input-text i18n-title title="Name" formControlName="name"></app-input-text> |     <app-input-text i18n-title title="Name" formControlName="name"></app-input-text> | ||||||
|     <app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select> |     <app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select> | ||||||
|     <app-input-text i18n-title title="Matching pattern" formControlName="match" i18n-hint hint="Auto matching does not require you to fill in this field."></app-input-text> |     <app-input-text *ngIf="patternRequired" i18n-title title="Matching pattern" formControlName="match"></app-input-text> | ||||||
|     <app-input-check i18n-title title="Case insensitive" formControlName="is_insensitive" i18n-hint hint="Auto matching ignores this option."></app-input-check> |     <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive"></app-input-check> | ||||||
|   </div> |   </div> | ||||||
|   <div class="modal-footer"> |   <div class="modal-footer"> | ||||||
|     <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n>Cancel</button> |     <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n>Cancel</button> | ||||||
|     <button type="submit" class="btn btn-primary" i18n>Save</button> |     <button type="submit" class="btn btn-primary" i18n>Save</button> | ||||||
|   </div> |   </div> | ||||||
| </form> | </form> | ||||||
|   | |||||||
| @@ -6,15 +6,15 @@ | |||||||
|       </button> |       </button> | ||||||
|     </div> |     </div> | ||||||
|     <div class="modal-body"> |     <div class="modal-body"> | ||||||
|        |  | ||||||
|       <app-input-text i18n-title title="Name" formControlName="name"></app-input-text> |       <app-input-text i18n-title title="Name" formControlName="name"></app-input-text> | ||||||
|       <app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select> |       <app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select> | ||||||
|       <app-input-text i18n-title title="Matching pattern" formControlName="match" i18n-hint hint="Auto matching does not require you to fill in this field."></app-input-text> |       <app-input-text *ngIf="patternRequired" i18n-title title="Matching pattern" formControlName="match"></app-input-text> | ||||||
|       <app-input-check i18n-title title="Case insensitive" formControlName="is_insensitive" i18n-hint hint="Auto matching ignores this option."></app-input-check> |       <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive"></app-input-check> | ||||||
|  |  | ||||||
|     </div> |     </div> | ||||||
|     <div class="modal-footer"> |     <div class="modal-footer"> | ||||||
|       <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n>Cancel</button> |       <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n>Cancel</button> | ||||||
|       <button type="submit" class="btn btn-primary" i18n>Save</button> |       <button type="submit" class="btn btn-primary" i18n>Save</button> | ||||||
|     </div> |     </div> | ||||||
|   </form> |   </form> | ||||||
|   | |||||||
| @@ -17,11 +17,11 @@ | |||||||
|           </ng-template> |           </ng-template> | ||||||
|         </ng-select> |         </ng-select> | ||||||
|       </div> |       </div> | ||||||
|       |  | ||||||
|       <app-input-check i18n-title title="Inbox tag" formControlName="is_inbox_tag" i18n-hint hint="Inbox tags are automatically assigned to all consumed documents."></app-input-check> |       <app-input-check i18n-title title="Inbox tag" formControlName="is_inbox_tag" i18n-hint hint="Inbox tags are automatically assigned to all consumed documents."></app-input-check> | ||||||
|       <app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select> |       <app-input-select i18n-title title="Matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></app-input-select> | ||||||
|       <app-input-text i18n-title title="Matching pattern" formControlName="match" i18n-hint hint="Auto matching does not require you to fill in this field."></app-input-text> |       <app-input-text *ngIf="patternRequired" i18n-title title="Matching pattern" formControlName="match"></app-input-text> | ||||||
|       <app-input-check i18n-title title="Case insensitive" formControlName="is_insensitive" i18n-hint hint="Auto matching ignores this option."></app-input-check> |       <app-input-check *ngIf="patternRequired" i18n-title title="Case insensitive" formControlName="is_insensitive"></app-input-check> | ||||||
|     </div> |     </div> | ||||||
|     <div class="modal-footer"> |     <div class="modal-footer"> | ||||||
|       <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n>Cancel</button> |       <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n>Cancel</button> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jonas Winkler
					Jonas Winkler