diff --git a/backend/src/main/java/io/metersphere/controller/ShareController.java b/backend/src/main/java/io/metersphere/controller/ShareController.java index 8894db4df3..cb6cd0ec3c 100644 --- a/backend/src/main/java/io/metersphere/controller/ShareController.java +++ b/backend/src/main/java/io/metersphere/controller/ShareController.java @@ -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 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 getOldJmxContent(@PathVariable String testId) { +// checkPermissionService.checkPerformanceTestOwner(testId); + return performanceTestService.getJmxContent(testId); + } } diff --git a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue index 3824574807..587bc75008 100644 --- a/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/report/components/PerformancePressureConfig.vue @@ -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 = {}; diff --git a/frontend/src/network/load-test.js b/frontend/src/network/load-test.js index e30e2eb474..bdd5625bcf 100644 --- a/frontend/src/network/load-test.js +++ b/frontend/src/network/load-test.js @@ -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) : {}; +}