1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

fix: 解决快照上传失败的问题 (#2270)

This commit is contained in:
ssongliu 2023-09-13 14:08:16 +08:00 committed by GitHub
parent 9837c60a88
commit 47cfa0c730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -194,7 +194,8 @@ func snapUpload(snap snapHelper, account string, file string) {
_ = snapshotRepo.UpdateStatus(snap.Status.ID, map[string]interface{}{"upload": err.Error()}) _ = snapshotRepo.UpdateStatus(snap.Status.ID, map[string]interface{}{"upload": err.Error()})
return return
} }
target := path.Join(backup.BackupPath, "system_snapshot", path.Base(file)) target := path.Join(strings.TrimPrefix(backup.BackupPath, "/"), "system_snapshot", path.Base(file))
global.LOG.Debugf("start upload snapshot to %s, dir: %s", backup.Type, target)
if _, err := client.Upload(source, target); err != nil { if _, err := client.Upload(source, target); err != nil {
snap.Status.Upload = err.Error() snap.Status.Upload = err.Error()
_ = snapshotRepo.UpdateStatus(snap.Status.ID, map[string]interface{}{"upload": err.Error()}) _ = snapshotRepo.UpdateStatus(snap.Status.ID, map[string]interface{}{"upload": err.Error()})

View File

@ -1,10 +1,10 @@
<template> <template>
<div v-loading="loading"> <div>
<el-drawer v-model="drawerVisiable" size="30%"> <el-drawer v-model="drawerVisiable" size="30%">
<template #header> <template #header>
<DrawerHeader :header="$t('setting.importSnapshot')" :back="handleClose" /> <DrawerHeader :header="$t('setting.importSnapshot')" :back="handleClose" />
</template> </template>
<el-form ref="formRef" label-position="top" :model="form" :rules="rules"> <el-form ref="formRef" label-position="top" :model="form" :rules="rules" v-loading="loading">
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="22"> <el-col :span="22">
<el-form-item :label="$t('setting.backupAccount')" prop="from"> <el-form-item :label="$t('setting.backupAccount')" prop="from">
@ -101,13 +101,20 @@ const submitImport = async (formEl: FormInstance | undefined) => {
}; };
const loadBackups = async () => { const loadBackups = async () => {
const res = await getBackupList(); loading.value = true;
backupOptions.value = []; await getBackupList()
for (const item of res.data) { .then((res) => {
if (item.type !== 'LOCAL' && item.id !== 0) { loading.value = false;
backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type }); backupOptions.value = [];
} for (const item of res.data) {
} if (item.type !== 'LOCAL' && item.id !== 0) {
backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type });
}
}
})
.catch(() => {
loading.value = false;
});
}; };
const loadFiles = async () => { const loadFiles = async () => {