From ef5e2108684688253c553cacd7478763ebe7d7c0 Mon Sep 17 00:00:00 2001 From: marvzhang Date: Mon, 9 Dec 2019 15:24:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=97=A0=E6=B3=95=E8=B7=91=E5=8F=AF=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=88=AC=E8=99=AB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/i18n/zh.js | 3 +- frontend/src/views/schedule/ScheduleList.vue | 63 +++++++++++--------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index d8f1dbe2..1c46b88b 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -259,7 +259,7 @@ export default { 'Executables': '执行文件', // 弹出框 - Notification: '提示', + 'Notification': '提示', 'Are you sure to delete this node?': '你确定要删除该节点?', 'Are you sure to run this spider?': '你确定要运行该爬虫?', 'Node info has been saved successfully': '节点信息已成功保存', @@ -279,6 +279,7 @@ export default { 'Saved successfully': '成功保存', 'Please zip your spider files from the root directory': '爬虫文件请从根目录下开始压缩。', 'English': 'English', + 'Are you sure to delete the schedule task?': '确定删除定时任务?', // 登录 'Sign in': '登录', 'Sign-in': '登录', diff --git a/frontend/src/views/schedule/ScheduleList.vue b/frontend/src/views/schedule/ScheduleList.vue index 0259247e..7a49f808 100644 --- a/frontend/src/views/schedule/ScheduleList.vue +++ b/frontend/src/views/schedule/ScheduleList.vue @@ -14,9 +14,15 @@ - + + + + + + + + - - - - - - - - - - - - + @@ -79,7 +75,7 @@ - + @@ -165,7 +161,7 @@ export default { return { columns: [ { name: 'name', label: 'Name', width: '180' }, - { name: 'cron', label: 'schedules.cron', width: '120' }, + { name: 'cron', label: 'Cron', width: '120' }, { name: 'node_name', label: 'Node', width: '150' }, { name: 'spider_name', label: 'Spider', width: '150' }, { name: 'param', label: 'Parameters', width: '150' }, @@ -246,9 +242,9 @@ export default { this.$st.sendEv('定时任务', '修改', 'id', row._id) }, onRemove (row) { - this.$confirm('确定删除定时任务?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + this.$confirm(this.$t('Are you sure to delete the schedule task?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('schedule/removeSchedule', row._id) @@ -258,15 +254,16 @@ export default { this.$message.success(`Schedule "${row.name}" has been removed`) }, 100) }) - }).catch(() => {}) + }).catch(() => { + }) this.$st.sendEv('定时任务', '删除', 'id', row._id) }, onCrawl (row) { // 停止定时任务 if (!row.status || row.status === 'running') { - this.$confirm('确定停止定时任务?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + this.$confirm(this.$t('Are you sure to delete the schedule task?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('schedule/stopSchedule', row._id) @@ -280,13 +277,14 @@ export default { message: resp.data.error }) }) - }).catch(() => {}) + }).catch(() => { + }) } // 运行定时任务 if (row.status === 'stop') { - this.$confirm('确定运行定时任务?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + this.$confirm(this.$t('Are you sure to delete the schedule task?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('schedule/runSchedule', row._id) @@ -300,7 +298,15 @@ export default { message: resp.data.error }) }) - }).catch(() => {}) + }).catch(() => { + }) + } + }, + isDisabledSpider (spider) { + if (spider.type === 'customized') { + return !spider.cmd + } else { + return false } } }, @@ -338,6 +344,7 @@ export default { min-height: 360px; margin-top: 10px; } + .status-tag { cursor: pointer; }