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')"/> -
- -
+