This commit is contained in:
2020-07-22 15:30:56 +00:00
parent da691f9798
commit 610f26acc6

View File

@@ -4,95 +4,42 @@
<v-form ref="form"> <v-form ref="form">
<v-row> <v-row>
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error> <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
</v-row>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-row justify="center">
<v-checkbox <v-dialog v-model="testDialog" persistent max-width="600px">
v-model="obj.active" <v-card>
:readonly="formState.readOnly" <v-card-title>
:disabled="formState.readOnly" <span class="headline">{{ $ay.t("TestSMTPSettings") }}</span>
:label="$ay.t('Active')" </v-card-title>
ref="active" <v-card-text>
:error-messages="form().serverErrors(this, 'active')" <v-container>
@change="fieldValueChanged('active')" <v-row>
></v-checkbox> <v-col cols="12">
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-time-picker
:label="$ay.t('BackupTime')"
:rules="[form().required(this, 'backupTime')]"
:error-messages="form().serverErrors(this, 'backupTime')"
v-model="obj.backupTime"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
ref="backupTime"
@input="fieldValueChanged('backupTime')"
></gz-time-picker>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
v-model="obj.backupAttachments"
:readonly="formState.readOnly"
:disabled="formState.readOnly"
:label="$ay.t('BackupAttachments')"
ref="backupAttachments"
:error-messages="form().serverErrors(this, 'backupAttachments')"
@change="fieldValueChanged('backupAttachments')"
></v-checkbox>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
<v-text-field <v-text-field
v-model="obj.backupSetsToKeep" v-model="testAddress"
:readonly="formState.readOnly" :label="$ay.t('testToAddress')"
:disabled="formState.readOnly" required
:label="$ay.t('BackupSetsToKeep')" hint="test_send_to@example.com"
ref="backupSetsToKeep"
:rules="[form().integerValid(this, 'backupSetsToKeep')]"
:error-messages="form().serverErrors(this, 'backupSetsToKeep')"
@input="fieldValueChanged('backupSetsToKeep')"
type="number"
></v-text-field> ></v-text-field>
</v-col> </v-col>
</v-row> </v-row>
<v-row> </v-container>
<v-col cols="12" class="mt-6"> </v-card-text>
<v-col cols="12" lg="4"> <v-card-actions>
<span class="title">{{ $ay.t("BackupFiles") }}</span> <v-spacer></v-spacer>
<v-btn @click="getBackupStatus" class="ml-3"> <v-btn color="blue darken-1" text @click="testDialog = false">{{
<v-icon>fa-sync</v-icon> $ay.t("Cancel")
</v-btn> }}</v-btn>
<v-btn
<v-simple-table> color="blue darken-1"
<template v-slot:default> text
<thead> @click="testConfiguration()"
<tr> :disabled="!testAddress"
<th class="text-left">{{ $ay.t("FileName") }}</th> >{{ $ay.t("OK") }}</v-btn
<th class="text-left">{{ $ay.t("FileDate") }}</th> >
<th class="text-left">{{ $ay.t("FileSize") }}</th> </v-card-actions>
</tr> </v-card>
</thead> </v-dialog>
<tbody>
<tr v-for="item in backupFileList" :key="item.id">
<td>
<template v-if="!formState.readOnly">
<a :href="item.url">{{ item.name }}</a>
</template>
<template v-else>
{{ item.name }}
</template>
</td>
<td>{{ item.created }}</td>
<td>{{ item.length }}</td>
</tr>
</tbody>
</template>
</v-simple-table>
<div class="mt-6">
({{ $ay.t("AvailableSpace") }}&nbsp;{{ backupAvailableSpace }})
</div>
</v-col>
</v-col>
</v-row> </v-row>
</v-form> </v-form>
</v-col> </v-col>
@@ -117,7 +64,6 @@ export default {
vm.formState.ready = true; vm.formState.ready = true;
window.$gz.eventBus.$on("menu-click", clickHandler); window.$gz.eventBus.$on("menu-click", clickHandler);
await vm.getDataFromApi(); await vm.getDataFromApi();
vm.getBackupStatus();
} catch (err) { } catch (err) {
vm.formState.ready = true; vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err, vm); window.$gz.errorHandler.handleFormError(err, vm);
@@ -173,9 +119,9 @@ namespace AyaNova.Models
*/ */
return { return {
testAddress: null,
testDialog: false,
formCustomTemplateKey: null, formCustomTemplateKey: null,
backupFileList: [],
backupAvailableSpace: null,
obj: { obj: {
id: 1, id: 1,
concurrency: 0, concurrency: 0,
@@ -300,7 +246,7 @@ namespace AyaNova.Models
async testConfiguration() { async testConfiguration() {
let vm = this; let vm = this;
vm.formState.loading = true; vm.formState.loading = true;
let url = "global-ops-notification-setting/test"; let url = `global-ops-notification-setting/test-smtp-settings/${vm.testAddress}`;
window.$gz.form.deleteAllErrorBoxErrors(vm); window.$gz.form.deleteAllErrorBoxErrors(vm);
try { try {
let res = await window.$gz.api.upsert(url, {}); let res = await window.$gz.api.upsert(url, {});
@@ -330,15 +276,8 @@ async function clickHandler(menuItem) {
case "save": case "save":
m.vm.submit(); m.vm.submit();
break; break;
case "backupnow": case "test":
if ( m.vm.testDialog = true;
(await window.$gz.dialog.confirmGeneric(
"AreYouSureBackupNow",
"warning"
)) === true
) {
m.vm.backupNow();
}
break; break;
default: default:
window.$gz.eventBus.$emit( window.$gz.eventBus.$emit(
@@ -375,10 +314,10 @@ function generateMenu(vm) {
}); });
menuOptions.menuItems.push({ menuOptions.menuItems.push({
title: "BackupNow", title: "TestSMTPSettings",
icon: "fa-file-archive", icon: "fa-vial",
surface: false, surface: false,
key: FORM_KEY + ":backupnow", key: FORM_KEY + ":test",
vm: vm vm: vm
}); });
} }