From cb7cfb3224ea7ac1dde3b5fd6602c3e9d72ca5bd Mon Sep 17 00:00:00 2001 From: marvzhang Date: Sat, 18 Jul 2020 21:16:19 +0800 Subject: [PATCH] added batch enable/disable schedules --- frontend/src/i18n/zh.js | 4 ++ frontend/src/views/schedule/ScheduleList.vue | 40 ++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index 5c13690e..10c28b6e 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -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 加星吧' diff --git a/frontend/src/views/schedule/ScheduleList.vue b/frontend/src/views/schedule/ScheduleList.vue index d1f33f1c..9200d245 100644 --- a/frontend/src/views/schedule/ScheduleList.vue +++ b/frontend/src/views/schedule/ScheduleList.vue @@ -235,6 +235,26 @@ > {{ $t('Add Schedule') }} + + {{ $t('Enable') }} + + + {{ $t('Disable') }} + 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) {