refactor(定时任务): 定时任务统一控制最小间隔不能低于一分钟

--story=1007571 --user=赵勇 定时任务限制间隔时间不能小于1分钟 https://www.tapd.cn/55049933/s/1156119
This commit is contained in:
fit2-zhao 2022-05-11 17:44:57 +08:00 committed by f2c-ci-robot[bot]
parent 3af7175776
commit 3ae63da01a
8 changed files with 70 additions and 21 deletions

View File

@ -10,10 +10,10 @@
<div class="el-step__icon-inner">1</div>
</div>
<span>{{ $t('schedule.edit_timer_task') }}</span>
<el-form :model="form" :rules="rules" ref="from" style="margin-top: 10px;">
<el-form :model="form" :rules="rules" ref="from" style="margin-top: 10px;" class="ms-el-form-item__error">
<el-form-item :label="$t('commons.schedule_cron_title')"
prop="cronValue">
prop="cronValue" style="height: 50px">
<el-row :gutter="20">
<el-col :span="16">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
@ -157,7 +157,10 @@ export default {
callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
} else if (!customValidate.pass) {
} else if(!this.intervalValidate()){
callback(new Error(this.$t('schedule.cron_expression_interval_error')));
}
else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
callback();
@ -203,6 +206,12 @@ export default {
currentUser: () => {
return getCurrentUser();
},
intervalValidate() {
if (this.getIntervalTime() < 1 * 60 * 1000) {
return false;
}
return true;
},
changeMode() {
this.runConfig.runWithinResourcePool = false;
this.runConfig.resourcePoolId = null;
@ -511,4 +520,8 @@ export default {
margin-right: 4px;
margin-left: 10px;
}
.ms-el-form-item__error >>> .el-form-item__error{
left: -42px;
padding-top: 0px;
}
</style>

View File

@ -175,7 +175,10 @@ export default {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
} else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
}else if(!this.intervalValidate()){
callback(new Error(this.$t('schedule.cron_expression_interval_error')));
}
else {
callback();
}
};
@ -332,6 +335,12 @@ export default {
this.clear();
});
},
intervalValidate() {
if (this.getIntervalTime() < 1 * 60 * 1000) {
return false;
}
return true;
},
intervalShortValidate() {
if (this.getIntervalTime() < 3 * 60 * 1000) {
this.$info(this.$t('schedule.cron_expression_interval_short_error'));

View File

@ -81,7 +81,10 @@ export default {
callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
} else if (!customValidate.pass) {
}else if(!this.intervalValidate()){
callback(new Error(this.$t('schedule.cron_expression_interval_error')));
}
else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
callback();
@ -113,6 +116,12 @@ export default {
currentUser: () => {
return getCurrentUser();
},
intervalValidate() {
if (this.getIntervalTime() < 1 * 60 * 1000) {
return false;
}
return true;
},
open(param) {
this.$post("/api/definition/getResourceId", param, response => {
this.paramSwaggerUrlId = response.data

View File

@ -9,9 +9,9 @@
<div class="el-step__icon-inner">1</div>
</div>
<span>{{ $t('schedule.edit_timer_task') }}</span>
<el-form :model="form" :rules="rules" ref="from" style="padding-top: 10px;margin-left: 20px;">
<el-form :model="form" :rules="rules" ref="from" style="padding-top: 10px;margin-left: 20px;" class="ms-el-form-item__error">
<el-form-item :label="$t('commons.schedule_cron_title')"
prop="cronValue">
prop="cronValue" style="height: 50px">
<el-row :gutter="20">
<el-col :span="16">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
@ -101,10 +101,9 @@ export default {
callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
}else if(!this.intervalValidate()){
callback(new Error(this.$t('schedule.cron_expression_interval_error')));
}
// else if(!this.intervalShortValidate()) {
// callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
// }
else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
@ -137,13 +136,12 @@ export default {
});
},
/* handleClick() {
if (this.activeName === "second") {
this.result = this.$get('/notice/search/message/'+this.testId, response => {
this.scheduleTask = response.data;
})
}
},*/
intervalValidate() {
if (this.getIntervalTime() < 1 * 60 * 1000) {
return false;
}
return true;
},
buildParam() {
let param = {};
param.notices = this.tableData;
@ -240,5 +238,8 @@ export default {
font-size: 13px;
cursor: pointer;
}
.ms-el-form-item__error >>> .el-form-item__error{
left: 100px;
padding-top: 0px;
}
</style>

View File

@ -12,9 +12,9 @@
<div class="el-step__icon-inner">1</div>
</div>
<span>{{ $t('schedule.edit_timer_task') }}</span>
<el-form :model="form" :rules="rules" ref="from" style="padding-top: 10px;margin-left: 20px;">
<el-form :model="form" :rules="rules" ref="from" style="padding-top: 10px;margin-left: 20px;" class="ms-el-form-item__error">
<el-form-item :label="$t('commons.schedule_cron_title')"
prop="cronValue">
prop="cronValue" style="height: 50px">
<el-row :gutter="20">
<el-col :span="16">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
@ -183,7 +183,10 @@ export default {
callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
} else if (!customValidate.pass) {
}else if(!this.intervalValidate()){
callback(new Error(this.$t('schedule.cron_expression_interval_error')));
}
else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
if (!this.schedule.id){
@ -231,6 +234,12 @@ export default {
currentUser: () => {
return getCurrentUser();
},
intervalValidate() {
if (this.getIntervalTime() < 1 * 60 * 1000) {
return false;
}
return true;
},
scheduleChange() {
let flag = this.schedule.enable;
let param = {};
@ -488,4 +497,9 @@ export default {
/* display: inline-flex; */
}
.ms-el-form-item__error >>> .el-form-item__error{
left: -42px;
padding-top: 0px;
}
</style>

View File

@ -2535,6 +2535,7 @@ export default {
generate_expression: "Generate Expression",
cron_expression_format_error: "Cron Expression Format Error",
cron_expression_interval_short_error: "Interval time shorter than 3 minutes, please avoid running tests that take too long",
cron_expression_interval_error: "The interval cannot be less than 1 minute",
cron: {
seconds: "Seconds",
minutes: "Minutes",

View File

@ -2539,6 +2539,7 @@ export default {
generate_expression: "自动生成",
cron_expression_format_error: "Cron 表达式格式错误",
cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
cron_expression_interval_error: "间隔时间不能小于 1 分钟",
cron: {
seconds: "秒",
minutes: "分钟",

View File

@ -2538,6 +2538,7 @@ export default {
generate_expression: "自动生成",
cron_expression_format_error: "Cron 表達式格式錯誤",
cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
cron_expression_interval_error: "間隔時間不能小於 1 分鐘",
cron: {
seconds: "秒",
minutes: "分鐘",