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 @@