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 9e30b02
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
43 changes: 31 additions & 12 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,21 @@ export default {
}
}
},
taskStatusStat(summary) {
const { ok, failures, dark, excludes, skipped } = summary
const failedKeys = Object.keys(failures)
const darkKeys = Object.keys(dark)
const excludesKeys = Object.keys(excludes)
this.summary['success'] = ok.length
this.summary['failed'] = failedKeys.length + darkKeys.length
this.summary['skip'] = excludesKeys.length + 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 +353,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 +381,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 Expand Up @@ -476,7 +495,7 @@ export default {
}
.status_success {
color: var(--color-success);
color: var(--color-primary);
}
.status_warning {
Expand Down
5 changes: 2 additions & 3 deletions src/views/ops/Job/QuickJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ export default {
timeCost: 0,
cancel: 0
},
xtermConfig: {
},
xtermConfig: {},
showHelpDialog: false,
showOpenAdhocDialog: false,
showOpenAdhocSaveDialog: false,
Expand Down Expand Up @@ -484,7 +483,7 @@ export default {
}
.status_success {
color: var(--color-success);
color: var(--color-primary);
}
.status_warning {
Expand Down

0 comments on commit 9e30b02

Please sign in to comment.