diff --git a/backend/src/main/java/io/metersphere/controller/LoadTestController.java b/backend/src/main/java/io/metersphere/controller/LoadTestController.java index 0011df58c0..0f6d0ed3a5 100644 --- a/backend/src/main/java/io/metersphere/controller/LoadTestController.java +++ b/backend/src/main/java/io/metersphere/controller/LoadTestController.java @@ -69,6 +69,11 @@ public class LoadTestController { return loadTestService.get(testId); } + @GetMapping("/get-advanced-config/{testId}") + public String getAdvancedConfiguration(@PathVariable String testId) { + return loadTestService.getAdvancedConfiguration(testId); + } + @PostMapping("/delete") public void delete(@RequestBody DeleteTestPlanRequest request) { loadTestService.delete(request); diff --git a/backend/src/main/java/io/metersphere/service/LoadTestService.java b/backend/src/main/java/io/metersphere/service/LoadTestService.java index 99a4456836..44f189e991 100644 --- a/backend/src/main/java/io/metersphere/service/LoadTestService.java +++ b/backend/src/main/java/io/metersphere/service/LoadTestService.java @@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; import java.util.List; +import java.util.Optional; import java.util.UUID; @Service @@ -124,6 +125,7 @@ public class LoadTestService { loadTest.setScenarioDefinition("todo"); loadTest.setDescription("todo"); loadTest.setLoadConfiguration(request.getLoadConfiguration()); + loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration()); loadTestMapper.updateByPrimaryKeySelective(loadTest); } @@ -184,4 +186,9 @@ public class LoadTestService { } return null; } + + public String getAdvancedConfiguration(String testId) { + LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(testId); + return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getAdvancedConfiguration(); + } } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 0e999b2b90..f5849a90d3 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -93,6 +93,10 @@ export default { 'params': 'Parameters', 'param_name': 'Name', 'param_value': 'Value', + 'domain_is_duplicate': 'Domain is duplicated', + 'param_is_duplicate': 'Parameter name is duplicate', + 'domain_ip_is_empty': 'Domain and IP cannot be empty', + 'param_name_value_is_empty': 'Parameters cannot be empty', }, i18n: { 'home': 'Home', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index c320bb6a7c..23772c8559 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -93,6 +93,10 @@ export default { 'params': '自定义属性', 'param_name': '属性名', 'param_value': '属性值', + 'domain_is_duplicate': '域名不能重复', + 'param_is_duplicate': '参数名不能重复', + 'domain_ip_is_empty': '域名和IP不能为空', + 'param_name_value_is_empty': '参数名和参数值不能为空', }, i18n: { 'home': '首页', diff --git a/frontend/src/performance/components/testPlan/EditTestPlan.vue b/frontend/src/performance/components/testPlan/EditTestPlan.vue index b0ddb730df..3b1d3f50d3 100644 --- a/frontend/src/performance/components/testPlan/EditTestPlan.vue +++ b/frontend/src/performance/components/testPlan/EditTestPlan.vue @@ -76,7 +76,6 @@ }, watch: { '$route'(to) { - window.console.log(to); // 如果是创建测试 if (to.name === 'createTest') { window.location.reload(); @@ -117,6 +116,7 @@ message: this.$t('commons.save_success'), type: 'success' }); + this.$refs.advancedConfig.cancelAllEdit(); }); }, saveAndRun() { @@ -151,6 +151,9 @@ if (this.testPlan.loadConfigurationObj) { this.testPlan.loadConfiguration = JSON.stringify(this.testPlan.loadConfigurationObj); } + // 高级配置 + this.testPlan.advancedConfiguration = JSON.stringify(this.$refs.advancedConfig.configurations()); + // file属性不需要json化 let requestJson = JSON.stringify(this.testPlan, function (key, value) { return key === "file" ? undefined : value @@ -201,10 +204,6 @@ } if (!this.$refs.advancedConfig.validConfig()) { - this.$message({ - message: this.$t('load_test.advanced_config_error'), - type: 'error' - }); return false; } diff --git a/frontend/src/performance/components/testPlan/components/AdvancedConfig.vue b/frontend/src/performance/components/testPlan/components/AdvancedConfig.vue index e2b48a1d49..9ed4730483 100644 --- a/frontend/src/performance/components/testPlan/components/AdvancedConfig.vue +++ b/frontend/src/performance/components/testPlan/components/AdvancedConfig.vue @@ -1,5 +1,5 @@ -