From 0944eef6b4309ec6f1fc18f18e5de329cf1e08b9 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 29 Jun 2021 15:46:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9C=BA=E6=99=AF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BC=98=E5=8C=96=E5=9C=BA=E6=99=AF=E8=B7=A8?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=8E=AF=E5=A2=83=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/service/ApiAutomationService.java | 6 +++--- .../api/automation/scenario/ApiScenarioEnv.vue | 4 ++-- .../components/api/automation/scenario/EnvSelect.vue | 10 +++------- .../src/business/components/track/common/EnvSelect.vue | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 914c1b08ba..2b47dab229 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -601,7 +601,7 @@ public class ApiAutomationService { } } if (http.isEnable()) { - if (http.getIsRefEnvironment()) { + if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment()!= null && http.getIsRefEnvironment())) { env.getProjectIds().add(http.getProjectId()); env.setFullUrl(false); } @@ -633,7 +633,7 @@ public class ApiAutomationService { // 校验是否是全路径 MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr; if (httpSamplerProxy.isEnable()) { - if (httpSamplerProxy.getIsRefEnvironment()) { + if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || (httpSamplerProxy.getIsRefEnvironment()!= null && httpSamplerProxy.getIsRefEnvironment())) { env.getProjectIds().add(httpSamplerProxy.getProjectId()); env.setFullUrl(false); } @@ -674,7 +674,7 @@ public class ApiAutomationService { http.setUrl(apiDefinition.getPath()); } if (http.isEnable()) { - if (http.getIsRefEnvironment()) { + if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment()!= null && http.getIsRefEnvironment())) { env.setFullUrl(false); env.getProjectIds().add(http.getProjectId()); } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue index 07bf54b83d..e27d64faed 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioEnv.vue @@ -110,7 +110,7 @@ export default { map.set(dt.id, dt.selectEnv); }) if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境2!"); return; } this.$emit('setProjectEnvMap', map); @@ -130,7 +130,7 @@ export default { } if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境3!"); return false; } return true; diff --git a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue index b3ea7098a4..cd7fd040f6 100644 --- a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue +++ b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue @@ -275,6 +275,9 @@ export default { checkEnv(data) { let sign = true; this.isFullUrl = true; + if(data){ + return true; + } if (this.data.length > 0) { this.data.forEach(dt => { if (!dt.selectEnv) { @@ -291,14 +294,7 @@ export default { return false; } }) - } else { - if (!data) { - sign = false; - } } - // 校验是否全是全路径 - //this.checkFullUrl(data); - //sign = this.isFullUrl; } if (!sign) { diff --git a/frontend/src/business/components/track/common/EnvSelect.vue b/frontend/src/business/components/track/common/EnvSelect.vue index a8c7ba5d7e..f574dac96a 100644 --- a/frontend/src/business/components/track/common/EnvSelect.vue +++ b/frontend/src/business/components/track/common/EnvSelect.vue @@ -127,7 +127,7 @@ export default { map.set(dt.id, dt.selectEnv); }); if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境4!"); return; } this.$emit('setProjectEnvMap', map); @@ -158,7 +158,7 @@ export default { } if (!sign) { - this.$warning("请为每个项目选择一个运行环境!"); + this.$warning("请为每个项目选择一个运行环境5!"); return false; } return true;