refactor(性能测试): 报告显示时间为 x时x分x秒

This commit is contained in:
CaptainB 2022-11-26 15:45:30 +08:00
parent ec4fd23cd0
commit 40f7049efd
5 changed files with 18 additions and 11 deletions

View File

@ -64,7 +64,7 @@
</el-col>
<el-col :span="6">
<span class="ms-report-time-desc">
{{ $t('report.test_duration', [this.minutes, this.seconds]) }}
{{ $t('report.test_duration', [this.hours, this.minutes, this.seconds]) }}
</span>
<span class="ms-report-time-desc" v-if="startTime !== '0'">
{{ $t('report.test_start_time') }}{{ startTime | timestampFormatDate }}
@ -194,6 +194,7 @@ export default {
projectName: '',
startTime: '0',
endTime: '0',
hours: '0',
minutes: '0',
seconds: '0',
title: 'Logging',
@ -251,7 +252,8 @@ export default {
this.startTime = data.startTime;
this.endTime = data.endTime;
let duration = data.duration;
this.minutes = Math.floor(duration / 60);
this.hours = Math.floor(duration / 60 / 60);
this.minutes = Math.floor(duration / 60 % 60);
this.seconds = duration % 60;
}
}).catch(() => {

View File

@ -104,6 +104,7 @@
:label="$t('report.test_end_time')">
<template v-slot:default="scope">
<span v-if="scope.row.status === 'Completed'">{{ scope.row.testEndTime | timestampFormatDate }}</span>
<span v-else>-</span>
</template>
</ms-table-column>
<ms-table-column
@ -113,10 +114,7 @@
:fields-width="fieldsWidth"
:label="$t('report.test_execute_time')">
<template v-slot:default="scope">
<span v-if="scope.row.status === 'Completed'">
{{ scope.row.minutes }}{{ $t('schedule.cron.minutes') }}
{{ scope.row.seconds }}{{ $t('schedule.cron.seconds') }}
</span>
{{ $t('report.test_duration_tip', [scope.row.hours, scope.row.minutes, scope.row.seconds]) }}
</template>
</ms-table-column>
<ms-table-column
@ -285,8 +283,10 @@ export default {
handleTimeInfo(report) {
if (report.testStartTime) {
let duration = report.testDuration;
let minutes = Math.floor(duration / 60);
let hours = Math.floor(duration / 60 / 60);
let minutes = Math.floor(duration / 60 % 60);
let seconds = duration % 60;
this.$set(report, 'hours', hours);
this.$set(report, 'minutes', minutes);
this.$set(report, 'seconds', seconds);
}
@ -296,10 +296,12 @@ export default {
let data = res.data.data;
if (data) {
let duration = data.duration;
let minutes = Math.floor(duration / 60);
let hours = Math.floor(duration / 60 / 60);
let minutes = Math.floor(duration / 60 % 60);
let seconds = duration % 60;
this.$set(report, 'testStartTime', data.startTime);
this.$set(report, 'testEndTime', data.endTime);
this.$set(report, 'hours', hours);
this.$set(report, 'minutes', minutes);
this.$set(report, 'seconds', seconds);
}

View File

@ -953,7 +953,8 @@ export default {
test_monitor_details: 'Test Monitor Details',
test_config: 'Test Configuration',
test_details: 'Test Details',
test_duration: 'Execution Time{0} minutes {1} seconds',
test_duration: 'Execution Time{0} hours {1} minutes {2} seconds',
test_duration_tip: '{0} hours {1} minutes {2} seconds',
test_execute_time: 'Execution Time',
test_start_time: 'Start Time',
test_end_time: 'End Time',

View File

@ -957,7 +957,8 @@ export default {
test_monitor_details: '监控详情',
test_config: '测试配置',
test_details: '测试详情',
test_duration: '执行时长:{0} 分钟 {1} 秒',
test_duration: '执行时长:{0}时{1}分{2}秒',
test_duration_tip: '{0}时{1}分{2}秒',
test_execute_time: '执行时长',
test_start_time: '开始时间',
test_end_time: '结束时间',

View File

@ -957,7 +957,8 @@ export default {
test_monitor_details: '監控詳情',
test_config: '測試配置',
test_details: '測試詳情',
test_duration: '執行時長:{0} 分鐘 {1} 秒',
test_duration: '執行時長:{0}時{1}分{2}秒',
test_duration_tip: '{0}時{1}分{2}秒',
test_execute_time: '執行時長',
test_start_time: '開始時間',
test_end_time: '結束時間',