提交 6a4af34b 编写于 作者: C Captain.B

资源池国际化

上级 0f6607cd
...@@ -15,6 +15,7 @@ import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest; ...@@ -15,6 +15,7 @@ import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.NodeDTO; import io.metersphere.dto.NodeDTO;
import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.engine.kubernetes.provider.KubernetesProvider; import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
import io.metersphere.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -83,7 +84,7 @@ public class TestResourcePoolService { ...@@ -83,7 +84,7 @@ public class TestResourcePoolService {
private void validateNodes(TestResourcePoolDTO testResourcePool) { private void validateNodes(TestResourcePoolDTO testResourcePool) {
if (CollectionUtils.isEmpty(testResourcePool.getResources())) { if (CollectionUtils.isEmpty(testResourcePool.getResources())) {
MSException.throwException("没有节点信息"); MSException.throwException(Translator.get("no_nodes_message"));
} }
deleteTestResource(testResourcePool.getId()); deleteTestResource(testResourcePool.getId());
...@@ -95,7 +96,7 @@ public class TestResourcePoolService { ...@@ -95,7 +96,7 @@ public class TestResourcePoolService {
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
if (nodeIps.size() < testResourcePool.getResources().size()) { if (nodeIps.size() < testResourcePool.getResources().size()) {
MSException.throwException("节点 IP 重复"); MSException.throwException(Translator.get("duplicate_node_ip"));
} }
for (TestResource resource : testResourcePool.getResources()) { for (TestResource resource : testResourcePool.getResources()) {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class); NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
...@@ -124,7 +125,7 @@ public class TestResourcePoolService { ...@@ -124,7 +125,7 @@ public class TestResourcePoolService {
private void validateK8s(TestResourcePoolDTO testResourcePool) { private void validateK8s(TestResourcePoolDTO testResourcePool) {
if (CollectionUtils.isEmpty(testResourcePool.getResources()) || testResourcePool.getResources().size() != 1) { if (CollectionUtils.isEmpty(testResourcePool.getResources()) || testResourcePool.getResources().size() != 1) {
throw new RuntimeException("只能添加一个 K8s"); throw new RuntimeException(Translator.get("only_one_k8s"));
} }
TestResource testResource = testResourcePool.getResources().get(0); TestResource testResource = testResourcePool.getResources().get(0);
......
...@@ -14,5 +14,8 @@ ...@@ -14,5 +14,8 @@
"run_load_test_file_content_not_found": "Cannot run test, cannot get test file content, test ID:", "run_load_test_file_content_not_found": "Cannot run test, cannot get test file content, test ID:",
"run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:", "run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:",
"load_test_is_running": "Load test is running, please wait.", "load_test_is_running": "Load test is running, please wait.",
"node_deep_limit": "The node depth does not exceed 5 layers!" "node_deep_limit": "The node depth does not exceed 5 layers!",
"no_nodes_message": "No node message",
"duplicate_node_ip": "Duplicate IPs",
"only_one_k8s": "Only one K8s can be added"
} }
\ No newline at end of file
...@@ -14,5 +14,8 @@ ...@@ -14,5 +14,8 @@
"run_load_test_file_content_not_found": "无法运行测试,无法获取测试文件内容,测试ID:", "run_load_test_file_content_not_found": "无法运行测试,无法获取测试文件内容,测试ID:",
"run_load_test_file_init_error": "无法运行测试,初始化运行环境失败,测试ID:", "run_load_test_file_init_error": "无法运行测试,初始化运行环境失败,测试ID:",
"load_test_is_running": "测试正在运行, 请等待", "load_test_is_running": "测试正在运行, 请等待",
"node_deep_limit": "节点深度不超过5层!" "node_deep_limit": "节点深度不超过5层!",
"no_nodes_message": "没有节点信息",
"duplicate_node_ip": "节点 IP 重复",
"only_one_k8s": "只能添加一个 K8s"
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册