refactor: 修改定时任务间隔校验

This commit is contained in:
chenjianxing 2020-07-21 22:20:46 +08:00
parent 73774dae50
commit 751df79f2d
4 changed files with 12 additions and 8 deletions

View File

@ -51,9 +51,11 @@
callback(new Error(this.$t('commons.input_content'))); callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) { } else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error'))); callback(new Error(this.$t('schedule.cron_expression_format_error')));
} else if(!this.intervalShortValidate()) { }
callback(new Error(this.$t('schedule.cron_expression_interval_short_error'))); // else if(!this.intervalShortValidate()) {
} else if (!customValidate.pass){ // callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
// }
else if (!customValidate.pass){
callback(new Error(customValidate.info)); callback(new Error(customValidate.info));
} else { } else {
callback(); callback();
@ -87,6 +89,7 @@
saveCron () { saveCron () {
this.$refs['from'].validate((valid) => { this.$refs['from'].validate((valid) => {
if (valid) { if (valid) {
this.intervalShortValidate();
this.save(this.form.cronValue); this.save(this.form.cronValue);
this.dialogVisible = false; this.dialogVisible = false;
} else { } else {
@ -103,8 +106,9 @@
} }
}, },
intervalShortValidate() { intervalShortValidate() {
if (this.getIntervalTime() < 5*60*1000) { if (this.getIntervalTime() < 3*60*1000) {
return false; // return false;
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
} }
return true; return true;
}, },

View File

@ -685,7 +685,7 @@ export default {
please_input_cron_expression: "Please Input Cron Expression", please_input_cron_expression: "Please Input Cron Expression",
generate_expression: "Generate Expression", generate_expression: "Generate Expression",
cron_expression_format_error: "Cron Expression Format Error", cron_expression_format_error: "Cron Expression Format Error",
cron_expression_interval_short_error: "Interval Time Should Longer than 5 Minutes", cron_expression_interval_short_error: "Interval time shorter than 3 minutes, please avoid running tests that take too long",
cron: { cron: {
seconds: "Seconds", seconds: "Seconds",
minutes: "Minutes", minutes: "Minutes",

View File

@ -684,7 +684,7 @@ export default {
please_input_cron_expression: "请输入 Cron 表达式", please_input_cron_expression: "请输入 Cron 表达式",
generate_expression: "生成表达式", generate_expression: "生成表达式",
cron_expression_format_error: "Cron 表达式格式错误", cron_expression_format_error: "Cron 表达式格式错误",
cron_expression_interval_short_error: "间隔时间请大于 5 分钟", cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
cron: { cron: {
seconds: "秒", seconds: "秒",
minutes: "分钟", minutes: "分钟",

View File

@ -683,7 +683,7 @@ export default {
please_input_cron_expression: "請輸入 Cron 表達式", please_input_cron_expression: "請輸入 Cron 表達式",
generate_expression: "生成表達式", generate_expression: "生成表達式",
cron_expression_format_error: "Cron 表達式格式錯誤", cron_expression_format_error: "Cron 表達式格式錯誤",
cron_expression_interval_short_error: "間隔時間請大於 5 分鐘", cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
cron: { cron: {
seconds: "秒", seconds: "秒",
minutes: "分鐘", minutes: "分鐘",