mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
parent
dca47af92a
commit
f4103e285d
@ -29,7 +29,7 @@ type ICronjobService interface {
|
|||||||
UpdateStatus(id uint, status string) error
|
UpdateStatus(id uint, status string) error
|
||||||
Delete(req dto.CronjobBatchDelete) error
|
Delete(req dto.CronjobBatchDelete) error
|
||||||
Download(down dto.CronjobDownload) (string, error)
|
Download(down dto.CronjobDownload) (string, error)
|
||||||
StartJob(cronjob *model.Cronjob) (string, error)
|
StartJob(cronjob *model.Cronjob, isUpdate bool) (string, error)
|
||||||
CleanRecord(req dto.CronjobClean) error
|
CleanRecord(req dto.CronjobClean) error
|
||||||
|
|
||||||
LoadRecordLog(req dto.OperateByID) string
|
LoadRecordLog(req dto.OperateByID) string
|
||||||
@ -181,7 +181,7 @@ func (u *CronjobService) Create(cronjobDto dto.CronjobCreate) error {
|
|||||||
|
|
||||||
global.LOG.Infof("create cronjob %s successful, spec: %s", cronjob.Name, cronjob.Spec)
|
global.LOG.Infof("create cronjob %s successful, spec: %s", cronjob.Name, cronjob.Spec)
|
||||||
spec := cronjob.Spec
|
spec := cronjob.Spec
|
||||||
entryIDs, err := u.StartJob(&cronjob)
|
entryIDs, err := u.StartJob(&cronjob, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -193,8 +193,8 @@ func (u *CronjobService) Create(cronjobDto dto.CronjobCreate) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *CronjobService) StartJob(cronjob *model.Cronjob) (string, error) {
|
func (u *CronjobService) StartJob(cronjob *model.Cronjob, isUpdate bool) (string, error) {
|
||||||
if len(cronjob.EntryIDs) != 0 {
|
if len(cronjob.EntryIDs) != 0 && isUpdate {
|
||||||
ids := strings.Split(cronjob.EntryIDs, ",")
|
ids := strings.Split(cronjob.EntryIDs, ",")
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
idItem, _ := strconv.Atoi(id)
|
idItem, _ := strconv.Atoi(id)
|
||||||
@ -251,7 +251,7 @@ func (u *CronjobService) Update(id uint, req dto.CronjobUpdate) error {
|
|||||||
cronjob.Type = cronModel.Type
|
cronjob.Type = cronModel.Type
|
||||||
spec := cronjob.Spec
|
spec := cronjob.Spec
|
||||||
if cronModel.Status == constant.StatusEnable {
|
if cronModel.Status == constant.StatusEnable {
|
||||||
newEntryIDs, err := u.StartJob(&cronjob)
|
newEntryIDs, err := u.StartJob(&cronjob, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -294,7 +294,7 @@ func (u *CronjobService) UpdateStatus(id uint, status string) error {
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if status == constant.StatusEnable {
|
if status == constant.StatusEnable {
|
||||||
entryIDs, err = u.StartJob(&cronjob)
|
entryIDs, err = u.StartJob(&cronjob, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ func Run() {
|
|||||||
global.LOG.Errorf("start my cronjob failed, err: %v", err)
|
global.LOG.Errorf("start my cronjob failed, err: %v", err)
|
||||||
}
|
}
|
||||||
for i := 0; i < len(cronJobs); i++ {
|
for i := 0; i < len(cronJobs); i++ {
|
||||||
entryIDs, err := service.NewICronjobService().StartJob(&cronJobs[i])
|
entryIDs, err := service.NewICronjobService().StartJob(&cronJobs[i], false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.LOG.Errorf("start %s job %s failed, err: %v", cronJobs[i].Type, cronJobs[i].Name, err)
|
global.LOG.Errorf("start %s job %s failed, err: %v", cronJobs[i].Type, cronJobs[i].Name, err)
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,7 @@ onMounted(() => {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
:deep(.default-theme h2) {
|
:deep(.default-theme h2) {
|
||||||
|
color: var(--dark-gold-base-color);
|
||||||
margin: 13px, 0;
|
margin: 13px, 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user