diff --git a/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java b/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java index b882bf7915..dee4dc6f1c 100644 --- a/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java +++ b/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java @@ -1,12 +1,16 @@ package io.metersphere.dto; +import io.metersphere.base.domain.LoadTestReportLog; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter public class LogDetailDTO { private String resourceId; private String resourceName; private String content; + private List reportLogs; } diff --git a/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java index 675fdb4703..7b2a995cc8 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java @@ -1,9 +1,9 @@ package io.metersphere.track.dto; import io.metersphere.base.domain.LoadTestReportWithBLOBs; -import io.metersphere.base.domain.TestPlanLoadCase; import io.metersphere.base.domain.TestPlanLoadCaseWithBLOBs; import io.metersphere.dto.LogDetailDTO; +import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.performance.base.*; import io.metersphere.performance.dto.LoadTestExportJmx; import io.metersphere.performance.dto.MetricData; @@ -35,7 +35,7 @@ public class TestPlanLoadCaseDTO extends TestPlanLoadCaseWithBLOBs { private long startTime; private long endTime; private String fixLoadConfiguration; -// private LoadTestExportJmx jmxContent; + // private LoadTestExportJmx jmxContent; private List fixJmxContent; private TestOverview testOverview; private List loadChartData; @@ -48,6 +48,7 @@ public class TestPlanLoadCaseDTO extends TestPlanLoadCaseWithBLOBs { private List reportErrorsTop5; private List reportLogResource; private List reportResource; - private List metricData; + private List metricData; + private List resourcePools; } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 292d7a1c12..036e9e62f9 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -194,6 +194,8 @@ public class TestPlanService { private ExtTestPlanApiScenarioMapper extTestPlanApiScenarioMapper; @Resource private ExtTestPlanUiScenarioMapper extTestPlanUiScenarioMapper; + @Resource + private TestResourcePoolService testResourcePoolService; public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) { if (getTestPlanByName(testPlan.getName()).size() > 0) { @@ -1664,9 +1666,8 @@ public class TestPlanService { List jmxContent = performanceReportService.getJmxContent(reportId); if (!CollectionUtils.isEmpty(jmxContent)) { response.setJmxContent(JSONObject.toJSONString(jmxContent.get(0))); + response.setFixJmxContent(jmxContent); } - List fixJmxContent = performanceTestService.getJmxContent(item.getId()); - response.setFixJmxContent(fixJmxContent); // 概览 TestOverview testOverview = performanceReportService.getTestOverview(reportId); @@ -1711,9 +1712,15 @@ public class TestPlanService { // 日志详情 List reportLogResource = performanceReportService.getReportLogResource(reportId); + if (CollectionUtils.isNotEmpty(reportLogResource)) { + for (LogDetailDTO log : reportLogResource) { + List reportLogs = performanceReportService.getReportLogs(reportId, log.getResourceId()); + log.setReportLogs(reportLogs); + } + } response.setReportLogResource(reportLogResource); -// performanceReportService.getReportLogs(reportId, resourceId); - + List testResourcePoolDTOS = testResourcePoolService.listValidQuotaResourcePools(); + response.setResourcePools(testResourcePoolDTOS); List reportResource = metricQueryService.queryReportResource(reportId); response.setReportResource(reportResource); List metricData = metricQueryService.queryMetric(reportId); diff --git a/frontend/src/business/components/performance/report/components/LogDetails.vue b/frontend/src/business/components/performance/report/components/LogDetails.vue index ca4a17d3dd..229f22f6a8 100644 --- a/frontend/src/business/components/performance/report/components/LogDetails.vue +++ b/frontend/src/business/components/performance/report/components/LogDetails.vue @@ -85,7 +85,13 @@ export default { } this.loading = true; if (this.planReportTemplate) { - // this.handleGetLogResourceDetail(this.planReportTemplate.logResourceDetail, resourceId); + let {reportLogResource} = this.planReportTemplate; + if (reportLogResource && reportLogResource.length > 0) { + let {reportLogs} = reportLogResource[0]; + if (reportLogs) { + this.handleGetPlanTemplateLog(reportLogs); + } + } } else if (this.isShare) { getSharePerformanceReportLogResourceDetail(this.shareId, this.id, resourceId, this.page || 1, data => { this.handleGetLogResourceDetail(data, resourceId); @@ -96,6 +102,14 @@ export default { }); } }, + handleGetPlanTemplateLog(data) { + data.forEach(log => { + if (this.logContent) { + this.logContent.push(log); + } + }); + this.loading = false; + }, handleGetLogResourceDetail(data, resourceId) { data.listObject.forEach(log => { if (this.logContent) { diff --git a/frontend/src/business/components/performance/report/components/TestConfiguration.vue b/frontend/src/business/components/performance/report/components/TestConfiguration.vue index 8531cf5c80..acf6df1729 100644 --- a/frontend/src/business/components/performance/report/components/TestConfiguration.vue +++ b/frontend/src/business/components/performance/report/components/TestConfiguration.vue @@ -1,11 +1,11 @@