perf: The cron interval execution must be greater than 10 minutes

This commit is contained in:
wangruidong
2024-01-16 17:55:42 +08:00
committed by Bryan
parent ddf268e8ec
commit 0d1eb82fca
5 changed files with 21 additions and 3 deletions

View File

@@ -100,7 +100,7 @@
<div style="font-size: 13px;">{{ contabValueString }}</div>
</div>
</div>
<CrontabResult :ex="contabValueString" />
<CrontabResult :ex="contabValueString" @crontabDiffChange="crontabDiffChangeHandle" />
<div class="pop_btn">
<el-button
@@ -167,7 +167,8 @@ export default {
week: '*'
// year: "",
},
newContabValueString: ''
newContabValueString: '',
crontabDiff: 0
}
},
computed: {
@@ -364,6 +365,12 @@ export default {
},
// 填充表达式
submitFill() {
const crontabDiffMin = this.crontabDiff / 1000 / 60
if (crontabDiffMin > 0 && crontabDiffMin < 10) {
const msg = this.$tc('common.crontabDiffError')
this.$message.error(msg)
return
}
this.$emit('fill', this.contabValueString)
this.hidePopup()
},
@@ -381,6 +388,9 @@ export default {
for (const j in this.contabValueObj) {
this.changeRadio(j, this.contabValueObj[j])
}
},
crontabDiffChangeHandle(diff) {
this.crontabDiff = diff
}
}
}
@@ -454,7 +464,7 @@ export default {
}
.crontab-panel {
>>> .el-input-number {
> > > .el-input-number {
margin: 0 5px
}
}

View File

@@ -14,6 +14,7 @@
<script>
import parser from 'cron-parser'
import { toSafeLocalDateStr } from '@/utils/common'
export default {
name: 'CrontabResult',
props: {
@@ -51,6 +52,10 @@ export default {
const cur = interval.next().toString()
this.resultList.push(toSafeLocalDateStr(cur))
}
const first = new Date(this.resultList[0])
const second = new Date(this.resultList[1])
const diff = Math.abs(second - first)
this.$emit('crontabDiffChange', diff)
} catch (error) {
this.isShow = false
// debug(error, 'error')

View File

@@ -747,6 +747,7 @@
"Prompt": "Prompt",
"InputMessage": "Input message...",
"CollapseSidebar": "Collapse the sidebar",
"crontabDiffError": "The interval for scheduled execution must be greater than 10 minutes!",
"introduction": {
"ConceptTitle": "🤔 Python interpreter",
"ConceptContent": "I want you to act like a Python interpreter. I will give you Python code, and you will execute it. Do not provide any explanations. Do not respond with anything except the output of the code. ",

View File

@@ -748,6 +748,7 @@
"Prompt": "ヒント",
"InputMessage": "メッセージの入力...",
"CollapseSidebar": "サイドバーを閉じる",
"crontabDiffError": "定期実行時間間隔は10分より大きくする必要があります",
"introduction": {
"ConceptTitle": "🤔 Python インタプリタ",
"IdeaContent": "私はあなたに Linux ターミナルの役割を果たしてもらいたいです。私はコマンドを入力し、ターミナルが表示すべき内容を返してもらいます。あなたにはユニークなコードブロック内でのみターミナルの出力に応答してほしいです。説明は書かないでください。私が何かを英語で伝える必要がある場合、中括弧で囲んでテキストを入れます {コメントテキスト}。",

View File

@@ -802,6 +802,7 @@
"InputMessage": "输入消息...",
"EnterMessage": "请输入问题, Enter 发送",
"CollapseSidebar": "收起侧边栏",
"crontabDiffError": "定期执行时间间隔必须大于十分钟!",
"introduction": {
"ConceptTitle": "\uD83E\uDD14 Python 解释器 ",
"ConceptContent": "我想让你像一个 Python 解释器一样行事。我将给你 Python 代码,你将执行它。不要提供任何解释。除了代码的输出,不要用任何东西来回应。",