diff --git a/.gitignore b/.gitignore index 0c5ace70e..72ed4c849 100644 --- a/.gitignore +++ b/.gitignore @@ -16,11 +16,12 @@ build/1panel # Dependency directories (remove the comment below to include it) # vendor/ +/build /pkg/ backend/__debug_bin cmd/server/__debug_bin -cmd/server/web/assets/ +cmd/server/web/assets cmd/server/web/monacoeditorwork -cmd/server/web/favicon.png cmd/server/web/index.html +cmd/server/web/favicon.png frontend/auto-imports.d.ts diff --git a/backend/app/dto/cronjob.go b/backend/app/dto/cronjob.go index 5f3969bc3..8739a8197 100644 --- a/backend/app/dto/cronjob.go +++ b/backend/app/dto/cronjob.go @@ -7,9 +7,9 @@ type CronjobCreate struct { Type string `json:"type" validate:"required"` SpecType string `json:"specType" validate:"required"` Week int `json:"week" validate:"number,max=7,min=1"` - Day int `json:"day" validate:"number,max=31,min=1"` - Hour int `json:"hour" validate:"number,max=23,min=0"` - Minute int `json:"minute" validate:"number,max=59,min=0"` + Day int `json:"day" validate:"number"` + Hour int `json:"hour" validate:"number"` + Minute int `json:"minute" validate:"number"` Script string `json:"script"` Website string `json:"website"` @@ -27,9 +27,9 @@ type CronjobUpdate struct { Name string `json:"name" validate:"required"` SpecType string `json:"specType" validate:"required"` Week int `json:"week" validate:"number,max=7,min=1"` - Day int `json:"day" validate:"number,max=31,min=1"` - Hour int `json:"hour" validate:"number,max=23,min=0"` - Minute int `json:"minute" validate:"number,max=59,min=0"` + Day int `json:"day" validate:"number"` + Hour int `json:"hour" validate:"number"` + Minute int `json:"minute" validate:"number"` Script string `json:"script"` Website string `json:"website"` diff --git a/backend/app/service/cornjob.go b/backend/app/service/cornjob.go index fc9d2d7ee..578f6cf97 100644 --- a/backend/app/service/cornjob.go +++ b/backend/app/service/cornjob.go @@ -177,13 +177,13 @@ func (u *CronjobService) Create(cronjobDto dto.CronjobCreate) error { cronjob.Status = constant.StatusEnable cronjob.Spec = loadSpec(cronjob) - if err := cronjobRepo.Create(&cronjob); err != nil { - return err - } global.LOG.Infof("create cronjob %s successful, spec: %s", cronjob.Name, cronjob.Spec) if err := u.StartJob(&cronjob); err != nil { return err } + if err := cronjobRepo.Create(&cronjob); err != nil { + return err + } return nil } diff --git a/backend/init/router/router.go b/backend/init/router/router.go index 49e43f754..fe0a35aff 100644 --- a/backend/init/router/router.go +++ b/backend/init/router/router.go @@ -1,11 +1,11 @@ package router import ( - "github.com/1Panel-dev/1Panel/backend/global" "html/template" "net/http" v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" + "github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/i18n" "github.com/1Panel-dev/1Panel/backend/middleware" rou "github.com/1Panel-dev/1Panel/backend/router" diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 116e9e014..07b907a4c 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -556,6 +556,7 @@ export default { curl: 'Access URL', taskName: 'Task name', cronSpec: 'Lifecycle', + cronSpecHelper: 'Enter the correct execution period', directory: 'Backup directory', sourceDir: 'Backup directory', exclusionRules: 'Exclusive rule', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 6482e3af8..f0d50d4f0 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -564,6 +564,7 @@ export default { curl: '访问 URL', taskName: '任务名称', cronSpec: '执行周期', + cronSpecHelper: '请输入正确的执行周期', directory: '备份目录', sourceDir: '备份目录', exclusionRules: '排除规则', diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue index 98167223f..f020a85ff 100644 --- a/frontend/src/views/cronjob/operate/index.vue +++ b/frontend/src/views/cronjob/operate/index.vue @@ -159,7 +159,7 @@