diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index e0a331eb36..a4dd7b2462 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -69,6 +69,7 @@ public class ApiDefinitionController { request.setToBeUpdateTime(toBeUpdatedTime); } } + apiDefinitionService.checkFilterHasCoverage(request); Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, apiDefinitionService.list(request)); } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 822cbe4fdc..a9f903f42d 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -326,6 +326,16 @@ public class ApiDefinitionService { } } } + return request; + } + + /** + * 检查请求中是否含有覆盖率的查询 + * + * @param request + * @return + */ + public ApiDefinitionRequest checkFilterHasCoverage(ApiDefinitionRequest request) { if (StringUtils.isNotEmpty(request.getProjectId())) { List definitionList = null; if (StringUtils.equalsAnyIgnoreCase(request.getApiCoverage(), "uncoverage", "coverage")) { diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReferenceIdMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReferenceIdMapper.xml index c7e4eef303..367a4dec05 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReferenceIdMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReferenceIdMapper.xml @@ -10,7 +10,7 @@ != 'Trash' AND project_id = #{0} AND latest = 1) - AND reference_id IS NOT NULL; + AND reference_id IS NOT NULL \ No newline at end of file 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 0a6fcb38ef..5dbd67092f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -36,9 +36,9 @@ import io.metersphere.performance.service.MetricQueryService; import io.metersphere.performance.service.PerformanceReportService; import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.service.*; -import io.metersphere.track.factory.ReportComponentFactory; import io.metersphere.track.domain.ReportComponent; import io.metersphere.track.dto.*; +import io.metersphere.track.factory.ReportComponentFactory; import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest; import io.metersphere.track.request.testcase.QueryTestPlanRequest; import io.metersphere.track.request.testplan.AddTestPlanRequest; @@ -1441,7 +1441,17 @@ public class TestPlanService { ApiDefinitionExecResultWithBLOBs result = extApiDefinitionExecResultMapper.selectPlanApiMaxResultByTestIdAndType(apiCase.getId(), "API_PLAN"); if (result != null && StringUtils.isNotBlank(result.getContent())) { apiCase.setReportId(result.getId()); - apiCase.setResponse(result.getContent()); + String contentStr = result.getContent(); + try { + JSONObject content = JSONObject.parseObject(contentStr); + if (StringUtils.isNotEmpty(contentStr)) { + content.put("envName", apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig())); + } + contentStr = content.toString(); + apiCase.setResponse(contentStr); + } catch (Exception e) { + LogUtil.error("解析content失败!", e); + } } } else { reportIds.add(apiCase.getReportId()); @@ -1461,7 +1471,7 @@ public class TestPlanService { if (StringUtils.isNotEmpty(execResult.getEnvConfig())) { responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig())); } - item.setResponse(resultMap.get(item.getReportId()).getContent()); + item.setResponse(responseObj.toString()); } }); } diff --git a/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue b/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue index 820ae4c82b..2cfbc5b9f6 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue @@ -63,30 +63,45 @@ - +
+
+ {{ $t('commons.environment') + ':' }} +
+ {{ key + ":" }} + +
+
+ +
+
+
+
+ {{ - $t('report.test_duration', [templateMinutes ? templateMinutes : minutes, - templateSeconds ? templateSeconds : seconds]) - }} + $t('report.test_duration', [templateMinutes ? templateMinutes : minutes, + templateSeconds ? templateSeconds : seconds]) + }} - + {{ $t('report.test_start_time') }}:{{ startTime | timestampFormatDate }} - + {{ $t('report.test_start_time') }}:{{ planReportTemplate.startTime | timestampFormatDate }} - + {{ $t('report.test_start_time') }}:- - + {{ $t('report.test_end_time') }}:{{ endTime | timestampFormatDate }} - + {{ $t('report.test_end_time') }}:{{ planReportTemplate.endTime | timestampFormatDate }} - + {{ $t('report.test_end_time') }}:- +
diff --git a/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue b/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue index d7d708f651..bfa744634c 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent.vue @@ -31,7 +31,6 @@ import TestPlanFunctionalReport from "@/business/components/track/plan/view/comonents/report/detail/TestPlanFunctionalReport"; import { - getExportReport, getShareTestPlanReport, getShareTestPlanReportContent, getTestPlanReport, @@ -50,6 +49,7 @@ import TestPlanReportNavigationBar from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportNavigationBar"; import MsContainer from "@/business/components/common/components/MsContainer"; import MsMainContainer from "@/business/components/common/components/MsMainContainer"; + export default { name: "TestPlanReportContent", components: {