Allow to track email server location change
This commit is contained in:
@@ -2,52 +2,22 @@
|
||||
<script setup>
|
||||
|
||||
import { ref, onMounted, useTemplateRef, computed } from 'vue';
|
||||
import { Button, ProgressBar, InputDialog, Dialog, FormGroup, TextInput, InputGroup, Switch, SingleSelect } from 'pankow';
|
||||
import { Button, InputDialog, Dialog, FormGroup, Switch } from 'pankow';
|
||||
import { prettyDecimalSize } from 'pankow/utils';
|
||||
import Section from '../components/Section.vue';
|
||||
import SettingsItem from '../components/SettingsItem.vue';
|
||||
import MailServerLocation from '../components/MailServerLocation.vue';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
import MailModel from '../models/MailModel.js';
|
||||
import TasksModel from '../models/TasksModel.js';
|
||||
import ServicesModel from '../models/ServicesModel.js';
|
||||
|
||||
const domainsModel = DomainsModel.create();
|
||||
const mailModel = MailModel.create();
|
||||
const tasksModel = TasksModel.create();
|
||||
const servicesModel = ServicesModel.create();
|
||||
|
||||
const inputDialog = useTemplateRef('inputDialog');
|
||||
const domains = ref([]);
|
||||
|
||||
const currentLocationSubdomain = ref('');
|
||||
const currentLocationDomain = ref('');
|
||||
const locationSubdomain = ref('');
|
||||
const locationDomain = ref('');
|
||||
const locationChangeBusy = ref(false);
|
||||
const locationChangeMessage = ref('');
|
||||
const locationChangeProgress = ref(0);
|
||||
|
||||
async function onChangeMailDomain() {
|
||||
locationChangeBusy.value = true;
|
||||
locationChangeMessage.value = '';
|
||||
locationChangeProgress.value = 0;
|
||||
|
||||
const [error, result] = await mailModel.setLocation(locationSubdomain.value, locationDomain.value);
|
||||
if (error) return console.error(error);
|
||||
|
||||
await tasksModel.wait(result, (result) => {
|
||||
locationChangeMessage.value = result.message;
|
||||
locationChangeProgress.value = result.percent;
|
||||
});
|
||||
|
||||
currentLocationDomain.value = locationDomain.value;
|
||||
currentLocationSubdomain.value = locationSubdomain.value;
|
||||
locationChangeBusy.value = false;
|
||||
locationChangeMessage.value = '';
|
||||
locationChangeProgress.value = 0;
|
||||
}
|
||||
|
||||
|
||||
const maxEmailSizeBusy = ref(false);
|
||||
const maxEmailSize = ref(0);
|
||||
const currentMaxEmailSize = ref(0);
|
||||
@@ -189,13 +159,6 @@ onMounted(async () => {
|
||||
|
||||
domains.value = result;
|
||||
|
||||
[error, result] = await mailModel.location();
|
||||
if (error) return console.error(error);
|
||||
locationDomain.value = result.domain;
|
||||
locationSubdomain.value = result.subdomain;
|
||||
currentLocationDomain.value = result.domain;
|
||||
currentLocationSubdomain.value = result.subdomain;
|
||||
|
||||
[error, result] = await mailModel.mailboxSharing();
|
||||
if (error) return console.error(error);
|
||||
mailboxSharingEnabled.value = result;
|
||||
@@ -290,24 +253,6 @@ onMounted(async () => {
|
||||
</Dialog>
|
||||
|
||||
<Section :title="$t('emails.settings.title')" :padding="false">
|
||||
<SettingsItem wrap>
|
||||
<FormGroup style="flex-grow: 1;">
|
||||
<label>{{ $t('emails.settings.location') }}</label>
|
||||
<div v-html="$t('emails.changeDomainDialog.description')"></div>
|
||||
</FormGroup>
|
||||
<div style="display: flex; gap: 6px; align-items: center; flex-wrap: wrap;">
|
||||
<InputGroup>
|
||||
<TextInput v-model="locationSubdomain" :disabled="locationChangeBusy"/>
|
||||
<SingleSelect v-model="locationDomain" :options="domains" option-key="domain" option-label="domain" :disabled="locationChangeBusy"/>
|
||||
</InputGroup>
|
||||
<Button tool @click="onChangeMailDomain()" :plain="(currentLocationSubdomain !== locationSubdomain || currentLocationDomain !== locationDomain) ? null : true" :disabled="locationChangeBusy || (currentLocationSubdomain === locationSubdomain && currentLocationDomain === locationDomain)">{{ $t('main.dialog.save') }}</Button>
|
||||
</div>
|
||||
<template #bottom v-if="locationChangeProgress">
|
||||
<ProgressBar :value="locationChangeProgress"/>
|
||||
<div style="padding-top: 6px">{{ locationChangeMessage }}</div>
|
||||
</template>
|
||||
</SettingsItem>
|
||||
|
||||
<SettingsItem>
|
||||
<FormGroup>
|
||||
<label>{{ $t('emails.mailboxSharing.title') }}</label>
|
||||
@@ -363,7 +308,8 @@ onMounted(async () => {
|
||||
<Button tool plain @click="onShowSpamFilterDialog()">{{ $t('main.dialog.edit') }}</Button>
|
||||
</div>
|
||||
</SettingsItem>
|
||||
|
||||
</Section>
|
||||
|
||||
<MailServerLocation />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user