mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-24 17:41:03 +01:00
updated crontab
This commit is contained in:
@@ -29,12 +29,17 @@
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-input v-model="scheduleForm.cron" :placeholder="$t('Cron')"></el-input>
|
||||
<el-input style="width:calc(100% - 100px);padding-right:10px"
|
||||
v-model="scheduleForm.cron"
|
||||
:placeholder="$t('Cron')">
|
||||
</el-input>
|
||||
<el-button style="width:100px" type="primary" @click="onShowCronDialog">{{$t('生成Cron')}}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Execute Command')" prop="params">
|
||||
<el-input v-model="spider.cmd"
|
||||
:placeholder="$t('Execute Command')"
|
||||
disabled></el-input>
|
||||
disabled>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Parameters')" prop="params">
|
||||
<el-input v-model="scheduleForm.params"
|
||||
@@ -51,6 +56,11 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!--cron generation popup-->
|
||||
<el-dialog title="生成 Cron" :visible.sync="showCron">
|
||||
<vcrontab @hide="showCron=false" @fill="onCrontabFill" :expression="expression"></vcrontab>
|
||||
</el-dialog>
|
||||
|
||||
<!--filter-->
|
||||
<div class="filter">
|
||||
<div class="right">
|
||||
@@ -95,17 +105,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import vcrontab from 'vcrontab'
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'ScheduleList',
|
||||
components: { vcrontab },
|
||||
data () {
|
||||
const cronValidator = (rule, value, callback) => {
|
||||
let patArr = []
|
||||
for (let i = 0; i < 6; i++) {
|
||||
patArr.push('[/*,0-9]+')
|
||||
patArr.push('[/*,0-9-]+')
|
||||
}
|
||||
const pat = '^' + patArr.join(' ') + '$'
|
||||
if (!value) {
|
||||
@@ -126,7 +138,9 @@ export default {
|
||||
dialogVisible: false,
|
||||
cronRules: [
|
||||
{ validator: cronValidator, trigger: 'blur' }
|
||||
]
|
||||
],
|
||||
showCron: false,
|
||||
expression: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -201,6 +215,13 @@ export default {
|
||||
this.$st.sendEv('定时任务', '删除', 'id', row._id)
|
||||
},
|
||||
onCrawl () {
|
||||
},
|
||||
onCrontabFill (value) {
|
||||
this.$set(this.scheduleForm, 'cron', value)
|
||||
},
|
||||
onShowCronDialog () {
|
||||
this.showCron = true
|
||||
this.expression = this.scheduleForm.cron
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
||||
Reference in New Issue
Block a user