From 912f95074b59238146435405eaadf9f838d52120 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 12 Oct 2022 18:25:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=8A=A5=E5=91=8A=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=90=8E=E5=9C=BA=E6=99=AF=E7=AD=89=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShareTestPlanApiReportController.java | 27 + .../plan/TestPlanScenarioCaseController.java | 2 +- .../plan/TestPlanScenarioCaseService.java | 2 +- .../automation/report/ApiReportDetail.vue | 4 +- .../automation/report/ApiReportExport.vue | 2 +- .../automation/report/ApiReportViewHeader.vue | 6 +- .../report/components/RequestResult.vue | 8 +- .../report/components/ResponseText.vue | 4 +- .../report/components/ScenarioResult.vue | 4 +- .../components/response/RequestResultTail.vue | 2 +- .../components/response/ResponseResult.vue | 2 +- .../TestPlanLoadCaseController.java | 2 +- .../business/report/components/LogDetails.vue | 4 +- .../report/components/RequestStatistics.vue | 2 +- .../report/components/TestConfiguration.vue | 6 +- .../business/test/components/ExistFiles.vue | 4 +- .../test/components/ExistScenarios.vue | 4 +- .../components/PerformanceAdvancedConfig.vue | 6 +- .../components/PerformanceBasicConfig.vue | 8 +- .../components/PerformancePressureConfig.vue | 4 +- .../performance/share/LoadCaseReportView.vue | 22 +- .../business/plan/view/comonents/api/Run.vue | 210 ------- .../comonents/api/TestPlanApiCaseList.vue | 9 +- .../view/comonents/load/LoadCaseReport.vue | 39 -- .../comonents/load/LoadCaseReportView.vue | 546 ------------------ .../detail/component/ApiCaseFailureResult.vue | 19 +- .../component/ApiScenarioFailureResult.vue | 40 +- .../report/detail/component/LoadAllResult.vue | 25 +- test-track/frontend/vue.config.js | 2 +- 29 files changed, 142 insertions(+), 873 deletions(-) create mode 100644 api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java delete mode 100644 test-track/frontend/src/business/plan/view/comonents/api/Run.vue delete mode 100644 test-track/frontend/src/business/plan/view/comonents/load/LoadCaseReport.vue delete mode 100644 test-track/frontend/src/business/plan/view/comonents/load/LoadCaseReportView.vue diff --git a/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java b/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java new file mode 100644 index 0000000000..03119c4334 --- /dev/null +++ b/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java @@ -0,0 +1,27 @@ +package io.metersphere.controller.plan; + +import io.metersphere.api.dto.ApiReportResult; +import io.metersphere.service.BaseShareInfoService; +import io.metersphere.service.definition.ApiDefinitionService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("/share/test/plan/api/case") +public class ShareTestPlanApiReportController { + + @Resource + ApiDefinitionService apiDefinitionService; + @Resource + BaseShareInfoService baseShareInfoService; + + @GetMapping("/api/definition/report/getReport/{shareId}/{testId}") + public ApiReportResult getApiReport(@PathVariable String shareId, @PathVariable String testId) { + baseShareInfoService.validateExpired(shareId); + return apiDefinitionService.getDbResult(testId); + } +} diff --git a/api-test/backend/src/main/java/io/metersphere/controller/plan/TestPlanScenarioCaseController.java b/api-test/backend/src/main/java/io/metersphere/controller/plan/TestPlanScenarioCaseController.java index e67122809e..44eb63c3c1 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/plan/TestPlanScenarioCaseController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/plan/TestPlanScenarioCaseController.java @@ -175,7 +175,7 @@ public class TestPlanScenarioCaseController { return testPlanScenarioCaseService.getApiScenarioEnv(planId); } - @GetMapping("/plan/report") + @PostMapping("/plan/report") public ApiPlanReportDTO buildApiReport(@RequestBody ApiPlanReportRequest request) { return testPlanScenarioCaseService.buildApiReport(request); } diff --git a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java index f223dd9a03..84bed5476a 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanScenarioCaseService.java @@ -863,7 +863,7 @@ public class TestPlanScenarioCaseService { if (StringUtils.isNotEmpty(contentStr)) { content.put("envName", apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig())); } - contentStr = content.toString(); + contentStr = JSON.toJSONString(content); apiCase.setResponse(contentStr); } catch (Exception e) { LogUtil.error("解析content失败!", e); diff --git a/api-test/frontend/src/business/automation/report/ApiReportDetail.vue b/api-test/frontend/src/business/automation/report/ApiReportDetail.vue index 82fc2fcb58..04a7060d9f 100644 --- a/api-test/frontend/src/business/automation/report/ApiReportDetail.vue +++ b/api-test/frontend/src/business/automation/report/ApiReportDetail.vue @@ -121,8 +121,8 @@ import {RequestFactory} from "../../definition/model/ApiTestModel"; import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; import {getUUID, windowPrint} from "metersphere-frontend/src/utils"; import {hasLicense} from "metersphere-frontend/src/utils/permission"; -import {getScenarioReport, getScenarioReportDetail, getShareScenarioReport, reportReName} from "@/api/scenario-report"; -import {STEP} from "@/business/automation/scenario/Setting"; +import {getScenarioReport, getScenarioReportDetail, getShareScenarioReport, reportReName} from "../../../api/scenario-report"; +import {STEP} from "../../automation/scenario/Setting"; import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit"; export default { diff --git a/api-test/frontend/src/business/automation/report/ApiReportExport.vue b/api-test/frontend/src/business/automation/report/ApiReportExport.vue index 0f8eda8b15..e5b959793a 100644 --- a/api-test/frontend/src/business/automation/report/ApiReportExport.vue +++ b/api-test/frontend/src/business/automation/report/ApiReportExport.vue @@ -87,7 +87,7 @@ import ApiReportReqestHeaderItem from "./ApiReportReqestHeaderItem"; import MsMetricChart from "./components/MetricChart"; import MsReportTitle from "metersphere-frontend/src/components/report/MsReportTitle"; import MsReportExportTemplate from "metersphere-frontend/src/components/report/MsReportExportTemplate"; -import MsAssertionResults from "@/business/automation/report/components/AssertionResults" +import MsAssertionResults from "../../../business/automation/report/components/AssertionResults" export default { name: "MsApiReportExport", diff --git a/api-test/frontend/src/business/automation/report/ApiReportViewHeader.vue b/api-test/frontend/src/business/automation/report/ApiReportViewHeader.vue index 2bff08df1f..6261e52d45 100644 --- a/api-test/frontend/src/business/automation/report/ApiReportViewHeader.vue +++ b/api-test/frontend/src/business/automation/report/ApiReportViewHeader.vue @@ -79,11 +79,11 @@ diff --git a/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue b/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue index 42e238a7e3..19ff319b49 100644 --- a/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -158,10 +158,6 @@ - - - - - - - - - - - diff --git a/test-track/frontend/src/business/plan/view/comonents/load/LoadCaseReportView.vue b/test-track/frontend/src/business/plan/view/comonents/load/LoadCaseReportView.vue deleted file mode 100644 index b0998ff020..0000000000 --- a/test-track/frontend/src/business/plan/view/comonents/load/LoadCaseReportView.vue +++ /dev/null @@ -1,546 +0,0 @@ - - - - - - diff --git a/test-track/frontend/src/business/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue b/test-track/frontend/src/business/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue index 36d907ea90..99e8b9dfcc 100644 --- a/test-track/frontend/src/business/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue +++ b/test-track/frontend/src/business/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue @@ -49,21 +49,31 @@ - - + + + + + + -
{{ $t('test_track.plan.load_case.content_empty') }}