mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 20:49:03 +08:00
pref: 优化计划任务备份账号切换逻辑 (#3758)
This commit is contained in:
parent
83dda25591
commit
3804942ae4
@ -81,8 +81,11 @@ func (c localClient) Download(src, target string) (bool, error) {
|
||||
}
|
||||
|
||||
func (c localClient) ListObjects(prefix string) ([]string, error) {
|
||||
itemPath := path.Join(c.dir, prefix)
|
||||
var files []string
|
||||
itemPath := path.Join(c.dir, prefix)
|
||||
if _, err := os.Stat(itemPath); err != nil {
|
||||
return files, nil
|
||||
}
|
||||
if err := filepath.Walk(itemPath, func(path string, info os.FileInfo, err error) error {
|
||||
if !info.IsDir() {
|
||||
files = append(files, info.Name())
|
||||
|
@ -253,7 +253,7 @@
|
||||
multiple
|
||||
class="selectClass"
|
||||
v-model="dialogData.rowData!.backupAccountList"
|
||||
@change="changeAccount(true)"
|
||||
@change="changeAccount"
|
||||
>
|
||||
<div v-for="item in backupOptions" :key="item.label">
|
||||
<el-option :value="item.value" :label="item.label" />
|
||||
@ -523,24 +523,28 @@ const loadBackups = async () => {
|
||||
}
|
||||
backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type });
|
||||
}
|
||||
changeAccount(false);
|
||||
changeAccount();
|
||||
};
|
||||
|
||||
const changeAccount = async (handleChange: boolean) => {
|
||||
const changeAccount = async () => {
|
||||
accountOptions.value = [];
|
||||
let isInAccounts = false;
|
||||
for (const item of backupOptions.value) {
|
||||
let exit = false;
|
||||
let exist = false;
|
||||
for (const ac of dialogData.value.rowData.backupAccountList) {
|
||||
if (item.value == ac) {
|
||||
exit = true;
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (exit) {
|
||||
if (exist) {
|
||||
if (item.value === dialogData.value.rowData.defaultDownload) {
|
||||
isInAccounts = true;
|
||||
}
|
||||
accountOptions.value.push(item);
|
||||
}
|
||||
}
|
||||
if (handleChange) {
|
||||
if (!isInAccounts) {
|
||||
dialogData.value.rowData.defaultDownload = '';
|
||||
}
|
||||
};
|
||||
|
@ -296,18 +296,25 @@ const loadBackups = async () => {
|
||||
|
||||
const changeAccount = async () => {
|
||||
accountOptions.value = [];
|
||||
let isInAccounts = false;
|
||||
for (const item of backupOptions.value) {
|
||||
let exit = false;
|
||||
let exist = false;
|
||||
for (const ac of snapInfo.fromAccounts) {
|
||||
if (item.value == ac) {
|
||||
exit = true;
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (exit) {
|
||||
if (exist) {
|
||||
if (item.value === snapInfo.defaultDownload) {
|
||||
isInAccounts = true;
|
||||
}
|
||||
accountOptions.value.push(item);
|
||||
}
|
||||
}
|
||||
if (!isInAccounts) {
|
||||
snapInfo.defaultDownload = '';
|
||||
}
|
||||
};
|
||||
|
||||
const batchDelete = async (row: Setting.SnapshotInfo | null) => {
|
||||
|
Loading…
Reference in New Issue
Block a user