diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java index 1e91ae1055..176cbe0b62 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java @@ -155,12 +155,12 @@ public class MsJDBCSampler extends MsTestElement { } //处理全局前后置脚本(步骤内) - String enviromentId = this.getEnvironmentId(); - if (enviromentId == null) { - enviromentId = this.useEnvironment; + String environmentId = this.getEnvironmentId(); + if (environmentId == null) { + environmentId = this.useEnvironment; } //根据配置将脚本放置在私有脚本之前 - JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), enviromentId, config, false); + JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), environmentId, config, false); if (CollectionUtils.isNotEmpty(hashTree)) { hashTree.forEach(el -> { @@ -168,7 +168,7 @@ public class MsJDBCSampler extends MsTestElement { }); } //根据配置将脚本放置在私有脚本之后 - JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), enviromentId, config, true); + JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), environmentId, config, true); } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java index cddc101bfb..78f52f7486 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java @@ -150,12 +150,12 @@ public class MsTCPSampler extends MsTestElement { } //处理全局前后置脚本(步骤内) - String enviromentId = this.getEnvironmentId(); - if (enviromentId == null) { - enviromentId = this.useEnvironment; + String environmentId = this.getEnvironmentId(); + if (environmentId == null) { + environmentId = this.useEnvironment; } //根据配置将脚本放置在私有脚本之前 - JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), enviromentId, config, false); + JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), environmentId, config, false); if (CollectionUtils.isNotEmpty(hashTree)) { hashTree.forEach(el -> { @@ -163,7 +163,7 @@ public class MsTCPSampler extends MsTestElement { }); } //根据配置将脚本放置在私有脚本之后 - JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), enviromentId, config, true); + JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), environmentId, config, true); } private void addItemHashTree(MsTestElement element, HashTree samplerHashTree, ParameterConfig config) { 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 d5c1bd341d..d70eb0a322 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -673,6 +673,11 @@ public class ApiAutomationService { element.put("enable", enable); element.put("environmentEnable", environmentEnable); hashTree.set(i, element); + } else { + if (StringUtils.equalsIgnoreCase(element.getString("referenced"), "REF")) { + element.put("enable", false); + element.put("num", ""); + } } } if (element.containsKey("hashTree")) { @@ -695,6 +700,11 @@ public class ApiAutomationService { element.put("enable", enable); element.put("environmentEnable", environmentEnable); element.put("num", scenarioWithBLOBs.getNum()); + } else { + if (StringUtils.equalsIgnoreCase(element.getString("referenced"), "REF")) { + element.put("enable", false); + element.put("num", ""); + } } } if (element != null && element.containsKey("hashTree")) { diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue index fe72ef4b6f..6f3e2748d0 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue @@ -110,7 +110,7 @@ export default { this.isShowNum = true; this.getWorkspaceId(this.scenario.projectId); } else { - this.isSameSpace = false; + this.isShowNum = false; } if (!this.scenario.projectId) { this.scenario.projectId = getCurrentProjectID();