refactor(场景自动化): 优化场景跨项目环境选择

This commit is contained in:
fit2-zhao 2021-06-29 15:46:43 +08:00 committed by fit2-zhao
parent 0f535cb72e
commit 0944eef6b4
4 changed files with 10 additions and 14 deletions

View File

@ -601,7 +601,7 @@ public class ApiAutomationService {
} }
} }
if (http.isEnable()) { if (http.isEnable()) {
if (http.getIsRefEnvironment()) { if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment()!= null && http.getIsRefEnvironment())) {
env.getProjectIds().add(http.getProjectId()); env.getProjectIds().add(http.getProjectId());
env.setFullUrl(false); env.setFullUrl(false);
} }
@ -633,7 +633,7 @@ public class ApiAutomationService {
// 校验是否是全路径 // 校验是否是全路径
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr; MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr;
if (httpSamplerProxy.isEnable()) { if (httpSamplerProxy.isEnable()) {
if (httpSamplerProxy.getIsRefEnvironment()) { if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || (httpSamplerProxy.getIsRefEnvironment()!= null && httpSamplerProxy.getIsRefEnvironment())) {
env.getProjectIds().add(httpSamplerProxy.getProjectId()); env.getProjectIds().add(httpSamplerProxy.getProjectId());
env.setFullUrl(false); env.setFullUrl(false);
} }
@ -674,7 +674,7 @@ public class ApiAutomationService {
http.setUrl(apiDefinition.getPath()); http.setUrl(apiDefinition.getPath());
} }
if (http.isEnable()) { if (http.isEnable()) {
if (http.getIsRefEnvironment()) { if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment()!= null && http.getIsRefEnvironment())) {
env.setFullUrl(false); env.setFullUrl(false);
env.getProjectIds().add(http.getProjectId()); env.getProjectIds().add(http.getProjectId());
} }

View File

@ -110,7 +110,7 @@ export default {
map.set(dt.id, dt.selectEnv); map.set(dt.id, dt.selectEnv);
}) })
if (!sign) { if (!sign) {
this.$warning("请为每个项目选择一个运行环境"); this.$warning("请为每个项目选择一个运行环境2");
return; return;
} }
this.$emit('setProjectEnvMap', map); this.$emit('setProjectEnvMap', map);
@ -130,7 +130,7 @@ export default {
} }
if (!sign) { if (!sign) {
this.$warning("请为每个项目选择一个运行环境"); this.$warning("请为每个项目选择一个运行环境3");
return false; return false;
} }
return true; return true;

View File

@ -275,6 +275,9 @@ export default {
checkEnv(data) { checkEnv(data) {
let sign = true; let sign = true;
this.isFullUrl = true; this.isFullUrl = true;
if(data){
return true;
}
if (this.data.length > 0) { if (this.data.length > 0) {
this.data.forEach(dt => { this.data.forEach(dt => {
if (!dt.selectEnv) { if (!dt.selectEnv) {
@ -291,14 +294,7 @@ export default {
return false; return false;
} }
}) })
} else {
if (!data) {
sign = false;
}
} }
//
//this.checkFullUrl(data);
//sign = this.isFullUrl;
} }
if (!sign) { if (!sign) {

View File

@ -127,7 +127,7 @@ export default {
map.set(dt.id, dt.selectEnv); map.set(dt.id, dt.selectEnv);
}); });
if (!sign) { if (!sign) {
this.$warning("请为每个项目选择一个运行环境"); this.$warning("请为每个项目选择一个运行环境4");
return; return;
} }
this.$emit('setProjectEnvMap', map); this.$emit('setProjectEnvMap', map);
@ -158,7 +158,7 @@ export default {
} }
if (!sign) { if (!sign) {
this.$warning("请为每个项目选择一个运行环境"); this.$warning("请为每个项目选择一个运行环境5");
return false; return false;
} }
return true; return true;