mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-20 06:18:56 +08:00
feat: Optimize App Update Log Display (#10469)
This commit is contained in:
parent
4ebd4bddee
commit
0433a26a07
3 changed files with 20 additions and 20 deletions
|
|
@ -677,29 +677,29 @@ func upgradeInstall(req request.AppInstallUpgrade) error {
|
||||||
backupFile string
|
backupFile string
|
||||||
)
|
)
|
||||||
backUpApp := func(t *task.Task) error {
|
backUpApp := func(t *task.Task) error {
|
||||||
if req.Backup {
|
backupService := NewIBackupService()
|
||||||
backupService := NewIBackupService()
|
backupRecordService := NewIBackupRecordService()
|
||||||
backupRecordService := NewIBackupRecordService()
|
fileName := fmt.Sprintf("upgrade_backup_%s_%s.tar.gz", install.Name, time.Now().Format(constant.DateTimeSlimLayout)+common.RandStrAndNum(5))
|
||||||
fileName := fmt.Sprintf("upgrade_backup_%s_%s.tar.gz", install.Name, time.Now().Format(constant.DateTimeSlimLayout)+common.RandStrAndNum(5))
|
backupRecord, err := backupService.AppBackup(dto.CommonBackup{Name: install.App.Key, DetailName: install.Name, FileName: fileName})
|
||||||
backupRecord, err := backupService.AppBackup(dto.CommonBackup{Name: install.App.Key, DetailName: install.Name, FileName: fileName})
|
if err == nil {
|
||||||
if err == nil {
|
backups, _ := backupRecordService.ListAppRecords(install.App.Key, install.Name, "upgrade_backup")
|
||||||
backups, _ := backupRecordService.ListAppRecords(install.App.Key, install.Name, "upgrade_backup")
|
if len(backups) > 3 {
|
||||||
if len(backups) > 3 {
|
backupsToDelete := backups[:len(backups)-3]
|
||||||
backupsToDelete := backups[:len(backups)-3]
|
var deleteIDs []uint
|
||||||
var deleteIDs []uint
|
for _, backup := range backupsToDelete {
|
||||||
for _, backup := range backupsToDelete {
|
deleteIDs = append(deleteIDs, backup.ID)
|
||||||
deleteIDs = append(deleteIDs, backup.ID)
|
|
||||||
}
|
|
||||||
_ = backupRecordService.BatchDeleteRecord(deleteIDs)
|
|
||||||
}
|
}
|
||||||
backupFile = path.Join(global.Dir.LocalBackupDir, backupRecord.FileDir, backupRecord.FileName)
|
_ = backupRecordService.BatchDeleteRecord(deleteIDs)
|
||||||
} else {
|
|
||||||
return buserr.WithNameAndErr("ErrAppBackup", install.Name, err)
|
|
||||||
}
|
}
|
||||||
|
backupFile = path.Join(global.Dir.LocalBackupDir, backupRecord.FileDir, backupRecord.FileName)
|
||||||
|
} else {
|
||||||
|
return buserr.WithNameAndErr("ErrAppBackup", install.Name, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
upgradeTask.AddSubTask(task.GetTaskName(install.Name, task.TaskBackup, task.TaskScopeApp), backUpApp, nil)
|
if req.Backup {
|
||||||
|
upgradeTask.AddSubTask(task.GetTaskName(install.Name, task.TaskBackup, task.TaskScopeApp), backUpApp, nil)
|
||||||
|
}
|
||||||
|
|
||||||
upgradeApp := func(t *task.Task) error {
|
upgradeApp := func(t *task.Task) error {
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ func (u *BackupService) AppBackup(req dto.CommonBackup) (*model.BackupRecord, er
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return record, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *BackupService) AppRecover(req dto.CommonRecover) error {
|
func (u *BackupService) AppRecover(req dto.CommonRecover) error {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</template>
|
</template>
|
||||||
<template #leftToolBar>
|
<template #leftToolBar>
|
||||||
<el-button @click="sync" type="primary" plain v-if="mode === 'installed' && data != null">
|
<el-button @click="sync" type="primary" plain v-if="mode === 'installed' && data != null">
|
||||||
{{ $t('commons.button.sync') }}
|
{{ $t('commons.button.refresh') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="openIgnore" type="primary" plain v-if="mode === 'upgrade'">
|
<el-button @click="openIgnore" type="primary" plain v-if="mode === 'upgrade'">
|
||||||
{{ $t('app.showIgnore') }}
|
{{ $t('app.showIgnore') }}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue