Skip to content

Commit

Permalink
Update retention days input field in Settings.vue component
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed May 13, 2024
1 parent b782f25 commit a04cc1f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ui/public/i18n/language.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@
"import_old_emails_to_piler_description": "Import old emails to Piler, this process may take a long time",
"always_bcc_is_already_set": "Always BCC is already set in the server, you need to manually remove it (POSTFIX_ALWAYS_BCC)",
"always_bcc_not_set_warning": "Always BCC is not set",
"always_bcc_not_set_description": "Always BCC is not set in the mail server, you could try to configure again piler"
"always_bcc_not_set_description": "Always BCC is not set in the mail server, you could try to configure again piler",
"retention_days": "Retention days",
"retention_days_error": "Retention days must be a number superior to 0",
"placeholder_retention_days": "Type the number of days",
"retention_days_tooltip": "The number of days to keep the emails in the archive"
},
"about": {
"title": "About"
Expand Down
38 changes: 38 additions & 0 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,29 @@
/>
</cv-column>
</cv-row>
<!-- advanced options -->
<cv-accordion ref="accordion" class="maxwidth mg-bottom">
<cv-accordion-item :open="toggleAccordion[0]">
<template slot="title">{{ $t("settings.advanced") }}</template>
<template slot="content">
<NsTextInput
:label="$t('settings.retention_days')"
:placeholder="$t('settings.placeholder_retention_days')"
v-model.trim="retention_days"
:invalid-message="$t(error.retention_days)"
:disabled="loading.getConfiguration || loading.configureModule"
ref="retention_days"
type="number"
tooltipAlignment="start"
tooltipDirection="right"
>
<template slot="tooltip">
{{ $t('settings.retention_days_tooltip')}}
</template>
</NsTextInput>
</template>
</cv-accordion-item>
</cv-accordion>
<cv-row v-if="error.configureModule">
<cv-column>
<NsInlineNotification
Expand Down Expand Up @@ -210,6 +233,7 @@ export default {
is_default_password_auditor: false,
isLetsEncryptEnabled: false,
isHttpToHttpsEnabled: false,
retention_days: "2557",
loading: {
getConfiguration: false,
configureModule: false,
Expand All @@ -223,6 +247,7 @@ export default {
lets_encrypt: "",
http2https: "",
mail_server: "",
retention_days: "",
},
};
},
Expand Down Expand Up @@ -303,6 +328,7 @@ export default {
this.import_email_is_running = config.import_email_is_running;
this.piler_is_running = config.piler_is_running;
this.always_bcc_correctly_set = config.always_bcc_correctly_set;
this.retention_days = config.retention_days.toString();
this.loading.getConfiguration = false;
this.focusElement("host");
},
Expand All @@ -327,6 +353,14 @@ export default {
}
isValidationOk = false;
}
if (this.retention_days < 1) {
this.error.retention_days = "settings.retention_days_error";
if (isValidationOk) {
this.focusElement("retention_days");
}
isValidationOk = false;
}
return isValidationOk;
},
configureModuleValidationFailed(validationErrors) {
Expand Down Expand Up @@ -380,6 +414,7 @@ export default {
mail_server: this.mail_server,
lets_encrypt: this.isLetsEncryptEnabled,
http2https: this.isHttpToHttpsEnabled,
retention_days: parseInt(this.retention_days),
},
extra: {
title: this.$t("settings.instance_configuration", {
Expand Down Expand Up @@ -418,4 +453,7 @@ export default {
.mg-bottom {
margin-bottom: $spacing-06;
}
.maxwidth {
max-width: 38rem;
}
</style>

0 comments on commit a04cc1f

Please sign in to comment.