refactor(定时任务): 定时任务统一控制最小间隔不能低于一分钟
--story=1007571 --user=赵勇 定时任务限制间隔时间不能小于1分钟 https://www.tapd.cn/55049933/s/1156119
This commit is contained in:
parent
b221744aa0
commit
9cd69b92d7
|
@ -10,10 +10,10 @@
|
||||||
<div class="el-step__icon-inner">1</div>
|
<div class="el-step__icon-inner">1</div>
|
||||||
</div>
|
</div>
|
||||||
<span>{{ $t('schedule.edit_timer_task') }}</span>
|
<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')"
|
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||||
prop="cronValue">
|
prop="cronValue" style="height: 50px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||||
|
@ -157,7 +157,10 @@ export default {
|
||||||
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 (!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));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
@ -203,6 +206,12 @@ export default {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
return getCurrentUser();
|
return getCurrentUser();
|
||||||
},
|
},
|
||||||
|
intervalValidate() {
|
||||||
|
if (this.getIntervalTime() < 1 * 60 * 1000) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
changeMode() {
|
changeMode() {
|
||||||
this.runConfig.runWithinResourcePool = false;
|
this.runConfig.runWithinResourcePool = false;
|
||||||
this.runConfig.resourcePoolId = null;
|
this.runConfig.resourcePoolId = null;
|
||||||
|
@ -511,4 +520,8 @@ export default {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
.ms-el-form-item__error >>> .el-form-item__error{
|
||||||
|
left: -42px;
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -175,7 +175,10 @@ export default {
|
||||||
callback(new Error(this.$t('schedule.cron_expression_format_error')));
|
callback(new Error(this.$t('schedule.cron_expression_format_error')));
|
||||||
} else if (!customValidate.pass) {
|
} else if (!customValidate.pass) {
|
||||||
callback(new Error(customValidate.info));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
}else if(!this.intervalValidate()){
|
||||||
|
callback(new Error(this.$t('schedule.cron_expression_interval_error')));
|
||||||
|
}
|
||||||
|
else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -332,6 +335,12 @@ export default {
|
||||||
this.clear();
|
this.clear();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
intervalValidate() {
|
||||||
|
if (this.getIntervalTime() < 1 * 60 * 1000) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
intervalShortValidate() {
|
intervalShortValidate() {
|
||||||
if (this.getIntervalTime() < 3 * 60 * 1000) {
|
if (this.getIntervalTime() < 3 * 60 * 1000) {
|
||||||
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
|
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
|
||||||
|
|
|
@ -81,7 +81,10 @@ export default {
|
||||||
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 (!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));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
@ -113,6 +116,12 @@ export default {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
return getCurrentUser();
|
return getCurrentUser();
|
||||||
},
|
},
|
||||||
|
intervalValidate() {
|
||||||
|
if (this.getIntervalTime() < 1 * 60 * 1000) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
open(param) {
|
open(param) {
|
||||||
this.$post("/api/definition/getResourceId", param, response => {
|
this.$post("/api/definition/getResourceId", param, response => {
|
||||||
this.paramSwaggerUrlId = response.data
|
this.paramSwaggerUrlId = response.data
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
<div class="el-step__icon-inner">1</div>
|
<div class="el-step__icon-inner">1</div>
|
||||||
</div>
|
</div>
|
||||||
<span>{{ $t('schedule.edit_timer_task') }}</span>
|
<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')"
|
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||||
prop="cronValue">
|
prop="cronValue" style="height: 50px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||||
|
@ -101,10 +101,9 @@ export default {
|
||||||
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.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) {
|
else if (!customValidate.pass) {
|
||||||
callback(new Error(customValidate.info));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,13 +136,12 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
/* handleClick() {
|
intervalValidate() {
|
||||||
if (this.activeName === "second") {
|
if (this.getIntervalTime() < 1 * 60 * 1000) {
|
||||||
this.result = this.$get('/notice/search/message/'+this.testId, response => {
|
return false;
|
||||||
this.scheduleTask = response.data;
|
}
|
||||||
})
|
return true;
|
||||||
}
|
},
|
||||||
},*/
|
|
||||||
buildParam() {
|
buildParam() {
|
||||||
let param = {};
|
let param = {};
|
||||||
param.notices = this.tableData;
|
param.notices = this.tableData;
|
||||||
|
@ -240,5 +238,8 @@ export default {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.ms-el-form-item__error >>> .el-form-item__error{
|
||||||
|
left: 100px;
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
<div class="el-step__icon-inner">1</div>
|
<div class="el-step__icon-inner">1</div>
|
||||||
</div>
|
</div>
|
||||||
<span>{{ $t('schedule.edit_timer_task') }}</span>
|
<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')"
|
<el-form-item :label="$t('commons.schedule_cron_title')"
|
||||||
prop="cronValue">
|
prop="cronValue" style="height: 50px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
|
||||||
|
@ -183,7 +183,10 @@ export default {
|
||||||
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 (!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));
|
callback(new Error(customValidate.info));
|
||||||
} else {
|
} else {
|
||||||
if (!this.schedule.id){
|
if (!this.schedule.id){
|
||||||
|
@ -231,6 +234,12 @@ export default {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
return getCurrentUser();
|
return getCurrentUser();
|
||||||
},
|
},
|
||||||
|
intervalValidate() {
|
||||||
|
if (this.getIntervalTime() < 1 * 60 * 1000) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
scheduleChange() {
|
scheduleChange() {
|
||||||
let flag = this.schedule.enable;
|
let flag = this.schedule.enable;
|
||||||
let param = {};
|
let param = {};
|
||||||
|
@ -488,4 +497,9 @@ export default {
|
||||||
/* display: inline-flex; */
|
/* display: inline-flex; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-el-form-item__error >>> .el-form-item__error{
|
||||||
|
left: -42px;
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2531,6 +2531,7 @@ export default {
|
||||||
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 shorter than 3 minutes, please avoid running tests that take too long",
|
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: {
|
cron: {
|
||||||
seconds: "Seconds",
|
seconds: "Seconds",
|
||||||
minutes: "Minutes",
|
minutes: "Minutes",
|
||||||
|
|
|
@ -2535,6 +2535,7 @@ export default {
|
||||||
generate_expression: "自动生成",
|
generate_expression: "自动生成",
|
||||||
cron_expression_format_error: "Cron 表达式格式错误",
|
cron_expression_format_error: "Cron 表达式格式错误",
|
||||||
cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
|
cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试",
|
||||||
|
cron_expression_interval_error: "间隔时间不能小于 1 分钟",
|
||||||
cron: {
|
cron: {
|
||||||
seconds: "秒",
|
seconds: "秒",
|
||||||
minutes: "分钟",
|
minutes: "分钟",
|
||||||
|
|
|
@ -2534,6 +2534,7 @@ export default {
|
||||||
generate_expression: "自动生成",
|
generate_expression: "自动生成",
|
||||||
cron_expression_format_error: "Cron 表達式格式錯誤",
|
cron_expression_format_error: "Cron 表達式格式錯誤",
|
||||||
cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
|
cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試",
|
||||||
|
cron_expression_interval_error: "間隔時間不能小於 1 分鐘",
|
||||||
cron: {
|
cron: {
|
||||||
seconds: "秒",
|
seconds: "秒",
|
||||||
minutes: "分鐘",
|
minutes: "分鐘",
|
||||||
|
|
Loading…
Reference in New Issue