mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	fix edit dialog getters
This commit is contained in:
		| @@ -8,6 +8,12 @@ import { | |||||||
| } from 'src/app/data/paperless-mail-account' | } from 'src/app/data/paperless-mail-account' | ||||||
| import { MailAccountService } from 'src/app/services/rest/mail-account.service' | import { MailAccountService } from 'src/app/services/rest/mail-account.service' | ||||||
|  |  | ||||||
|  | const IMAP_SECURITY_OPTIONS = [ | ||||||
|  |   { id: IMAPSecurity.None, name: $localize`No encryption` }, | ||||||
|  |   { id: IMAPSecurity.SSL, name: $localize`SSL` }, | ||||||
|  |   { id: IMAPSecurity.STARTTLS, name: $localize`STARTTLS` }, | ||||||
|  | ] | ||||||
|  |  | ||||||
| @Component({ | @Component({ | ||||||
|   selector: 'app-mail-account-edit-dialog', |   selector: 'app-mail-account-edit-dialog', | ||||||
|   templateUrl: './mail-account-edit-dialog.component.html', |   templateUrl: './mail-account-edit-dialog.component.html', | ||||||
| @@ -39,10 +45,6 @@ export class MailAccountEditDialogComponent extends EditDialogComponent<Paperles | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   get imapSecurityOptions() { |   get imapSecurityOptions() { | ||||||
|     return [ |     return IMAP_SECURITY_OPTIONS | ||||||
|       { id: IMAPSecurity.None, name: $localize`No encryption` }, |  | ||||||
|       { id: IMAPSecurity.SSL, name: $localize`SSL` }, |  | ||||||
|       { id: IMAPSecurity.STARTTLS, name: $localize`STARTTLS` }, |  | ||||||
|     ] |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ | |||||||
|         <app-input-text i18n-title title="Filter attachment filename" formControlName="filter_attachment_filename" i18n-hint hint="Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_attachment_filename"></app-input-text> |         <app-input-text i18n-title title="Filter attachment filename" formControlName="filter_attachment_filename" i18n-hint hint="Only consume documents which entirely match this filename if specified. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_attachment_filename"></app-input-text> | ||||||
|       </div> |       </div> | ||||||
|       <div class="col"> |       <div class="col"> | ||||||
|         <app-input-select i18n-title title="Action" [items]="actionOptions" formControlName="attachment_type" i18n-hint hint="Action is only performed when documents are consumed from the mail. Mails without attachments remain entirely untouched."></app-input-select> |         <app-input-select i18n-title title="Action" [items]="actionOptions" formControlName="action" i18n-hint hint="Action is only performed when documents are consumed from the mail. Mails without attachments remain entirely untouched."></app-input-select> | ||||||
|         <app-input-text i18n-title title="Action parameter" formControlName="action_parameter" [error]="error?.action_parameter"></app-input-text> |         <app-input-text i18n-title title="Action parameter" formControlName="action_parameter" [error]="error?.action_parameter"></app-input-text> | ||||||
|         <app-input-select i18n-title title="Assign title from" [items]="metadataTitleOptions" formControlName="assign_title_from"></app-input-select> |         <app-input-select i18n-title title="Assign title from" [items]="metadataTitleOptions" formControlName="assign_title_from"></app-input-select> | ||||||
|         <app-input-tags [allowCreate]="false" formControlName="assign_tags"></app-input-tags> |         <app-input-tags [allowCreate]="false" formControlName="assign_tags"></app-input-tags> | ||||||
|   | |||||||
| @@ -18,6 +18,70 @@ import { DocumentTypeService } from 'src/app/services/rest/document-type.service | |||||||
| import { MailAccountService } from 'src/app/services/rest/mail-account.service' | import { MailAccountService } from 'src/app/services/rest/mail-account.service' | ||||||
| import { MailRuleService } from 'src/app/services/rest/mail-rule.service' | import { MailRuleService } from 'src/app/services/rest/mail-rule.service' | ||||||
|  |  | ||||||
|  | const ATTACHMENT_TYPE_OPTIONS = [ | ||||||
|  |   { | ||||||
|  |     id: MailFilterAttachmentType.Attachments, | ||||||
|  |     name: $localize`Only process attachments.`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailFilterAttachmentType.Everything, | ||||||
|  |     name: $localize`Process all files, including 'inline' attachments.`, | ||||||
|  |   }, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | const ACTION_OPTIONS = [ | ||||||
|  |   { | ||||||
|  |     id: MailAction.Delete, | ||||||
|  |     name: $localize`Delete`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailAction.Move, | ||||||
|  |     name: $localize`Move to specified folder`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailAction.MarkRead, | ||||||
|  |     name: $localize`Mark as read, don't process read mails`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailAction.Flag, | ||||||
|  |     name: $localize`Flag the mail, don't process flagged mails`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailAction.Tag, | ||||||
|  |     name: $localize`Tag the mail with specified tag, don't process tagged mails`, | ||||||
|  |   }, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | const METADATA_TITLE_OPTIONS = [ | ||||||
|  |   { | ||||||
|  |     id: MailMetadataTitleOption.FromSubject, | ||||||
|  |     name: $localize`Use subject as title`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailMetadataTitleOption.FromFilename, | ||||||
|  |     name: $localize`Use attachment filename as title`, | ||||||
|  |   }, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | const METADATA_CORRESPONDENT_OPTIONS = [ | ||||||
|  |   { | ||||||
|  |     id: MailMetadataCorrespondentOption.FromNothing, | ||||||
|  |     name: $localize`Do not assign a correspondent`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailMetadataCorrespondentOption.FromEmail, | ||||||
|  |     name: $localize`Use mail address`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailMetadataCorrespondentOption.FromName, | ||||||
|  |     name: $localize`Use name (or mail address if not available)`, | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     id: MailMetadataCorrespondentOption.FromCustom, | ||||||
|  |     name: $localize`Use correspondent selected below`, | ||||||
|  |   }, | ||||||
|  | ] | ||||||
|  |  | ||||||
| @Component({ | @Component({ | ||||||
|   selector: 'app-mail-rule-edit-dialog', |   selector: 'app-mail-rule-edit-dialog', | ||||||
|   templateUrl: './mail-rule-edit-dialog.component.html', |   templateUrl: './mail-rule-edit-dialog.component.html', | ||||||
| @@ -92,74 +156,18 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMa | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   get attachmentTypeOptions() { |   get attachmentTypeOptions() { | ||||||
|     return [ |     return ATTACHMENT_TYPE_OPTIONS | ||||||
|       { |  | ||||||
|         id: MailFilterAttachmentType.Attachments, |  | ||||||
|         name: $localize`Only process attachments.`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailFilterAttachmentType.Everything, |  | ||||||
|         name: $localize`Process all files, including 'inline' attachments.`, |  | ||||||
|       }, |  | ||||||
|     ] |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get actionOptions() { |   get actionOptions() { | ||||||
|     return [ |     return ACTION_OPTIONS | ||||||
|       { |  | ||||||
|         id: MailAction.Delete, |  | ||||||
|         name: $localize`Delete`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailAction.Move, |  | ||||||
|         name: $localize`Move to specified folder`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailAction.MarkRead, |  | ||||||
|         name: $localize`Mark as read, don't process read mails`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailAction.Flag, |  | ||||||
|         name: $localize`Flag the mail, don't process flagged mails`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailAction.Tag, |  | ||||||
|         name: $localize`Tag the mail with specified tag, don't process tagged mails`, |  | ||||||
|       }, |  | ||||||
|     ] |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get metadataTitleOptions() { |   get metadataTitleOptions() { | ||||||
|     return [ |     return METADATA_TITLE_OPTIONS | ||||||
|       { |  | ||||||
|         id: MailMetadataTitleOption.FromSubject, |  | ||||||
|         name: $localize`Use subject as title`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailMetadataTitleOption.FromFilename, |  | ||||||
|         name: $localize`Use attachment filename as title`, |  | ||||||
|       }, |  | ||||||
|     ] |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get metadataCorrespondentOptions() { |   get metadataCorrespondentOptions() { | ||||||
|     return [ |     return METADATA_CORRESPONDENT_OPTIONS | ||||||
|       { |  | ||||||
|         id: MailMetadataCorrespondentOption.FromNothing, |  | ||||||
|         name: $localize`Do not assign a correspondent`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailMetadataCorrespondentOption.FromEmail, |  | ||||||
|         name: $localize`Use mail address`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailMetadataCorrespondentOption.FromName, |  | ||||||
|         name: $localize`Use name (or mail address if not available)`, |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         id: MailMetadataCorrespondentOption.FromCustom, |  | ||||||
|         name: $localize`Use correspondent selected below`, |  | ||||||
|       }, |  | ||||||
|     ] |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -524,7 +524,7 @@ export class SettingsComponent | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   editMailAccount(account: PaperlessMailAccount) { |   editMailAccount(account: PaperlessMailAccount) { | ||||||
|     var modal = this.modalService.open(MailAccountEditDialogComponent, { |     const modal = this.modalService.open(MailAccountEditDialogComponent, { | ||||||
|       backdrop: 'static', |       backdrop: 'static', | ||||||
|       size: 'xl', |       size: 'xl', | ||||||
|     }) |     }) | ||||||
| @@ -552,7 +552,7 @@ export class SettingsComponent | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   deleteMailAccount(account: PaperlessMailAccount) { |   deleteMailAccount(account: PaperlessMailAccount) { | ||||||
|     let modal = this.modalService.open(ConfirmDialogComponent, { |     const modal = this.modalService.open(ConfirmDialogComponent, { | ||||||
|       backdrop: 'static', |       backdrop: 'static', | ||||||
|     }) |     }) | ||||||
|     modal.componentInstance.title = $localize`Confirm delete mail account` |     modal.componentInstance.title = $localize`Confirm delete mail account` | ||||||
| @@ -582,7 +582,7 @@ export class SettingsComponent | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   editMailRule(rule: PaperlessMailRule) { |   editMailRule(rule: PaperlessMailRule) { | ||||||
|     var modal = this.modalService.open(MailRuleEditDialogComponent, { |     const modal = this.modalService.open(MailRuleEditDialogComponent, { | ||||||
|       backdrop: 'static', |       backdrop: 'static', | ||||||
|       size: 'xl', |       size: 'xl', | ||||||
|     }) |     }) | ||||||
| @@ -611,7 +611,7 @@ export class SettingsComponent | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   deleteMailRule(rule: PaperlessMailRule) { |   deleteMailRule(rule: PaperlessMailRule) { | ||||||
|     let modal = this.modalService.open(ConfirmDialogComponent, { |     const modal = this.modalService.open(ConfirmDialogComponent, { | ||||||
|       backdrop: 'static', |       backdrop: 'static', | ||||||
|     }) |     }) | ||||||
|     modal.componentInstance.title = $localize`Confirm delete mail rule` |     modal.componentInstance.title = $localize`Confirm delete mail rule` | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon