mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
pref: 优化同步快照返回信息 (#3773)
This commit is contained in:
parent
6aa9a95971
commit
a4cfb587d6
@ -302,12 +302,7 @@ func (b *BaseApi) LoadFilesFromBackup(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := backupService.ListFiles(req)
|
||||
if err != nil {
|
||||
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
||||
return
|
||||
}
|
||||
|
||||
data := backupService.ListFiles(req)
|
||||
helper.SuccessWithData(c, data)
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ type IBackupService interface {
|
||||
BatchDeleteRecord(ids []uint) error
|
||||
NewClient(backup *model.BackupAccount) (cloud_storage.CloudStorageClient, error)
|
||||
|
||||
ListFiles(req dto.BackupSearchFile) ([]string, error)
|
||||
ListFiles(req dto.BackupSearchFile) []string
|
||||
|
||||
MysqlBackup(db dto.CommonBackup) error
|
||||
PostgresqlBackup(db dto.CommonBackup) error
|
||||
@ -347,14 +347,15 @@ func (u *BackupService) Update(req dto.BackupOperate) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u *BackupService) ListFiles(req dto.BackupSearchFile) ([]string, error) {
|
||||
func (u *BackupService) ListFiles(req dto.BackupSearchFile) []string {
|
||||
var datas []string
|
||||
backup, err := backupRepo.Get(backupRepo.WithByType(req.Type))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return datas
|
||||
}
|
||||
client, err := u.NewClient(&backup)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return datas
|
||||
}
|
||||
prefix := "system_snapshot"
|
||||
if len(backup.BackupPath) != 0 {
|
||||
@ -362,15 +363,15 @@ func (u *BackupService) ListFiles(req dto.BackupSearchFile) ([]string, error) {
|
||||
}
|
||||
files, err := client.ListObjects(prefix)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
global.LOG.Debugf("load files from %s failed, err: %v", req.Type, err)
|
||||
return datas
|
||||
}
|
||||
var datas []string
|
||||
for _, file := range files {
|
||||
if len(file) != 0 {
|
||||
datas = append(datas, path.Base(file))
|
||||
}
|
||||
}
|
||||
return datas, nil
|
||||
return datas
|
||||
}
|
||||
|
||||
func (u *BackupService) NewClient(backup *model.BackupAccount) (cloud_storage.CloudStorageClient, error) {
|
||||
|
@ -18630,6 +18630,9 @@ const docTemplate = `{
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"services": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
@ -18701,6 +18704,9 @@ const docTemplate = `{
|
||||
},
|
||||
"operate": {
|
||||
"type": "string"
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -18780,6 +18786,9 @@ const docTemplate = `{
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -19330,6 +19339,9 @@ const docTemplate = `{
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -18623,6 +18623,9 @@
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"services": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
@ -18694,6 +18697,9 @@
|
||||
},
|
||||
"operate": {
|
||||
"type": "string"
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -18773,6 +18779,9 @@
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -19323,6 +19332,9 @@
|
||||
"params": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"pullImage": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -3061,6 +3061,8 @@ definitions:
|
||||
params:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
pullImage:
|
||||
type: boolean
|
||||
services:
|
||||
additionalProperties:
|
||||
type: string
|
||||
@ -3109,6 +3111,8 @@ definitions:
|
||||
type: integer
|
||||
operate:
|
||||
type: string
|
||||
pullImage:
|
||||
type: boolean
|
||||
required:
|
||||
- installId
|
||||
- operate
|
||||
@ -3162,6 +3166,8 @@ definitions:
|
||||
params:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
pullImage:
|
||||
type: boolean
|
||||
required:
|
||||
- installId
|
||||
- params
|
||||
@ -3532,6 +3538,8 @@ definitions:
|
||||
params:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
pullImage:
|
||||
type: boolean
|
||||
type: object
|
||||
request.NginxAntiLeechUpdate:
|
||||
properties:
|
||||
|
@ -74,7 +74,7 @@ const form = reactive({
|
||||
|
||||
const rules = reactive({
|
||||
from: [Rules.requiredSelect],
|
||||
name: [Rules.requiredSelect],
|
||||
names: [Rules.requiredSelect],
|
||||
});
|
||||
|
||||
interface DialogProps {
|
||||
@ -139,6 +139,7 @@ const loadBackups = async () => {
|
||||
};
|
||||
|
||||
const loadFiles = async () => {
|
||||
form.names = [];
|
||||
const res = await getFilesFromBackup(form.from);
|
||||
fileNames.value = res.data || [];
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user