From 26c4537417a3b09cc6785fb8c3246163938f7078 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 16 Jan 2023 14:24:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=8A=A5=E5=91=8A=E7=94=A8=E4=BE=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=B1=A0=E7=8E=AF=E5=A2=83=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1021983 --user=王孝刚 【测试跟踪】导出测试计划报告-接口用例-运行环境和资源池显示有问题 https://www.tapd.cn/55049933/s/1327574 --- .../service/plan/TestPlanApiCaseService.java | 13 ++++++++-- .../report/detail/api/ApiReportDetail.vue | 9 +++++-- .../report/detail/api/ApiReportViewHeader.vue | 14 ++++++++++- .../report/detail/api/RequestMetric.vue | 25 +++++++++++++------ 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java index f850abefe5..620a8ea842 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/plan/TestPlanApiCaseService.java @@ -4,6 +4,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.ApiCaseRelevanceRequest; +import io.metersphere.api.dto.ApiReportEnvConfigDTO; import io.metersphere.api.dto.EnvironmentType; import io.metersphere.api.dto.QueryReferenceRequest; import io.metersphere.api.dto.automation.TestPlanDTO; @@ -413,7 +414,11 @@ public class TestPlanApiCaseService { try { Map content = JSON.parseMap(contentStr); if (StringUtils.isNotEmpty(contentStr)) { - content.put("envName", apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig())); + ApiReportEnvConfigDTO envConfig = apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig()); + if (envConfig != null) { + content.put("envName", envConfig.getEnvName()); + content.put("poolName", envConfig.getResourcePoolName()); + } } contentStr = JSON.toJSONString(content); apiCase.setResponse(contentStr); @@ -442,7 +447,11 @@ public class TestPlanApiCaseService { LogUtil.error("转换content失败!", e); } if (StringUtils.isNotEmpty(execResult.getEnvConfig())) { - responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig())); + ApiReportEnvConfigDTO envConfig = apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig()); + if (envConfig != null) { + responseObj.put("envName", envConfig.getEnvName()); + responseObj.put("poolName", envConfig.getResourcePoolName()); + } } /* * 之前这里的写法是responseObj.toString()。 diff --git a/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportDetail.vue b/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportDetail.vue index bf5b991e61..6b2d4df81b 100644 --- a/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportDetail.vue +++ b/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportDetail.vue @@ -11,6 +11,7 @@ :is-template="isTemplate" :debug="debug" :report="report" + :pool-name="poolName" :project-env-map="projectEnvMap" @reportExport="handleExport" @reportSave="handleSave"/> @@ -97,6 +98,7 @@ :project-env-map="projectEnvMap" :title="report.name" :content="content" + :pool-name="poolName" :report="report" :total-time="totalTime"/> @@ -119,7 +121,6 @@ import {getUUID, windowPrint} from "metersphere-frontend/src/utils"; import {hasLicense} from "metersphere-frontend/src/utils/permission"; import {STEP} from "metersphere-frontend/src/model/Setting"; import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit"; - export default { name: "MsApiReport", components: { @@ -151,7 +152,8 @@ export default { exportReportIsOk: false, tempResult: [], projectEnvMap: {}, - showCancel: false + showCancel: false, + poolName: '', } }, activated() { @@ -412,6 +414,9 @@ export default { if (report.projectEnvMap) { this.projectEnvMap = report.projectEnvMap; } + if (report.poolName) { + this.poolName = report.poolName; + } this.content = report; this.fullTreeNodes = report.steps; this.content.console = report.console; diff --git a/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportViewHeader.vue b/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportViewHeader.vue index b03370fe34..96d5e0599e 100644 --- a/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportViewHeader.vue +++ b/test-track/frontend/src/business/plan/view/comonents/report/detail/api/ApiReportViewHeader.vue @@ -25,7 +25,18 @@ - + + +
+ {{ $t('load_test.select_resource_pool') + ':' }} +
+
+ {{ this.poolName }} +
+
+ +
+ {{ $t('commons.environment') + ':' }}
{{ key + ":" }} @@ -62,6 +73,7 @@ export default { type: Boolean, default: false, }, + poolName: String, isPlan: Boolean }, computed: { diff --git a/test-track/frontend/src/business/plan/view/comonents/report/detail/api/RequestMetric.vue b/test-track/frontend/src/business/plan/view/comonents/report/detail/api/RequestMetric.vue index fe140bd636..2e92dc34b7 100644 --- a/test-track/frontend/src/business/plan/view/comonents/report/detail/api/RequestMetric.vue +++ b/test-track/frontend/src/business/plan/view/comonents/report/detail/api/RequestMetric.vue @@ -47,13 +47,24 @@
- -
- {{ $t('commons.environment') + ':' }} -
-
- {{ response.envName }} -
+ + +
+ {{ $t('load_test.select_resource_pool') + ':' }} +
+
+ {{ response.poolName }} +
+
+ +
+ {{ $t('commons.environment') + ':' }} +
+
+ {{ response.envName }} +
+
+