Skip to content

Commit

Permalink
perf: 统计任务执行结果
Browse files Browse the repository at this point in the history
  • Loading branch information
w940853815 committed Dec 22, 2023
1 parent a36a9e7 commit f2e055e
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions src/views/ops/File/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,18 @@
</el-card>
</div>
<b>{{ $tc('ops.output') }}:</b>
<span v-if="executionInfo.status" style="float: right">
<span v-if="executionInfo.status && summary" style="float: right">
<span>
<span><b>{{ $tc('common.Status') }}: </b></span>
<span
:class="{
'status_success':executionInfo.status==='success',
'status_warning':executionInfo.status==='timeout',
'status_danger':executionInfo.status==='failed'
}"
>{{ $tc('ops.' + executionInfo.status) }}</span>
v-if="executionInfo.status==='timeout'"
class="status_warning"
>{{ $tc('ops.timeout') }}</span>
<span v-else>
<span class="status_success">{{ $tc('ops.success') + ': ' + summary.success }}</span>
<span class="status_warning">{{ $tc('ops.Skip') + ': ' + summary.skip }}</span>
<span class="status_danger">{{ $tc('ops.failed') + ': ' + summary.failed }}</span>
</span>
</span>
<span>
<span><b>{{ $tc('ops.timeDelta') }}: </b></span>
Expand Down Expand Up @@ -210,7 +212,12 @@ export default {
ShowProgress: false,
upload_interval: null,
uploadFileList: [],
SizeLimitMb: store.getters.publicSettings['FILE_UPLOAD_SIZE_LIMIT_MB']
SizeLimitMb: store.getters.publicSettings['FILE_UPLOAD_SIZE_LIMIT_MB'],
summary: {
'success': 0,
'failed': 0,
'skip': 0
}
}
},
computed: {
Expand Down Expand Up @@ -273,9 +280,15 @@ export default {
}
}
},
taskStatusStat(summary) {
this.summary['success'] = summary['ok'].length
this.summary['failed'] = Object.keys(summary['failures']).length + Object.keys(summary['dark']).length
this.summary['skip'] = Object.keys(summary['excludes']).length + summary['skipped'].length
},
getTaskStatus() {
getTaskDetail(this.currentTaskId).then(data => {
this.executionInfo.status = data['status']
this.taskStatusStat(data['summary'])
if (this.executionInfo.status === 'success') {
this.$message.success(this.$tc('ops.runSucceed'))
clearInterval(this.upload_interval)
Expand Down Expand Up @@ -334,11 +347,11 @@ export default {
const filenameList = fileList.map((file) => file.name)
const filenameCount = _.countBy(filenameList)
for (const file of fileList) {
file.is_same = filenameCount[file.name] > 1
file.isSame = filenameCount[file.name] > 1
}
},
sameFileStyle(file) {
if (file.is_same) {
if (file.isSame) {
return { backgroundColor: 'var(--color-danger)' }
}
return ''
Expand All @@ -362,7 +375,7 @@ export default {
execute() {
const { hosts, nodes } = this.getSelectedNodesAndHosts()
for (const file of this.uploadFileList) {
if (file.is_same) {
if (file.isSame) {
this.$message.error(this.$tc('ops.DuplicateFileExists'))
return
}
Expand Down

0 comments on commit f2e055e

Please sign in to comment.