fix: 性能测试报告报错

This commit is contained in:
chenjianxing 2021-08-25 09:54:03 +08:00 committed by jianxing
parent 7dcc7de2ed
commit 52fad8d632
3 changed files with 30 additions and 8 deletions

View File

@ -10,7 +10,9 @@ import io.metersphere.api.service.ShareInfoService;
import io.metersphere.base.domain.IssuesDao;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import io.metersphere.performance.base.ReportTimeInfo;
import io.metersphere.performance.dto.LoadTestExportJmx;
import io.metersphere.performance.service.PerformanceReportService;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
import io.metersphere.track.dto.TestPlanSimpleReportDTO;
@ -47,6 +49,8 @@ public class ShareController {
ShareInfoService shareInfoService;
@Resource
PerformanceReportService performanceReportService;
@Resource
PerformanceTestService performanceTestService;
@GetMapping("/issues/plan/get/{shareId}/{planId}")
public List<IssuesDao> getIssuesByPlanoId(@PathVariable String shareId, @PathVariable String planId) {
@ -144,5 +148,15 @@ public class ShareController {
return testPlanLoadCaseService.isExistReport(request);
}
@GetMapping("/performance/report/get-jmx-content/{reportId}")
public LoadTestExportJmx getJmxContent(@PathVariable String reportId) {
return performanceReportService.getJmxContent(reportId);
}
@GetMapping("/performance/get-jmx-content/{testId}")
public List<LoadTestExportJmx> getOldJmxContent(@PathVariable String testId) {
// checkPermissionService.checkPerformanceTestOwner(testId);
return performanceTestService.getJmxContent(testId);
}
}

View File

@ -154,9 +154,10 @@ import echarts from "echarts";
import MsChart from "@/business/components/common/chart/MsChart";
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
import {
getOldPerformanceJmxContent,
getPerformanceJmxContent,
getPerformanceLoadConfig,
getPerformanceReport, getSharePerformanceJmxContent,
getPerformanceReport, getShareOldPerformanceJmxContent, getSharePerformanceJmxContent,
getSharePerformanceLoadConfig,
getSharePerformanceReport
} from "@/network/load-test";
@ -360,21 +361,21 @@ export default {
if (!threadGroups || threadGroups.length === 0) {
if (this.planReportTemplate) {
//todo
if (this.planReportTemplate.jmxContentFix) {
this.calculateLoadConfiguration(this.planReportTemplate.jmxContentFix);
if (this.planReportTemplate.oldJmxContent) {
this.calculateLoadConfiguration(this.planReportTemplate.oldJmxContent);
}
} else if (this.isShare){
this.result = getSharePerformanceJmxContent(this.shareId, this.report.id, data => {
data.forEach(d => this._handleGetJmxContent(d, threadGroups));
this.result = getShareOldPerformanceJmxContent(this.shareId, this.report.testId, data => {
data.forEach(d => this.handleGetOldJmxContent(d, threadGroups));
});
} else {
this.result = getPerformanceJmxContent(this.report.id, data => {
data.forEach(d => this._handleGetJmxContent(d, threadGroups));
this.result = getOldPerformanceJmxContent(this.report.testId, data => {
data.forEach(d => this.handleGetOldJmxContent(d, threadGroups));
});
}
}
},
_handleGetJmxContent(d, threadGroups) {
handleGetOldJmxContent(d, threadGroups) {
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
threadGroups.forEach(tg => {
tg.options = {};

View File

@ -27,3 +27,10 @@ export function getPerformanceJmxContent(reportId, callback) {
export function getSharePerformanceJmxContent(shareId, reportId, callback) {
return reportId ? baseGet('/share/performance/report/get-jmx-content/' + shareId + '/' + reportId, callback) : {};
}
export function getOldPerformanceJmxContent(testId, callback) {
return testId ? baseGet('/performance/get-jmx-content/' + testId, callback) : {};
}
export function getShareOldPerformanceJmxContent(testId, callback) {
return testId ? baseGet('/performance/get-jmx-content/' + testId, callback) : {};
}