From fc1d966cb29b6b76d8f5cdcf01ce50de82da5e6e Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 21 Apr 2022 14:07:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=8A=A8=E6=80=81=E5=88=87=E6=8D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/automation/parse/ApiScenarioImportUtil.java | 2 ++ .../api/automation/scenario/component/PluginComponent.vue | 6 +++--- .../api/definition/components/case/ApiCaseItem.vue | 8 ++++++-- .../api/definition/components/case/ApiCaseList.vue | 8 ++++++-- .../components/request/database/BasisParameters.vue | 5 +---- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java index 745dea0eb4..d2684be30c 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/ApiScenarioImportUtil.java @@ -210,6 +210,7 @@ public class ApiScenarioImportUtil { object.put("resourceId", test.getId()); object.put("projectId", projectId); object.put("useEnvironment",""); + object.put("environmentId",""); object.put("url",""); JSONObject objectNew = JSONObject.parseObject(object.toJSONString(), Feature.DisableSpecialKeyDetect); objectNew.remove("refType"); @@ -252,6 +253,7 @@ public class ApiScenarioImportUtil { object.put("resourceId", apiTestCase.getId()); object.put("projectId", projectId); object.put("useEnvironment",""); + object.put("environmentId",""); JSONObject objectNew = JSONObject.parseObject(object.toJSONString(),Feature.DisableSpecialKeyDetect); objectNew.remove("refType"); objectNew.remove("referenced"); diff --git a/frontend/src/business/components/api/automation/scenario/component/PluginComponent.vue b/frontend/src/business/components/api/automation/scenario/component/PluginComponent.vue index b2ad63b021..e80ce4a96e 100644 --- a/frontend/src/business/components/api/automation/scenario/component/PluginComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/PluginComponent.vue @@ -43,7 +43,7 @@
{{ request.preSize }}
- + @@ -52,7 +52,7 @@
{{ request.postSize }}
- +
@@ -62,7 +62,7 @@
- +
diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 2684fdaf42..275a0a7e7d 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -348,11 +348,15 @@ export default { }); }, singleRun(data) { - if (this.api.protocol !== "SQL" && this.api.protocol != "DUBBO" && this.api.protocol != "dubbo://" && !this.environment) { + if (data.apiMethod !== "SQL" && data.apiMethod !== "DUBBO" && data.apiMethod !== "dubbo://" && data.apiMethod !== "TCP" && !this.environment) { this.$warning(this.$t('api_test.environment.select_environment')); return; } - data.request.useEnvironment = this.environment; + if (data.apiMethod !== "SQL" && data.apiMethod !== "DUBBO" && data.apiMethod !== "dubbo://" && data.apiMethod !== "TCP") { + data.request.useEnvironment = this.environment; + } else { + data.request.useEnvironment = data.request.environmentId; + } this.$emit('singleRun', data); }, stop(data) { diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 260f4307d0..a23537b06b 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -386,7 +386,7 @@ export default { this.$emit('showExecResult', row); }, singleRun(row) { - if (this.currentApi.protocol !== "SQL" && this.currentApi.protocol !== "DUBBO" && this.currentApi.protocol !== "dubbo://" && !this.environment) { + if (row.apiMethod !== "SQL" && row.apiMethod !== "DUBBO" && row.apiMethod !== "dubbo://" && row.apiMethod !== "TCP" && !this.environment) { this.$warning(this.$t('api_test.environment.select_environment')); return; } @@ -394,7 +394,11 @@ export default { this.singleLoading = true; this.singleRunId = row.id; row.request.name = row.id; - row.request.useEnvironment = this.environment; + if (row.apiMethod !== "SQL" && row.apiMethod !== "DUBBO" && row.apiMethod !== "dubbo://" && row.apiMethod !== "TCP") { + row.request.useEnvironment = this.environment; + } else { + row.request.useEnvironment = row.request.environmentId; + } row.request.projectId = this.projectId; row.request.id = row.id; this.runData.push(row.request); diff --git a/frontend/src/business/components/api/definition/components/request/database/BasisParameters.vue b/frontend/src/business/components/api/definition/components/request/database/BasisParameters.vue index 27fe378995..56d000a52c 100644 --- a/frontend/src/business/components/api/definition/components/request/database/BasisParameters.vue +++ b/frontend/src/business/components/api/definition/components/request/database/BasisParameters.vue @@ -63,10 +63,7 @@ :description="$t('api_test.scenario.kv_description')"/> -
- -
+