From 9cd69b92d7a2dd3a13500e87989721ef003bc55b Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 11 May 2022 17:44:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1):?= =?UTF-8?q?=20=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E6=9C=80=E5=B0=8F=E9=97=B4=E9=9A=94=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E4=BD=8E=E4=BA=8E=E4=B8=80=E5=88=86=E9=92=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1007571 --user=赵勇 定时任务限制间隔时间不能小于1分钟 https://www.tapd.cn/55049933/s/1156119 --- .../automation/schedule/ScheduleMaintain.vue | 19 ++++++++++--- .../components/import/ApiSchedule.vue | 11 +++++++- .../components/import/ImportScheduleEdit.vue | 11 +++++++- .../common/components/MsScheduleEdit.vue | 27 ++++++++++--------- .../plan/components/ScheduleMaintain.vue | 20 +++++++++++--- frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 1 + frontend/src/i18n/zh-TW.js | 1 + 8 files changed, 70 insertions(+), 21 deletions(-) diff --git a/frontend/src/business/components/api/automation/schedule/ScheduleMaintain.vue b/frontend/src/business/components/api/automation/schedule/ScheduleMaintain.vue index 4a7b17e7ad..d71d37b315 100644 --- a/frontend/src/business/components/api/automation/schedule/ScheduleMaintain.vue +++ b/frontend/src/business/components/api/automation/schedule/ScheduleMaintain.vue @@ -10,10 +10,10 @@
1
{{ $t('schedule.edit_timer_task') }} - + + prop="cronValue" style="height: 50px"> { 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; +} diff --git a/frontend/src/business/components/api/definition/components/import/ApiSchedule.vue b/frontend/src/business/components/api/definition/components/import/ApiSchedule.vue index b7ff2c75d2..ea00500c69 100644 --- a/frontend/src/business/components/api/definition/components/import/ApiSchedule.vue +++ b/frontend/src/business/components/api/definition/components/import/ApiSchedule.vue @@ -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')); diff --git a/frontend/src/business/components/api/definition/components/import/ImportScheduleEdit.vue b/frontend/src/business/components/api/definition/components/import/ImportScheduleEdit.vue index 7ebb18d9f2..c895f3679d 100644 --- a/frontend/src/business/components/api/definition/components/import/ImportScheduleEdit.vue +++ b/frontend/src/business/components/api/definition/components/import/ImportScheduleEdit.vue @@ -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 diff --git a/frontend/src/business/components/common/components/MsScheduleEdit.vue b/frontend/src/business/components/common/components/MsScheduleEdit.vue index 54d2682716..666f3fab06 100644 --- a/frontend/src/business/components/common/components/MsScheduleEdit.vue +++ b/frontend/src/business/components/common/components/MsScheduleEdit.vue @@ -9,9 +9,9 @@
1
{{ $t('schedule.edit_timer_task') }} - + + prop="cronValue" style="height: 50px"> { - 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; +} diff --git a/frontend/src/business/components/track/plan/components/ScheduleMaintain.vue b/frontend/src/business/components/track/plan/components/ScheduleMaintain.vue index 0c7ea16ddd..3c2d9aeedd 100644 --- a/frontend/src/business/components/track/plan/components/ScheduleMaintain.vue +++ b/frontend/src/business/components/track/plan/components/ScheduleMaintain.vue @@ -12,9 +12,9 @@
1
{{ $t('schedule.edit_timer_task') }} - + + prop="cronValue" style="height: 50px"> { 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; +} + diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 3ab705a46b..510e1eded5 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -2531,6 +2531,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", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 931477b684..b4001a480c 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -2535,6 +2535,7 @@ export default { generate_expression: "自动生成", cron_expression_format_error: "Cron 表达式格式错误", cron_expression_interval_short_error: "间隔时间小于 3 分钟, 请避免执行耗时过长的测试", + cron_expression_interval_error: "间隔时间不能小于 1 分钟", cron: { seconds: "秒", minutes: "分钟", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index abb825bc40..7e197fbc50 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -2534,6 +2534,7 @@ export default { generate_expression: "自动生成", cron_expression_format_error: "Cron 表達式格式錯誤", cron_expression_interval_short_error: "間隔時間小於 3 分鐘, 請避免執行耗時過長的測試", + cron_expression_interval_error: "間隔時間不能小於 1 分鐘", cron: { seconds: "秒", minutes: "分鐘",