From 02023102d3dc2065e40c2ad0e4ae174c43d759e2 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 12 Jun 2023 18:42:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E5=91=A8=E6=9C=9F=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=20(#1349)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/dto/cronjob.go | 4 ++-- frontend/src/lang/modules/en.ts | 6 ++++-- frontend/src/lang/modules/zh.ts | 4 ++-- frontend/src/views/cronjob/operate/index.vue | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/app/dto/cronjob.go b/backend/app/dto/cronjob.go index e94c3c4f5..d016e41bb 100644 --- a/backend/app/dto/cronjob.go +++ b/backend/app/dto/cronjob.go @@ -6,7 +6,7 @@ type CronjobCreate struct { Name string `json:"name" validate:"required"` Type string `json:"type" validate:"required"` SpecType string `json:"specType" validate:"required"` - Week int `json:"week" validate:"number,max=7,min=1"` + Week int `json:"week" validate:"number,max=6,min=0"` Day int `json:"day" validate:"number"` Hour int `json:"hour" validate:"number"` Minute int `json:"minute" validate:"number"` @@ -27,7 +27,7 @@ type CronjobUpdate struct { ID uint `json:"id" validate:"required"` Name string `json:"name" validate:"required"` SpecType string `json:"specType" validate:"required"` - Week int `json:"week" validate:"number,max=7,min=1"` + Week int `json:"week" validate:"number,max=6,min=0"` Day int `json:"day" validate:"number"` Hour int `json:"hour" validate:"number"` Minute int `json:"minute" validate:"number"` diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 711548ef5..1fac7bc12 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -632,8 +632,10 @@ const message = { cronjob: { cronTask: 'Task', changeStatus: 'Change status', - disableMsg: 'The cronjob cannot continue to run after it is stopped. Do you want to stop it?', - enableMsg: 'The cronjob has been stopped. Enable now?', + disableMsg: + 'Stopping the scheduled task will result in the task no longer automatically executing. Do you want to continue?', + enableMsg: + 'Enabling the scheduled task will allow the task to automatically execute on a regular basis. Do you want to continue?', taskType: 'Task type', record: 'Records', shell: 'Shell script', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index f30468cd8..d5bbbb715 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -633,8 +633,8 @@ const message = { cronjob: { cronTask: '计划任务', changeStatus: '状态修改', - disableMsg: '计划任务停止后将无法继续运行,是否停止?', - enableMsg: '该计划任务已停止,是否启用?', + disableMsg: '停止计划任务会导致该任务不再自动执行。是否继续?', + enableMsg: '启用计划任务会让该任务定期自动执行。是否继续?', taskType: '任务类型', record: '报告', shell: 'Shell 脚本', diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue index e1d095fa0..35a049c55 100644 --- a/frontend/src/views/cronjob/operate/index.vue +++ b/frontend/src/views/cronjob/operate/index.vue @@ -330,7 +330,7 @@ const weekOptions = [ { label: i18n.global.t('cronjob.thursday'), value: 4 }, { label: i18n.global.t('cronjob.friday'), value: 5 }, { label: i18n.global.t('cronjob.saturday'), value: 6 }, - { label: i18n.global.t('cronjob.sunday'), value: 7 }, + { label: i18n.global.t('cronjob.sunday'), value: 0 }, ]; const rules = reactive({ name: [Rules.requiredInput], @@ -456,7 +456,9 @@ function checkScript() { case 'perMonth': return row.day > 0 && row.day < 32 && row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60; case 'perWeek': - return row.week > 0 && row.week < 8 && row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60; + return ( + row.week >= 0 && row.week < 7 && row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60 + ); case 'perDay': return row.hour >= 0 && row.hour < 24 && row.minute >= 0 && row.minute < 60; case 'perHour':