mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-20 02:31:43 +00:00
perf: 统计任务执行结果
This commit is contained in:
@@ -82,16 +82,18 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
<b>{{ $tc('ops.output') }}:</b>
|
<b>{{ $tc('ops.output') }}:</b>
|
||||||
<span v-if="executionInfo.status" style="float: right">
|
<span v-if="executionInfo.status && summary" style="float: right">
|
||||||
<span>
|
<span>
|
||||||
<span><b>{{ $tc('common.Status') }}: </b></span>
|
<span><b>{{ $tc('common.Status') }}: </b></span>
|
||||||
<span
|
<span
|
||||||
:class="{
|
v-if="executionInfo.status==='timeout'"
|
||||||
'status_success':executionInfo.status==='success',
|
class="status_warning"
|
||||||
'status_warning':executionInfo.status==='timeout',
|
>{{ $tc('ops.timeout') }}</span>
|
||||||
'status_danger':executionInfo.status==='failed'
|
<span v-else>
|
||||||
}"
|
<span class="status_success">{{ $tc('ops.success') + ': ' + summary.success }}</span>
|
||||||
>{{ $tc('ops.' + executionInfo.status) }}</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>
|
<span>
|
||||||
<span><b>{{ $tc('ops.timeDelta') }}: </b></span>
|
<span><b>{{ $tc('ops.timeDelta') }}: </b></span>
|
||||||
@@ -210,7 +212,12 @@ export default {
|
|||||||
ShowProgress: false,
|
ShowProgress: false,
|
||||||
upload_interval: null,
|
upload_interval: null,
|
||||||
uploadFileList: [],
|
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: {
|
computed: {
|
||||||
@@ -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() {
|
getTaskStatus() {
|
||||||
getTaskDetail(this.currentTaskId).then(data => {
|
getTaskDetail(this.currentTaskId).then(data => {
|
||||||
this.executionInfo.status = data['status']
|
this.executionInfo.status = data['status']
|
||||||
|
this.taskStatusStat(data['summary'])
|
||||||
if (this.executionInfo.status === 'success') {
|
if (this.executionInfo.status === 'success') {
|
||||||
this.$message.success(this.$tc('ops.runSucceed'))
|
this.$message.success(this.$tc('ops.runSucceed'))
|
||||||
clearInterval(this.upload_interval)
|
clearInterval(this.upload_interval)
|
||||||
@@ -334,11 +353,11 @@ export default {
|
|||||||
const filenameList = fileList.map((file) => file.name)
|
const filenameList = fileList.map((file) => file.name)
|
||||||
const filenameCount = _.countBy(filenameList)
|
const filenameCount = _.countBy(filenameList)
|
||||||
for (const file of fileList) {
|
for (const file of fileList) {
|
||||||
file.is_same = filenameCount[file.name] > 1
|
file.isSame = filenameCount[file.name] > 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sameFileStyle(file) {
|
sameFileStyle(file) {
|
||||||
if (file.is_same) {
|
if (file.isSame) {
|
||||||
return { backgroundColor: 'var(--color-danger)' }
|
return { backgroundColor: 'var(--color-danger)' }
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
@@ -362,7 +381,7 @@ export default {
|
|||||||
execute() {
|
execute() {
|
||||||
const { hosts, nodes } = this.getSelectedNodesAndHosts()
|
const { hosts, nodes } = this.getSelectedNodesAndHosts()
|
||||||
for (const file of this.uploadFileList) {
|
for (const file of this.uploadFileList) {
|
||||||
if (file.is_same) {
|
if (file.isSame) {
|
||||||
this.$message.error(this.$tc('ops.DuplicateFileExists'))
|
this.$message.error(this.$tc('ops.DuplicateFileExists'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -476,7 +495,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.status_success {
|
.status_success {
|
||||||
color: var(--color-success);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.status_warning {
|
.status_warning {
|
||||||
|
@@ -80,8 +80,7 @@ export default {
|
|||||||
timeCost: 0,
|
timeCost: 0,
|
||||||
cancel: 0
|
cancel: 0
|
||||||
},
|
},
|
||||||
xtermConfig: {
|
xtermConfig: {},
|
||||||
},
|
|
||||||
showHelpDialog: false,
|
showHelpDialog: false,
|
||||||
showOpenAdhocDialog: false,
|
showOpenAdhocDialog: false,
|
||||||
showOpenAdhocSaveDialog: false,
|
showOpenAdhocSaveDialog: false,
|
||||||
@@ -484,7 +483,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.status_success {
|
.status_success {
|
||||||
color: var(--color-success);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.status_warning {
|
.status_warning {
|
||||||
|
Reference in New Issue
Block a user