From df2a7057130da8d51db997a302ffd4d902ae0549 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:24:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=BF=AB=E7=85=A7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A4=87=E4=BB=BD=E8=B7=AF=E5=BE=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=20(#3696)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/setting.go | 17 ++++++------ backend/app/service/cronjob_backup.go | 3 ++- backend/init/migration/migrations/v_1_9.go | 2 +- frontend/src/views/cronjob/index.vue | 10 +++---- frontend/src/views/setting/snapshot/index.vue | 27 ++++++++++++++++--- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/backend/app/dto/setting.go b/backend/app/dto/setting.go index 7be17a5d9..bab7242ce 100644 --- a/backend/app/dto/setting.go +++ b/backend/app/dto/setting.go @@ -115,14 +115,15 @@ type SnapshotImport struct { Description string `json:"description" validate:"max=256"` } type SnapshotInfo struct { - ID uint `json:"id"` - Name string `json:"name"` - Description string `json:"description" validate:"max=256"` - From string `json:"from"` - Status string `json:"status"` - Message string `json:"message"` - CreatedAt time.Time `json:"createdAt"` - Version string `json:"version"` + ID uint `json:"id"` + Name string `json:"name"` + Description string `json:"description" validate:"max=256"` + From string `json:"from"` + DefaultDownload string `json:"defaultDownload"` + Status string `json:"status"` + Message string `json:"message"` + CreatedAt time.Time `json:"createdAt"` + Version string `json:"version"` InterruptStep string `json:"interruptStep"` RecoverStatus string `json:"recoverStatus"` diff --git a/backend/app/service/cronjob_backup.go b/backend/app/service/cronjob_backup.go index 61fea19b6..1c56893f7 100644 --- a/backend/app/service/cronjob_backup.go +++ b/backend/app/service/cronjob_backup.go @@ -208,7 +208,8 @@ func (u *CronjobService) handleSnapshot(cronjob model.Cronjob, startTime time.Ti record.FileDir = "system_snapshot" req := dto.SnapshotCreate{ - From: record.BackupType, + From: record.BackupType, + DefaultDownload: cronjob.DefaultDownload, } name, err := NewISnapshotService().HandleSnapshot(true, logPath, req, startTime.Format("20060102150405")) if err != nil { diff --git a/backend/init/migration/migrations/v_1_9.go b/backend/init/migration/migrations/v_1_9.go index 65f70932e..5a767039e 100644 --- a/backend/init/migration/migrations/v_1_9.go +++ b/backend/init/migration/migrations/v_1_9.go @@ -281,7 +281,7 @@ var UpdateCronjobSpec = &gormigrate.Migration{ mapAccount[item.ID] = item.Type } for _, job := range jobs { - if job.KeepLocal { + if job.KeepLocal && mapAccount[uint(job.TargetDirID)] != constant.Local { if err := tx.Model(&model.Cronjob{}). Where("id = ?", job.ID). Updates(map[string]interface{}{ diff --git a/frontend/src/views/cronjob/index.vue b/frontend/src/views/cronjob/index.vue index 82c58875b..abee476a4 100644 --- a/frontend/src/views/cronjob/index.vue +++ b/frontend/src/views/cronjob/index.vue @@ -83,7 +83,7 @@