Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

fix edit dialog getters

Michael Shamoon7ace66d7fd9f
diff --git a/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts
index 98c897c89..b2edb9219 100644
--- a/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts
+++ b/src-ui/src/app/components/common/edit-dialog/mail-account-edit-dialog/mail-account-edit-dialog.component.ts
@@ -8,6 +8,12 @@ import {
} from 'src/app/data/paperless-mail-account'
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({
selector: 'app-mail-account-edit-dialog',
templateUrl: './mail-account-edit-dialog.component.html',
@@ -39,10 +45,6 @@ export class MailAccountEditDialogComponent extends EditDialogComponent<Paperles
}
get imapSecurityOptions() {
- return [
- { id: IMAPSecurity.None, name: $localize`No encryption` },
- { id: IMAPSecurity.SSL, name: $localize`SSL` },
- { id: IMAPSecurity.STARTTLS, name: $localize`STARTTLS` },
- ]
+ return IMAP_SECURITY_OPTIONS
}
}
diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html
index dc4260ffd..ef9a5bc47 100644
--- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html
+++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.html
@@ -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>
</div>
<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-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>
diff --git a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts
index 7644ed353..3dcd7ce01 100644
--- a/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts
+++ b/src-ui/src/app/components/common/edit-dialog/mail-rule-edit-dialog/mail-rule-edit-dialog.component.ts
@@ -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 { 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({
selector: 'app-mail-rule-edit-dialog',
templateUrl: './mail-rule-edit-dialog.component.html',
@@ -92,74 +156,18 @@ export class MailRuleEditDialogComponent extends EditDialogComponent<PaperlessMa
}
get attachmentTypeOptions() {
- return [
- {
- id: MailFilterAttachmentType.Attachments,
- name: $localize`Only process attachments.`,
- },
- {
- id: MailFilterAttachmentType.Everything,
- name: $localize`Process all files, including 'inline' attachments.`,
- },
- ]
+ return ATTACHMENT_TYPE_OPTIONS
}
get actionOptions() {
- return [
- {
- 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`,
- },
- ]
+ return ACTION_OPTIONS
}
get metadataTitleOptions() {
- return [
- {
- id: MailMetadataTitleOption.FromSubject,
- name: $localize`Use subject as title`,
- },
- {
- id: MailMetadataTitleOption.FromFilename,
- name: $localize`Use attachment filename as title`,
- },
- ]
+ return METADATA_TITLE_OPTIONS
}
get metadataCorrespondentOptions() {
- return [
- {
- 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`,
- },
- ]
+ return METADATA_CORRESPONDENT_OPTIONS
}
}
diff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.ts
index b461e90b7..1c51c90b2 100644
--- a/src-ui/src/app/components/manage/settings/settings.component.ts
+++ b/src-ui/src/app/components/manage/settings/settings.component.ts
@@ -524,7 +524,7 @@ export class SettingsComponent
}
editMailAccount(account: PaperlessMailAccount) {
- var modal = this.modalService.open(MailAccountEditDialogComponent, {
+ const modal = this.modalService.open(MailAccountEditDialogComponent, {
backdrop: 'static',
size: 'xl',
})
@@ -552,7 +552,7 @@ export class SettingsComponent
}
deleteMailAccount(account: PaperlessMailAccount) {
- let modal = this.modalService.open(ConfirmDialogComponent, {
+ const modal = this.modalService.open(ConfirmDialogComponent, {
backdrop: 'static',
})
modal.componentInstance.title = $localize`Confirm delete mail account`
@@ -582,7 +582,7 @@ export class SettingsComponent
}
editMailRule(rule: PaperlessMailRule) {
- var modal = this.modalService.open(MailRuleEditDialogComponent, {
+ const modal = this.modalService.open(MailRuleEditDialogComponent, {
backdrop: 'static',
size: 'xl',
})
@@ -611,7 +611,7 @@ export class SettingsComponent
}
deleteMailRule(rule: PaperlessMailRule) {
- let modal = this.modalService.open(ConfirmDialogComponent, {
+ const modal = this.modalService.open(ConfirmDialogComponent, {
backdrop: 'static',
})
modal.componentInstance.title = $localize`Confirm delete mail rule`