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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := backupService.ListFiles(req)
|
data := backupService.ListFiles(req)
|
||||||
if err != nil {
|
|
||||||
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ type IBackupService interface {
|
|||||||
BatchDeleteRecord(ids []uint) error
|
BatchDeleteRecord(ids []uint) error
|
||||||
NewClient(backup *model.BackupAccount) (cloud_storage.CloudStorageClient, 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
|
MysqlBackup(db dto.CommonBackup) error
|
||||||
PostgresqlBackup(db dto.CommonBackup) error
|
PostgresqlBackup(db dto.CommonBackup) error
|
||||||
@ -347,14 +347,15 @@ func (u *BackupService) Update(req dto.BackupOperate) error {
|
|||||||
return nil
|
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))
|
backup, err := backupRepo.Get(backupRepo.WithByType(req.Type))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return datas
|
||||||
}
|
}
|
||||||
client, err := u.NewClient(&backup)
|
client, err := u.NewClient(&backup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return datas
|
||||||
}
|
}
|
||||||
prefix := "system_snapshot"
|
prefix := "system_snapshot"
|
||||||
if len(backup.BackupPath) != 0 {
|
if len(backup.BackupPath) != 0 {
|
||||||
@ -362,15 +363,15 @@ func (u *BackupService) ListFiles(req dto.BackupSearchFile) ([]string, error) {
|
|||||||
}
|
}
|
||||||
files, err := client.ListObjects(prefix)
|
files, err := client.ListObjects(prefix)
|
||||||
if err != nil {
|
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 {
|
for _, file := range files {
|
||||||
if len(file) != 0 {
|
if len(file) != 0 {
|
||||||
datas = append(datas, path.Base(file))
|
datas = append(datas, path.Base(file))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return datas, nil
|
return datas
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *BackupService) NewClient(backup *model.BackupAccount) (cloud_storage.CloudStorageClient, error) {
|
func (u *BackupService) NewClient(backup *model.BackupAccount) (cloud_storage.CloudStorageClient, error) {
|
||||||
|
@ -18630,6 +18630,9 @@ const docTemplate = `{
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": true
|
"additionalProperties": true
|
||||||
},
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
@ -18701,6 +18704,9 @@ const docTemplate = `{
|
|||||||
},
|
},
|
||||||
"operate": {
|
"operate": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -18780,6 +18786,9 @@ const docTemplate = `{
|
|||||||
"params": {
|
"params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": true
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -19330,6 +19339,9 @@ const docTemplate = `{
|
|||||||
"params": {
|
"params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": true
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -18623,6 +18623,9 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": true
|
"additionalProperties": true
|
||||||
},
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
@ -18694,6 +18697,9 @@
|
|||||||
},
|
},
|
||||||
"operate": {
|
"operate": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -18773,6 +18779,9 @@
|
|||||||
"params": {
|
"params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": true
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -19323,6 +19332,9 @@
|
|||||||
"params": {
|
"params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": true
|
"additionalProperties": true
|
||||||
|
},
|
||||||
|
"pullImage": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3061,6 +3061,8 @@ definitions:
|
|||||||
params:
|
params:
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
type: object
|
type: object
|
||||||
|
pullImage:
|
||||||
|
type: boolean
|
||||||
services:
|
services:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
@ -3109,6 +3111,8 @@ definitions:
|
|||||||
type: integer
|
type: integer
|
||||||
operate:
|
operate:
|
||||||
type: string
|
type: string
|
||||||
|
pullImage:
|
||||||
|
type: boolean
|
||||||
required:
|
required:
|
||||||
- installId
|
- installId
|
||||||
- operate
|
- operate
|
||||||
@ -3162,6 +3166,8 @@ definitions:
|
|||||||
params:
|
params:
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
type: object
|
type: object
|
||||||
|
pullImage:
|
||||||
|
type: boolean
|
||||||
required:
|
required:
|
||||||
- installId
|
- installId
|
||||||
- params
|
- params
|
||||||
@ -3532,6 +3538,8 @@ definitions:
|
|||||||
params:
|
params:
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
type: object
|
type: object
|
||||||
|
pullImage:
|
||||||
|
type: boolean
|
||||||
type: object
|
type: object
|
||||||
request.NginxAntiLeechUpdate:
|
request.NginxAntiLeechUpdate:
|
||||||
properties:
|
properties:
|
||||||
|
@ -74,7 +74,7 @@ const form = reactive({
|
|||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
from: [Rules.requiredSelect],
|
from: [Rules.requiredSelect],
|
||||||
name: [Rules.requiredSelect],
|
names: [Rules.requiredSelect],
|
||||||
});
|
});
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
@ -139,6 +139,7 @@ const loadBackups = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadFiles = async () => {
|
const loadFiles = async () => {
|
||||||
|
form.names = [];
|
||||||
const res = await getFilesFromBackup(form.from);
|
const res = await getFilesFromBackup(form.from);
|
||||||
fileNames.value = res.data || [];
|
fileNames.value = res.data || [];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user