added batch enable/disable schedules

This commit is contained in:
marvzhang
2020-07-18 21:16:19 +08:00
parent 695bd3ddf5
commit cb7cfb3224
2 changed files with 44 additions and 0 deletions

View File

@@ -315,6 +315,8 @@ export default {
'Cron expression is invalid': 'Cron 表达式不正确',
'View Tasks': '查看任务',
'Batch Add': '批量添加',
'Enable': '启用',
'Disable': '禁用',
// 网站
'Site': '网站',
@@ -672,6 +674,8 @@ export default {
'Are you sure to restart these tasks': '确认重新运行这些任务?',
'Restarted successfully': '成功重新运行',
'Are you sure to stop this task?': '确认停止这个任务?',
'Enabled successfully': '成功启用',
'Disabled successfully': '成功禁用',
// 其他
'Star crawlab-team/crawlab on GitHub': ' GitHub 上为 Crawlab 加星吧'

View File

@@ -235,6 +235,26 @@
>
{{ $t('Add Schedule') }}
</el-button>
<el-button
v-if="selectedSchedules.length > 0"
size="small"
type="primary"
icon="el-icon-check"
class="btn-enable"
@click="onBatchEnable"
>
{{ $t('Enable') }}
</el-button>
<el-button
v-if="selectedSchedules.length > 0"
size="small"
type="info"
icon="el-icon-close"
class="btn-disable"
@click="onBatchDisable"
>
{{ $t('Disable') }}
</el-button>
<el-button
v-if="selectedSchedules.length > 0"
size="small"
@@ -678,6 +698,26 @@
this.$st.sendEv('定时任务', '批量删除定时任务')
})
},
async onBatchEnable() {
await this.$request.post('/schedules-set-enabled', {
schedule_ids: this.selectedSchedules.map(d => d._id),
enabled: true
})
this.$message.success('Enabled successfully')
this.$refs['table'].clearSelection()
await this.$store.dispatch('schedule/getScheduleList')
this.$st.sendEv('定时任务', '批量启用定时任务')
},
async onBatchDisable() {
await this.$request.post('/schedules-set-enabled', {
schedule_ids: this.selectedSchedules.map(d => d._id),
enabled: false
})
this.$message.success('Disabled successfully')
this.$refs['table'].clearSelection()
await this.$store.dispatch('schedule/getScheduleList')
this.$st.sendEv('定时任务', '批量禁用定时任务')
},
isShowRun(row) {
},
async onEdit(row) {