mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
定时任务生成前端界面
This commit is contained in:
1
frontend/.eslintignore
Normal file
1
frontend/.eslintignore
Normal file
@@ -0,0 +1 @@
|
||||
lib/
|
||||
@@ -20,6 +20,7 @@
|
||||
"@tinymce/tinymce-vue": "^2.0.0",
|
||||
"ansi-to-html": "^0.6.13",
|
||||
"axios": "0.18.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"dayjs": "^1.8.6",
|
||||
"echarts": "^4.1.0",
|
||||
|
||||
466
frontend/src/components/Cron/index.vue
Normal file
466
frontend/src/components/Cron/index.vue
Normal file
@@ -0,0 +1,466 @@
|
||||
<style lang="scss" scoped>
|
||||
#changeContab {
|
||||
.language {
|
||||
position: absolute;
|
||||
right: 25px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.el-tabs {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.tabBody {
|
||||
.el-row {
|
||||
margin: 10px 0;
|
||||
|
||||
.long {
|
||||
.el-select {
|
||||
width: 350px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
width: 110px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
|
||||
.value {
|
||||
font-size: 18px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div id="changeContab">
|
||||
<!-- <el-button class="language" type="text" @click="i18n=(i18n==='en'?'cn':'en')">{{i18n}}</el-button>-->
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane>
|
||||
<span slot="label"><i class="el-icon-date"></i> {{text.Minutes.name}}</span>
|
||||
<div class="tabBody">
|
||||
<el-row>
|
||||
<el-radio v-model="minute.cronEvery" label="1">{{text.Minutes.every}}</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="minute.cronEvery" label="2">{{text.Minutes.interval[0]}}
|
||||
<el-input-number size="small" v-model="minute.incrementIncrement" :min="1" :max="60"></el-input-number>
|
||||
{{text.Minutes.interval[1]}}
|
||||
<el-input-number size="small" v-model="minute.incrementStart" :min="0" :max="59"></el-input-number>
|
||||
{{text.Minutes.interval[2]||''}}
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio class="long" v-model="minute.cronEvery" label="3">{{text.Minutes.specific}}
|
||||
<el-select size="small" multiple v-model="minute.specificSpecific">
|
||||
<el-option v-for="val in 60" :key="val" :value="val-1">{{val-1}}</el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="minute.cronEvery" label="4">{{text.Minutes.cycle[0]}}
|
||||
<el-input-number size="small" v-model="minute.rangeStart" :min="0" :max="60"></el-input-number>
|
||||
{{text.Minutes.cycle[1]}}
|
||||
<el-input-number size="small" v-model="minute.rangeEnd" :min="0" :max="60"></el-input-number>
|
||||
{{text.Minutes.cycle[2]}}
|
||||
</el-radio>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane>
|
||||
<span slot="label"><i class="el-icon-date"></i> {{text.Hours.name}}</span>
|
||||
<div class="tabBody">
|
||||
<el-row>
|
||||
<el-radio v-model="hour.cronEvery" label="1">{{text.Hours.every}}</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="hour.cronEvery" label="2">{{text.Hours.interval[0]}}
|
||||
<el-input-number size="small" v-model="hour.incrementIncrement" :min="0" :max="23"></el-input-number>
|
||||
{{text.Hours.interval[1]}}
|
||||
<el-input-number size="small" v-model="hour.incrementStart" :min="0" :max="23"></el-input-number>
|
||||
{{text.Hours.interval[2]}}
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio class="long" v-model="hour.cronEvery" label="3">{{text.Hours.specific}}
|
||||
<el-select size="small" multiple v-model="hour.specificSpecific">
|
||||
<el-option v-for="val in 24" :key="val" :value="val-1">{{val-1}}</el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="hour.cronEvery" label="4">{{text.Hours.cycle[0]}}
|
||||
<el-input-number size="small" v-model="hour.rangeStart" :min="0" :max="23"></el-input-number>
|
||||
{{text.Hours.cycle[1]}}
|
||||
<el-input-number size="small" v-model="hour.rangeEnd" :min="0" :max="23"></el-input-number>
|
||||
{{text.Hours.cycle[2]}}
|
||||
</el-radio>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane>
|
||||
<span slot="label"><i class="el-icon-date"></i> {{text.Day.name}}</span>
|
||||
<div class="tabBody">
|
||||
<el-row>
|
||||
<el-radio v-model="day.cronEvery" label="1">{{text.Day.every}}</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="day.cronEvery" label="2">{{text.Day.intervalDay[0]}}
|
||||
<el-input-number size="small" v-model="day.incrementIncrement" :min="1" :max="31"></el-input-number>
|
||||
{{text.Day.intervalDay[1]}}
|
||||
<el-input-number size="small" v-model="day.incrementStart" :min="1" :max="31"></el-input-number>
|
||||
{{text.Day.intervalDay[2]}}
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio class="long" v-model="day.cronEvery" label="3">{{text.Day.specificDay}}
|
||||
<el-select size="small" multiple v-model="day.specificSpecific">
|
||||
<el-option v-for="val in 31" :key="val" :value="val">{{val}}</el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="day.cronEvery" label="4">{{text.Day.cycle[0]}}
|
||||
<el-input-number size="small" v-model="day.rangeStart" :min="1" :max="12"></el-input-number>
|
||||
{{text.Day.cycle[1]}}
|
||||
<el-input-number size="small" v-model="day.rangeEnd" :min="1" :max="12"></el-input-number>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane>
|
||||
<span slot="label"><i class="el-icon-date"></i> {{text.Month.name}}</span>
|
||||
<div class="tabBody">
|
||||
<el-row>
|
||||
<el-radio v-model="month.cronEvery" label="1">{{text.Month.every}}</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="month.cronEvery" label="2">{{text.Month.interval[0]}}
|
||||
<el-input-number size="small" v-model="month.incrementIncrement" :min="0" :max="12"></el-input-number>
|
||||
{{text.Month.interval[1]}}
|
||||
<el-input-number size="small" v-model="month.incrementStart" :min="0" :max="12"></el-input-number>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio class="long" v-model="month.cronEvery" label="3">{{text.Month.specific}}
|
||||
<el-select size="small" multiple v-model="month.specificSpecific">
|
||||
<el-option v-for="val in 12" :key="val" :label="val" :value="val"></el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="month.cronEvery" label="4">{{text.Month.cycle[0]}}
|
||||
<el-input-number size="small" v-model="month.rangeStart" :min="1" :max="31"></el-input-number>
|
||||
{{text.Month.cycle[1]}}
|
||||
<el-input-number size="small" v-model="month.rangeEnd" :min="1" :max="31"></el-input-number>
|
||||
{{text.Month.cycle[2]}}
|
||||
</el-radio>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane>
|
||||
<span slot="label"><i class="el-icon-date"></i> {{text.Week.name}}</span>
|
||||
<div class="tabBody">
|
||||
<el-row>
|
||||
<el-radio v-model="week.cronEvery" label="1">{{text.Week.every}}</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio class="long" v-model="week.cronEvery" label="2">{{text.Week.specific}}
|
||||
<el-select size="small" multiple v-model="week.specificSpecific">
|
||||
<el-option v-for="(val, $index) in text.Week.list" :key="val" :label="val"
|
||||
:value="($index + 1)"></el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio class="long" v-model="week.cronEvery" label="3">{{text.Week.specific}}
|
||||
<el-select size="small" multiple v-model="week.specificSpecific">
|
||||
<el-option v-for="val in 12" :key="val" :label="val" :value="val"></el-option>
|
||||
</el-select>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-radio v-model="week.cronEvery" label="4">{{text.Week.cycle[0]}}
|
||||
<el-input-number size="small" v-model="week.rangeStart" :min="1" :max="7"></el-input-number>
|
||||
{{text.Week.cycle[1]}}
|
||||
<el-input-number size="small" v-model="week.rangeEnd" :min="1" :max="7"></el-input-number>
|
||||
</el-radio>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Language from './language/index'
|
||||
|
||||
export default {
|
||||
name: 'VueCronLinux',
|
||||
props: ['data', 'i18n'],
|
||||
data () {
|
||||
return {
|
||||
second: {
|
||||
cronEvery: '',
|
||||
incrementStart: '3',
|
||||
incrementIncrement: '5',
|
||||
rangeStart: '',
|
||||
rangeEnd: '',
|
||||
specificSpecific: []
|
||||
},
|
||||
minute: {
|
||||
cronEvery: '',
|
||||
incrementStart: '3',
|
||||
incrementIncrement: '5',
|
||||
rangeStart: '',
|
||||
rangeEnd: '',
|
||||
specificSpecific: []
|
||||
},
|
||||
hour: {
|
||||
cronEvery: '',
|
||||
incrementStart: '3',
|
||||
incrementIncrement: '5',
|
||||
rangeStart: '',
|
||||
rangeEnd: '',
|
||||
specificSpecific: []
|
||||
},
|
||||
day: {
|
||||
cronEvery: '',
|
||||
incrementStart: '1',
|
||||
incrementIncrement: '1',
|
||||
rangeStart: '',
|
||||
rangeEnd: '',
|
||||
specificSpecific: [],
|
||||
cronLastSpecificDomDay: 1,
|
||||
cronDaysBeforeEomMinus: '',
|
||||
cronDaysNearestWeekday: ''
|
||||
},
|
||||
week: {
|
||||
cronEvery: '',
|
||||
incrementStart: '1',
|
||||
incrementIncrement: '1',
|
||||
specificSpecific: [],
|
||||
cronNthDayDay: 1,
|
||||
cronNthDayNth: '1',
|
||||
rangeStart: '',
|
||||
rangeEnd: ''
|
||||
},
|
||||
month: {
|
||||
cronEvery: '',
|
||||
incrementStart: '3',
|
||||
incrementIncrement: '5',
|
||||
rangeStart: '',
|
||||
rangeEnd: '',
|
||||
specificSpecific: []
|
||||
},
|
||||
year: {
|
||||
cronEvery: '',
|
||||
incrementStart: '2017',
|
||||
incrementIncrement: '1',
|
||||
rangeStart: '',
|
||||
rangeEnd: '',
|
||||
specificSpecific: []
|
||||
},
|
||||
output: {
|
||||
second: '',
|
||||
minute: '',
|
||||
hour: '',
|
||||
day: '',
|
||||
month: '',
|
||||
Week: '',
|
||||
year: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
data () {
|
||||
if (!this.data) {
|
||||
this.data = '* * * * *'
|
||||
return
|
||||
}
|
||||
this.updateCron()
|
||||
},
|
||||
cron () {
|
||||
this.$emit('change', this.cron)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
text () {
|
||||
return Language[this.i18n || 'cn']
|
||||
},
|
||||
minutesText () {
|
||||
let minutes = ''
|
||||
let cronEvery = this.minute.cronEvery
|
||||
switch (cronEvery.toString()) {
|
||||
case '1':
|
||||
minutes = '*'
|
||||
break
|
||||
case '2':
|
||||
minutes = this.minute.incrementStart + '/' + this.minute.incrementIncrement
|
||||
break
|
||||
case '3':
|
||||
this.minute.specificSpecific.map(val => {
|
||||
minutes += val + ','
|
||||
})
|
||||
minutes = minutes.slice(0, -1)
|
||||
break
|
||||
case '4':
|
||||
minutes = this.minute.rangeStart + '-' + this.minute.rangeEnd
|
||||
break
|
||||
}
|
||||
return minutes
|
||||
},
|
||||
hoursText () {
|
||||
let hours = ''
|
||||
let cronEvery = this.hour.cronEvery
|
||||
switch (cronEvery.toString()) {
|
||||
case '1':
|
||||
hours = '*'
|
||||
break
|
||||
case '2':
|
||||
hours = this.hour.incrementStart + '/' + this.hour.incrementIncrement
|
||||
break
|
||||
case '3':
|
||||
this.hour.specificSpecific.map(val => {
|
||||
hours += val + ','
|
||||
})
|
||||
hours = hours.slice(0, -1)
|
||||
break
|
||||
case '4':
|
||||
hours = this.hour.rangeStart + '-' + this.hour.rangeEnd
|
||||
break
|
||||
}
|
||||
return hours
|
||||
},
|
||||
daysText () {
|
||||
let days = ''
|
||||
let cronEvery = this.day.cronEvery
|
||||
switch (cronEvery.toString()) {
|
||||
case '1':
|
||||
break
|
||||
case '2':
|
||||
case '4':
|
||||
case '11':
|
||||
days = '*'
|
||||
break
|
||||
case '3':
|
||||
days = this.day.incrementStart + '/' + this.day.incrementIncrement
|
||||
break
|
||||
case '5':
|
||||
this.day.specificSpecific.map(val => {
|
||||
days += val + ','
|
||||
})
|
||||
days = days.slice(0, -1)
|
||||
break
|
||||
case '6':
|
||||
days = 'L'
|
||||
break
|
||||
case '7':
|
||||
days = 'LW'
|
||||
break
|
||||
case '8':
|
||||
days = this.day.cronLastSpecificDomDay + 'L'
|
||||
break
|
||||
case '9':
|
||||
days = 'L-' + this.day.cronDaysBeforeEomMinus
|
||||
break
|
||||
case '10':
|
||||
days = this.day.cronDaysNearestWeekday + 'W'
|
||||
break
|
||||
}
|
||||
return days
|
||||
},
|
||||
weeksText () {
|
||||
let weeks = ''
|
||||
let cronEvery = this.week.cronEvery
|
||||
switch (cronEvery.toString()) {
|
||||
case '1':
|
||||
weeks = '*'
|
||||
break
|
||||
case '2':
|
||||
this.week.specificSpecific.map(val => {
|
||||
weeks += val + ','
|
||||
})
|
||||
weeks = weeks.slice(0, -1)
|
||||
break
|
||||
}
|
||||
return weeks
|
||||
},
|
||||
monthsText () {
|
||||
let months = ''
|
||||
let cronEvery = this.month.cronEvery
|
||||
switch (cronEvery.toString()) {
|
||||
case '1':
|
||||
months = '*'
|
||||
break
|
||||
case '2':
|
||||
months = this.month.incrementStart + '/' + this.month.incrementIncrement
|
||||
break
|
||||
case '3':
|
||||
this.month.specificSpecific.map(val => {
|
||||
months += val + ','
|
||||
})
|
||||
months = months.slice(0, -1)
|
||||
break
|
||||
case '4':
|
||||
months = this.month.rangeStart + '-' + this.month.rangeEnd
|
||||
break
|
||||
}
|
||||
return months
|
||||
},
|
||||
cron () {
|
||||
return `${this.minutesText || '*'} ${this.hoursText || '*'} ${this.daysText || '*'} ${this.monthsText || '*'} ${this.weeksText || '*'}`
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getValue () {
|
||||
return this.cron
|
||||
},
|
||||
change () {
|
||||
this.$emit('change', this.cron)
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.$emit('close')
|
||||
},
|
||||
updateCronItem (key, value) {
|
||||
if (value.match(/\//)) {
|
||||
this[key].cronEvery = '2'
|
||||
this[key].incrementStart = value.split('/')[0]
|
||||
this[key].incrementIncrement = value.split('/')[1]
|
||||
} else if (value.match(/,|^\d+$/)) {
|
||||
this[key].cronEvery = '3'
|
||||
this[key].specificSpecific = value.split(',')
|
||||
} else if (value.match(/-/)) {
|
||||
this[key].cronEvery = '4'
|
||||
this[key].rangeStart = value.split('-')[0]
|
||||
this[key].rangeEnd = value.split('-')[1]
|
||||
} else {
|
||||
this[key].cronEvery = '1'
|
||||
}
|
||||
},
|
||||
updateCron () {
|
||||
const arr = this.data.split(' ')
|
||||
const minute = arr[0]
|
||||
const hour = arr[1]
|
||||
const day = arr[2]
|
||||
const month = arr[3]
|
||||
const week = arr[4]
|
||||
|
||||
this.updateCronItem('minute', minute)
|
||||
this.updateCronItem('hour', hour)
|
||||
this.updateCronItem('day', day)
|
||||
this.updateCronItem('month', month)
|
||||
this.updateCronItem('week', week)
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.updateCron()
|
||||
}
|
||||
}</script>
|
||||
61
frontend/src/components/Cron/language/cn.js
Normal file
61
frontend/src/components/Cron/language/cn.js
Normal file
@@ -0,0 +1,61 @@
|
||||
export default {
|
||||
Seconds: {
|
||||
name: '秒',
|
||||
every: '每一秒钟',
|
||||
interval: ['每隔', '秒执行 从', '秒开始'],
|
||||
specific: '具体秒数(可多选)',
|
||||
cycle: ['周期从', '到', '秒']
|
||||
},
|
||||
Minutes: {
|
||||
name: '分',
|
||||
every: '每一分钟',
|
||||
interval: ['每隔', '分执行 从', '分开始'],
|
||||
specific: '具体分钟数(可多选)',
|
||||
cycle: ['周期从', '到', '分']
|
||||
},
|
||||
Hours: {
|
||||
name: '时',
|
||||
every: '每一小时',
|
||||
interval: ['每隔', '小时执行 从', '小时开始'],
|
||||
specific: '具体小时数(可多选)',
|
||||
cycle: ['周期从', '到', '小时']
|
||||
},
|
||||
Day: {
|
||||
name: '天',
|
||||
every: '每一天',
|
||||
intervalWeek: ['每隔', '周执行 从', '开始'],
|
||||
intervalDay: ['每隔', '天执行 从', '天开始'],
|
||||
specificWeek: '具体星期几(可多选)',
|
||||
specificDay: '具体天数(可多选)',
|
||||
lastDay: '在这个月的最后一天',
|
||||
lastWeekday: '在这个月的最后一个工作日',
|
||||
lastWeek: ['在这个月的最后一个'],
|
||||
beforeEndMonth: ['在本月底前', '天'],
|
||||
nearestWeekday: ['最近的工作日(周一至周五)至本月', '日'],
|
||||
someWeekday: ['在这个月的第', '个'],
|
||||
cycle: ['从', '到']
|
||||
},
|
||||
Week: {
|
||||
name: '周',
|
||||
every: '每天',
|
||||
specific: '具体天数(可多选)',
|
||||
list: ['一', '二', '三', '四', '五', '六', '天'].map(val => '星期' + val),
|
||||
cycle: ['从', '到']
|
||||
},
|
||||
Month: {
|
||||
name: '月',
|
||||
every: '每一月',
|
||||
interval: ['每隔', '月执行 从', '月开始'],
|
||||
specific: '具体月数(可多选)',
|
||||
cycle: ['从', '到', '月之间的每个月']
|
||||
},
|
||||
Year: {
|
||||
name: '年',
|
||||
every: '每一年',
|
||||
interval: ['每隔', '年执行 从', '年开始'],
|
||||
specific: '具体年份(可多选)',
|
||||
cycle: ['从', '到', '年之间的每一年']
|
||||
},
|
||||
Save: '保存',
|
||||
Close: '关闭'
|
||||
}
|
||||
62
frontend/src/components/Cron/language/en.js
Normal file
62
frontend/src/components/Cron/language/en.js
Normal file
@@ -0,0 +1,62 @@
|
||||
export default {
|
||||
Seconds: {
|
||||
name: 'Seconds',
|
||||
every: 'Every second',
|
||||
interval: ['Every', 'second(s) starting at second'],
|
||||
specific: 'Specific second (choose one or many)',
|
||||
cycle: ['Every second between second', 'and second']
|
||||
},
|
||||
Minutes: {
|
||||
name: 'Minutes',
|
||||
every: 'Every minute',
|
||||
interval: ['Every', 'minute(s) starting at minute'],
|
||||
specific: 'Specific minute (choose one or many)',
|
||||
cycle: ['Every minute between minute', 'and minute']
|
||||
},
|
||||
Hours: {
|
||||
name: 'Hours',
|
||||
every: 'Every hour',
|
||||
interval: ['Every', 'hour(s) starting at hour'],
|
||||
specific: 'Specific hour (choose one or many)',
|
||||
cycle: ['Every hour between hour', 'and hour']
|
||||
},
|
||||
Day: {
|
||||
name: 'Day',
|
||||
every: 'Every day',
|
||||
intervalWeek: ['Every', 'day(s) starting on'],
|
||||
intervalDay: ['Every', 'day(s) starting at the', 'of the month'],
|
||||
specificWeek: 'Specific day of week (choose one or many)',
|
||||
specificDay: 'Specific day of month (choose one or many)',
|
||||
lastDay: 'On the last day of the month',
|
||||
lastWeekday: 'On the last weekday of the month',
|
||||
lastWeek: ['On the last', ' of the month'],
|
||||
beforeEndMonth: ['day(s) before the end of the month'],
|
||||
nearestWeekday: ['Nearest weekday (Monday to Friday) to the', 'of the month'],
|
||||
someWeekday: ['On the', 'of the month'],
|
||||
cycle: ['From', 'to']
|
||||
},
|
||||
Week: {
|
||||
name: 'Week',
|
||||
every: 'Every day',
|
||||
specific: 'Specific weekday (choose on or many)',
|
||||
list: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
|
||||
cycle: ['From', 'to']
|
||||
},
|
||||
// Week:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
|
||||
Month: {
|
||||
name: 'Month',
|
||||
every: 'Every month',
|
||||
interval: ['Every', 'month(s) starting in'],
|
||||
specific: 'Specific month (choose one or many)',
|
||||
cycle: ['Every month between', 'and']
|
||||
},
|
||||
Year: {
|
||||
name: 'Year',
|
||||
every: 'Any year',
|
||||
interval: ['Every', 'year(s) starting in'],
|
||||
specific: 'Specific year (choose one or many)',
|
||||
cycle: ['Every year between', 'and']
|
||||
},
|
||||
Save: 'Save',
|
||||
Close: 'Close'
|
||||
}
|
||||
7
frontend/src/components/Cron/language/index.js
Normal file
7
frontend/src/components/Cron/language/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import en from './en'
|
||||
import cn from './cn'
|
||||
|
||||
export default {
|
||||
en,
|
||||
cn
|
||||
}
|
||||
@@ -67,11 +67,18 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Cron')" prop="cron" required>
|
||||
<el-input
|
||||
v-model="scheduleForm.cron"
|
||||
:placeholder="`${$t('[minute] [hour] [day] [month] [day of week]')}`"
|
||||
>
|
||||
</el-input>
|
||||
<el-popover>
|
||||
<template>
|
||||
<vue-cron-linux :data="scheduleForm.cron" :i18n="lang" @change="onCronChange"/>
|
||||
</template>
|
||||
<template slot="reference">
|
||||
<el-input
|
||||
v-model="scheduleForm.cron"
|
||||
:placeholder="`${$t('[minute] [hour] [day] [month] [day of week]')}`"
|
||||
>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-popover>
|
||||
<!--<el-button size="small" style="width:100px" type="primary" @click="onShowCronDialog">{{$t('schedules.add_cron')}}</el-button>-->
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Execute Command')" prop="params">
|
||||
@@ -139,14 +146,16 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else-if="col.name === 'run_type'" :key="col.name" :label="$t(col.label)" :width="col.width">
|
||||
<el-table-column v-else-if="col.name === 'run_type'" :key="col.name" :label="$t(col.label)"
|
||||
:width="col.width">
|
||||
<template slot-scope="scope">
|
||||
<template v-if="scope.row.run_type === 'all-nodes'">{{$t('All Nodes')}}</template>
|
||||
<template v-else-if="scope.row.run_type === 'selected-nodes'">{{$t('Selected Nodes')}}</template>
|
||||
<template v-else-if="scope.row.run_type === 'random'">{{$t('Random')}}</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else-if="col.name === 'node_names'" :key="col.name" :label="$t(col.label)" :width="col.width">
|
||||
<el-table-column v-else-if="col.name === 'node_names'" :key="col.name" :label="$t(col.label)"
|
||||
:width="col.width">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.nodes.map(d => d.name).join(', ')}}
|
||||
</template>
|
||||
@@ -183,7 +192,7 @@
|
||||
<el-button type="danger" icon="el-icon-delete" size="mini" @click="onRemove(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<!--<el-tooltip :content="$t(getStatusTooltip(scope.row))" placement="top">-->
|
||||
<!--<el-button type="success" icon="fa fa-bug" size="mini" @click="onCrawl(scope.row)"></el-button>-->
|
||||
<!--<el-button type="success" icon="fa fa-bug" size="mini" @click="onCrawl(scope.row)"></el-button>-->
|
||||
<!--</el-tooltip>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -194,14 +203,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import vcrontab from 'vcrontab'
|
||||
import request from '../../api/request'
|
||||
import VueCronLinux from '../../components/Cron'
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'ScheduleList',
|
||||
components: {
|
||||
VueCronLinux
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
columns: [
|
||||
@@ -229,6 +241,12 @@ export default {
|
||||
'scheduleList',
|
||||
'scheduleForm'
|
||||
]),
|
||||
lang () {
|
||||
const lang = this.$store.state.lang.lang || window.localStorage.getItem('lang')
|
||||
if (!lang) return 'cn'
|
||||
if (lang === 'zh') return 'cn'
|
||||
return 'en'
|
||||
},
|
||||
filteredTableData () {
|
||||
return this.scheduleList
|
||||
},
|
||||
@@ -340,6 +358,10 @@ export default {
|
||||
} else {
|
||||
this.$message.success(this.$t(`${row.enabled ? 'Enabling' : 'Disabling'} the schedule successful`))
|
||||
}
|
||||
},
|
||||
onCronChange (value) {
|
||||
console.log(value)
|
||||
this.$set(this.scheduleForm, 'cron', value)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
||||
@@ -1508,6 +1508,15 @@ babel-plugin-transform-strict-mode@^6.24.1:
|
||||
babel-runtime "^6.22.0"
|
||||
babel-types "^6.24.1"
|
||||
|
||||
babel-polyfill@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.npm.taobao.org/babel-polyfill/download/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
|
||||
integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=
|
||||
dependencies:
|
||||
babel-runtime "^6.26.0"
|
||||
core-js "^2.5.0"
|
||||
regenerator-runtime "^0.10.5"
|
||||
|
||||
babel-preset-jest@^23.2.0:
|
||||
version "23.2.0"
|
||||
resolved "http://registry.npm.taobao.org/babel-preset-jest/download/babel-preset-jest-23.2.0.tgz#8ec7a03a138f001a1a8fb1e8113652bf1a55da46"
|
||||
@@ -7139,6 +7148,11 @@ regenerate@^1.2.1, regenerate@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "http://registry.npm.taobao.org/regenerate/download/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
|
||||
|
||||
regenerator-runtime@^0.10.5:
|
||||
version "0.10.5"
|
||||
resolved "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"
|
||||
integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=
|
||||
|
||||
regenerator-runtime@^0.11.0:
|
||||
version "0.11.1"
|
||||
resolved "http://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||
|
||||
Reference in New Issue
Block a user