This commit is contained in:
2020-07-22 18:31:30 +00:00
parent 610f26acc6
commit c95ae9b20b

View File

@@ -1,49 +1,168 @@
<template>
<v-row v-if="formState.ready">
<v-col>
<v-form ref="form">
<v-row>
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
</v-row>
<v-row justify="center">
<v-dialog v-model="testDialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">{{ $ay.t("TestSMTPSettings") }}</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="testAddress"
:label="$ay.t('testToAddress')"
required
hint="test_send_to@example.com"
></v-text-field>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="testDialog = false">{{
$ay.t("Cancel")
}}</v-btn>
<v-btn
color="blue darken-1"
text
@click="testConfiguration()"
:disabled="!testAddress"
>{{ $ay.t("OK") }}</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</v-form>
</v-col>
</v-row>
<v-container fluid>
<v-row justify="center">
<v-dialog v-model="testDialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">{{ $ay.t("TestSMTPSettings") }}</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="testAddress"
:label="$ay.t('TestToAddress')"
required
hint="test_send_to@example.com"
></v-text-field>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="testDialog = false">{{
$ay.t("Cancel")
}}</v-btn>
<v-btn
color="blue darken-1"
text
@click="testConfiguration()"
:disabled="!testAddress"
>{{ $ay.t("OK") }}</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
<v-row v-if="formState.ready">
<v-col>
<v-form ref="form">
<v-row>
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
v-model="obj.smtpDeliveryActive"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:label="$ay.t('SmtpDeliveryActive')"
:persistent-hint="true"
ref="smtpDeliveryActive"
:error-messages="
form().serverErrors(this, 'smtpDeliveryActive')
"
@change="fieldValueChanged('smtpDeliveryActive')"
></v-checkbox>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.smtpServerAddress"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:clearable="!formState.readOnly"
@click:clear="fieldValueChanged('smtpServerAddress')"
:label="$ay.t('SmtpServerAddress')"
:rules="[form().required(this, 'smtpServerAddress')]"
:error-messages="form().serverErrors(this, 'smtpServerAddress')"
ref="smtpServerAddress"
:data-cy="!!$ay.dev ? 'smtpServerAddress' : false"
@input="fieldValueChanged('smtpServerAddress')"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.smtpAccount"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:clearable="!formState.readOnly"
@click:clear="fieldValueChanged('smtpAccount')"
:label="$ay.t('SmtpAccount')"
:rules="[form().required(this, 'smtpAccount')]"
:error-messages="form().serverErrors(this, 'smtpAccount')"
ref="smtpAccount"
:data-cy="!!$ay.dev ? 'smtpAccount' : false"
@input="fieldValueChanged('smtpAccount')"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.smtpPassword"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:clearable="!formState.readOnly"
@click:clear="fieldValueChanged('smtpPassword')"
:label="$ay.t('SmtpPassword')"
:rules="[form().required(this, 'smtpPassword')]"
:error-messages="form().serverErrors(this, 'smtpPassword')"
ref="smtpPassword"
:data-cy="!!$ay.dev ? 'smtpPassword' : false"
@input="fieldValueChanged('smtpPassword')"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-select
v-model="obj.connectionSecurity"
:items="selectLists.NotifyMailSecurity"
item-text="name"
item-value="id"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:label="$ay.t('ConnectionSecurity')"
ref="connectionSecurity"
:data-cy="!!$ay.dev ? 'connectionSecurity' : false"
:rules="[
form().integerValid(this, 'connectionSecurity'),
form().required(this, 'connectionSecurity')
]"
:error-messages="
form().serverErrors(this, 'connectionSecurity')
"
@input="fieldValueChanged('connectionSecurity')"
></v-select>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.smtpServerPort"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:clearable="!formState.readOnly"
@click:clear="fieldValueChanged('smtpServerPort')"
:label="$ay.t('SmtpServerPort')"
:rules="[
form().integerValid(this, 'smtpServerPort'),
form().required(this, 'smtpServerPort')
]"
:error-messages="form().serverErrors(this, 'smtpServerPort')"
ref="smtpServerPort"
:data-cy="!!$ay.dev ? 'smtpServerPort' : false"
@input="fieldValueChanged('smtpServerPort')"
type="number"
></v-text-field>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field
v-model="obj.notifyFromAddress"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:clearable="!formState.readOnly"
@click:clear="fieldValueChanged('notifyFromAddress')"
:label="$ay.t('NotifyFromAddress')"
:rules="[form().required(this, 'notifyFromAddress')]"
:error-messages="form().serverErrors(this, 'notifyFromAddress')"
ref="notifyFromAddress"
:data-cy="!!$ay.dev ? 'notifyFromAddress' : false"
@input="fieldValueChanged('notifyFromAddress')"
></v-text-field>
</v-col>
</v-row>
</v-form>
</v-col>
</v-row>
</v-container>
</template>
<script>
@@ -121,17 +240,19 @@ namespace AyaNova.Models
return {
testAddress: null,
testDialog: false,
formCustomTemplateKey: null,
selectLists: {
NotifyMailSecurity: []
},
obj: {
id: 1,
concurrency: 0,
SmtpDeliveryActive: null,
SmtpServerAddress: null,
SmtpAccount: null,
SmtpPassword: null,
ConnectionSecurity: null,
SmtpServerPort: null,
NotifyFromAddress: null
smtpDeliveryActive: null,
smtpServerAddress: null,
smtpAccount: null,
smtpPassword: null,
connectionSecurity: null,
smtpServerPort: null,
notifyFromAddress: null
},
formState: {
ready: false,
@@ -330,6 +451,7 @@ function generateMenu(vm) {
//
async function initForm(vm) {
await fetchTranslatedText(vm);
await populateSelectionLists(vm);
}
//////////////////////////////////////////////////////////
@@ -337,19 +459,27 @@ async function initForm(vm) {
//
async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([
"BackupSettings",
"BackupTime",
"BackupLast",
"BackupSetsToKeep",
"BackupAttachments",
"BackupFiles",
"BackupNow",
"AreYouSureBackupNow",
"FileName",
"FileSize",
"FileDate",
"AvailableSpace"
"TestSMTPSettings",
"TestToAddress",
"SmtpDeliveryActive",
"SmtpServerAddress",
"SmtpAccount",
"SmtpPassword",
"ConnectionSecurity",
"SmtpServerPort",
"NotifyFromAddress"
]);
}
//////////////////////
//
//
async function populateSelectionLists(vm) {
await window.$gz.enums.fetchEnumList("NotifyMailSecurity"); //prefetch
//populate
vm.selectLists.NotifyMailSecurity = window.$gz.enums.getSelectionList(
"NotifyMailSecurity"
);
}
</script>