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

View File

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