refactor(性能测试): 分享报告显示名称和执行人

This commit is contained in:
CaptainB 2022-03-01 16:59:57 +08:00 committed by shiziyuan9527
parent 545a91fcd1
commit 42c0485eec
4 changed files with 35 additions and 25 deletions

View File

@ -135,10 +135,10 @@
</select>
<select id="getReportTestAndProInfo" resultType="io.metersphere.dto.ReportDTO">
select ltr.id, ltr.name, ltr.test_id as testId, ltr.description,
ltr.create_time as createTime, ltr.update_time as updateTime, ltr.status as status, ltr.test_name as testName,
p.id as projectId, p.name as projectName
select ltr.*,
p.id as projectId, p.name as projectName, user.name as userName
from load_test_report ltr left join load_test lt on ltr.test_id = lt.id join project p on ltr.project_id = p.id
JOIN user on ltr.user_id = user.id
where ltr.id = #{id}
</select>

View File

@ -11,12 +11,12 @@ import io.metersphere.api.service.ApiScenarioReportService;
import io.metersphere.api.service.ShareInfoService;
import io.metersphere.base.domain.IssuesDao;
import io.metersphere.base.domain.LoadTestReportLog;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import io.metersphere.commons.constants.ResourceStatusEnum;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.LogDetailDTO;
import io.metersphere.dto.ReportDTO;
import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.performance.base.*;
import io.metersphere.performance.dto.LoadTestExportJmx;
@ -162,9 +162,9 @@ public class ShareController {
}
@GetMapping("/performance/report/{shareId}/{reportId}")
public LoadTestReportWithBLOBs getLoadTestReport(@PathVariable String shareId, @PathVariable String reportId) {
public ReportDTO getLoadTestReport(@PathVariable String shareId, @PathVariable String reportId) {
//todo
return performanceReportService.getLoadTestReport(reportId);
return performanceReportService.getReportTestAndProInfo(reportId);
}
@GetMapping("/performance/report/content/report_time/{shareId}/{reportId}")

View File

@ -1,30 +1,15 @@
package io.metersphere.dto;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ReportDTO {
public class ReportDTO extends LoadTestReportWithBLOBs {
private String id;
private String testId;
private String name;
private String description;
private Long createTime;
private Long updateTime;
private String status;
private String content;
private String testName;
private String projectId;
private String projectName;
private String userName;
private String triggerMode;
private String maxUsers;
private String avgResponseTime;
private String tps;
private long testStartTime;
private long testEndTime;
private long testDuration;
private String versionName;
}

View File

@ -2,7 +2,26 @@
<ms-container>
<ms-main-container>
<el-card v-loading="result.loading" v-if="show">
<el-row>
<el-row v-if="isShare">
<el-col :span="24">
<div>
<span class="ms-report-time-desc-share">{{ $t('commons.name') }}{{ report.name }}</span>
<span class="ms-report-time-desc-share">{{ $t('commons.executor') }}{{ report.userName }}</span>
</div>
<div>
<span class="ms-report-time-desc-share">{{ $t('report.test_duration', [minutes, seconds]) }}</span>
<span class="ms-report-time-desc-share" v-if="startTime !== '0'">
{{ $t('report.test_start_time') }}{{ startTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc-share" v-else>{{ $t('report.test_start_time') }}-</span>
<span class="ms-report-time-desc-share" v-if="report.status === 'Completed' && endTime !== '0'">
{{ $t('report.test_end_time') }}{{ endTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc-share" v-else>{{ $t('report.test_end_time') }}- </span>
</div>
</el-col>
</el-row>
<el-row v-else>
<el-col :span="16">
<el-row v-if="!isPlanReport">
<el-breadcrumb separator-class="el-icon-arrow-right">
@ -271,7 +290,7 @@ export default {
this.seconds = '0';
this.$nextTick(() => {
this.show = true;
})
});
},
stopTest(forceStop) {
this.result = this.$get('/performance/stop/' + this.reportId + '/' + forceStop, () => {
@ -427,6 +446,12 @@ export default {
color: #5C7878;
}
.ms-report-time-desc-share {
text-align: left;
color: #5C7878;
padding-right: 20px;
}
.report-export .el-card {
margin-bottom: 15px;
}