From cfedd153c87b8442ae751cd4926d0ca7ecd9cc08 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Wed, 16 Nov 2022 11:11:40 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/zh.json | 6 +- src/views/tasks/RunInfoCard/index.vue | 56 ----------- .../HistoryExecutionDetail.vue | 95 ------------------- .../HistoryExecutionDetail/index.vue | 45 --------- src/views/tasks/TaskDetail/TaskDetail.vue | 12 +++ src/views/tasks/TaskDetail/TaskHistory.vue | 14 +-- src/views/tasks/TaskDetail/business.js | 36 ------- src/views/tasks/TaskDetail/index.vue | 5 +- src/views/tasks/TaskList.vue | 36 ++++--- 9 files changed, 37 insertions(+), 268 deletions(-) delete mode 100644 src/views/tasks/RunInfoCard/index.vue delete mode 100644 src/views/tasks/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue delete mode 100644 src/views/tasks/TaskDetail/HistoryExecutionDetail/index.vue delete mode 100644 src/views/tasks/TaskDetail/business.js diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index 928959bbb..ed0c5c369 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -669,6 +669,7 @@ "selectedAssets": "已选择资产:", "stat": "成功/失败/总", "success": "成功", + "total": "总共", "taskDetail": "任务详情", "taskName": "任务名称", "taskVersions": "任务各版本", @@ -692,7 +693,10 @@ "myAdhoc": "我的命令", "history": "历史记录", "createAdhoc": "创建命令", - "AdhocDetail": "命令详情" + "AdhocDetail": "命令详情", + "Queue": "队列", + "State": "状态", + "LastPublishedTime": "最后发布时间" }, "perms": { "": "", diff --git a/src/views/tasks/RunInfoCard/index.vue b/src/views/tasks/RunInfoCard/index.vue deleted file mode 100644 index ed5ff9a1a..000000000 --- a/src/views/tasks/RunInfoCard/index.vue +++ /dev/null @@ -1,56 +0,0 @@ - - - - - diff --git a/src/views/tasks/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue b/src/views/tasks/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue deleted file mode 100644 index 496d883c9..000000000 --- a/src/views/tasks/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - - - diff --git a/src/views/tasks/TaskDetail/HistoryExecutionDetail/index.vue b/src/views/tasks/TaskDetail/HistoryExecutionDetail/index.vue deleted file mode 100644 index 5674828bd..000000000 --- a/src/views/tasks/TaskDetail/HistoryExecutionDetail/index.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/src/views/tasks/TaskDetail/TaskDetail.vue b/src/views/tasks/TaskDetail/TaskDetail.vue index b41dc974b..a4fce6c4f 100644 --- a/src/views/tasks/TaskDetail/TaskDetail.vue +++ b/src/views/tasks/TaskDetail/TaskDetail.vue @@ -32,6 +32,18 @@ export default { { key: this.$t('common.Name'), value: this.object.name + }, + { + key: this.$t('common.Comment'), + value: this.object.meta.comment + }, + { + key: this.$t('ops.Queue'), + value: this.object.meta.queue + }, + { + key: this.$t('ops.LastPublishedTime'), + value: this.object.last_published_time } ] } diff --git a/src/views/tasks/TaskDetail/TaskHistory.vue b/src/views/tasks/TaskDetail/TaskHistory.vue index bad0abedb..27e206191 100644 --- a/src/views/tasks/TaskDetail/TaskHistory.vue +++ b/src/views/tasks/TaskDetail/TaskHistory.vue @@ -21,23 +21,11 @@ export default { tableConfig: { url: `/api/v1/ops/task-executions/?task_id=${this.object.id}`, columns: [ - 'id', 'state', 'is_finished', 'date_published', 'date_start', 'date_finished', 'actions' + 'date_start', 'date_finished', 'state', 'is_finished', 'actions' ], columnsMeta: { state: { - label: this.$t('ops.state'), - width: '120px', formatter: (row) => { - switch (row.state) { - case 'PENDING': - return {this.$t(`ops.${row.state}`)} - case 'RUNNING': - return {this.$t(`ops.${row.state}`)} - case 'SUCCESS': - return {this.$t(`ops.${row.state}`)} - case 'FAILURE': - return {this.$t(`ops.${row.state}`)} - } } }, actions: { diff --git a/src/views/tasks/TaskDetail/business.js b/src/views/tasks/TaskDetail/business.js deleted file mode 100644 index 0a775ef84..000000000 --- a/src/views/tasks/TaskDetail/business.js +++ /dev/null @@ -1,36 +0,0 @@ - -export const toLastSucessDisplay = function(object) { - const last_success = object && object.last_success - - if (!(last_success instanceof Array)) return [] - return last_success.map(host => { - return { - hostname: host, - result: '' - } - }) -} - -export const toLastFailureDisplay = function(object) { - const last_failure = object && object.last_failure - if (!(last_failure instanceof Object)) return [] - - const ret = [] - - for (const host in last_failure) { - const task = last_failure[host] - const msgs = [] - for (const name in task) { - msgs.push(`${name} => ${task[name].msg}`) - } - - ret.push( - { - hostname: host, - result: msgs.join('\n') - } - ) - } - - return ret -} diff --git a/src/views/tasks/TaskDetail/index.vue b/src/views/tasks/TaskDetail/index.vue index b110d5d69..d510c3766 100644 --- a/src/views/tasks/TaskDetail/index.vue +++ b/src/views/tasks/TaskDetail/index.vue @@ -11,6 +11,7 @@ import { GenericDetailPage, TabPage } from '@/layout/components' import TaskDetail from './TaskDetail' import TaskHistory from './TaskHistory' import CeleryTaskLog from '../CeleryTaskLog' + export default { components: { GenericDetailPage, @@ -23,9 +24,7 @@ export default { return { TaskDetail: {}, config: { - getTitle(row) { - return row['display_name'] - }, + url: '/api/v1/ops/tasks', activeMenu: 'TaskDetail', submenu: [ { diff --git a/src/views/tasks/TaskList.vue b/src/views/tasks/TaskList.vue index e3f20a15d..1358bdc5e 100644 --- a/src/views/tasks/TaskList.vue +++ b/src/views/tasks/TaskList.vue @@ -14,50 +14,48 @@ export default { tableConfig: { url: '/api/v1/ops/tasks/', columns: [ - 'name', 'display_name', 'queue', 'comment', 'count', 'state', 'last_published_time' + 'name', 'queue', 'count', 'comment', 'state', 'last_published_time' ], columnsMeta: { name: { + width: '500px', formatterArgs: { can: true } }, - display_name: { - label: 'display_name', - formatter: row => { - return row.meta.display_name ? row.meta.display_name : '-' - } - }, - comment: { - label: 'comment', - formatter: (row) => { - return row.meta.comment - } - }, queue: { - label: 'queue', + width: '120px', + label: this.$t('ops.Queue'), formatter: (row) => { return row.meta.queue } }, + comment: { + width: '300px', + label: this.$t('common.Comment'), + formatter: row => { + return row.meta.comment ? row.meta.comment : '-' + } + }, last_published_time: { + label: this.$t('ops.LastPublishedTime'), width: '210px', formatter: (row) => { return row.last_published_time != null ? row.last_published_time : '-' } }, count: { - label: 'success/total', - width: '120px', + label: `${this.$t('ops.success')}/${this.$t('ops.total')}`, formatter: (row) => { return
- {row.success_count}/ - {row.publish_count} + {row.summary.success}/ + {row.summary.total}
} }, state: { - width: '60px', + label: this.$t('ops.State'), + width: '120px', align: 'center', formatter: (row) => { switch (row.state) {