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 }} +
+
+