From 3846dcef863c966c94e2c35c82811741e9a9be5e Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:39:00 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E5=BF=AB=E7=85=A7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4=20(#3748?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/interface/setting.ts | 1 + .../setting/backup-account/onedrive/index.vue | 3 + .../views/setting/snapshot/import/index.vue | 27 +- frontend/src/views/setting/snapshot/index.vue | 30 +- .../setting/snapshot/snap_status/index.vue | 11 +- .../views/setting/snapshot/status/index.vue | 278 +++++++++--------- 6 files changed, 206 insertions(+), 144 deletions(-) diff --git a/frontend/src/api/interface/setting.ts b/frontend/src/api/interface/setting.ts index 34adcf7b3..c4c2c6de9 100644 --- a/frontend/src/api/interface/setting.ts +++ b/frontend/src/api/interface/setting.ts @@ -108,6 +108,7 @@ export namespace Setting { id: number; name: string; from: string; + defaultDownload: string; description: string; status: string; message: string; diff --git a/frontend/src/views/setting/backup-account/onedrive/index.vue b/frontend/src/views/setting/backup-account/onedrive/index.vue index d0edd6fd9..375fccba5 100644 --- a/frontend/src/views/setting/backup-account/onedrive/index.vue +++ b/frontend/src/views/setting/backup-account/onedrive/index.vue @@ -117,6 +117,9 @@ const rules = reactive({ driveCode: [{ validator: checkDriveCode, required: true, trigger: 'blur' }], }); function checkDriveCode(rule: any, value: any, callback: any) { + if (!value) { + return callback(new Error(i18n.global.t('setting.codeWarning'))); + } const reg = /^[A-Za-z0-9_.-]+$/; if (!reg.test(value)) { return callback(new Error(i18n.global.t('setting.codeWarning'))); diff --git a/frontend/src/views/setting/snapshot/import/index.vue b/frontend/src/views/setting/snapshot/import/index.vue index e74d780e7..c39921efd 100644 --- a/frontend/src/views/setting/snapshot/import/index.vue +++ b/frontend/src/views/setting/snapshot/import/index.vue @@ -19,7 +19,13 @@ - + @@ -58,6 +64,7 @@ const loading = ref(); const formRef = ref(); const backupOptions = ref(); const fileNames = ref(); +const existNames = ref(); const form = reactive({ from: '', @@ -70,8 +77,13 @@ const rules = reactive({ name: [Rules.requiredSelect], }); -const acceptParams = (): void => { +interface DialogProps { + names: Array; +} + +const acceptParams = (params: DialogProps): void => { form.from = ''; + existNames.value = params.names; form.names = [] as Array; loadBackups(); drawerVisible.value = true; @@ -82,6 +94,15 @@ const handleClose = () => { drawerVisible.value = false; }; +const checkDisable = (val: string) => { + for (const item of existNames.value) { + if (val === item + '.tar.gz') { + return true; + } + } + return false; +}; + const submitImport = async (formEl: FormInstance | undefined) => { loading.value = true; if (!formEl) return; @@ -107,7 +128,7 @@ const loadBackups = async () => { loading.value = false; backupOptions.value = []; for (const item of res.data) { - if (item.type !== 'LOCAL' && item.id !== 0) { + if (item.id !== 0) { backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type }); } } diff --git a/frontend/src/views/setting/snapshot/index.vue b/frontend/src/views/setting/snapshot/index.vue index 2cc1781e9..7bf4756a3 100644 --- a/frontend/src/views/setting/snapshot/index.vue +++ b/frontend/src/views/setting/snapshot/index.vue @@ -51,15 +51,18 @@