资源池国际化

This commit is contained in:
Captain.B 2020-04-08 12:46:01 +08:00
parent 0f6607cdc2
commit 6a4af34bc8
3 changed files with 12 additions and 5 deletions

View File

@ -15,6 +15,7 @@ import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
import io.metersphere.dto.NodeDTO;
import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
import io.metersphere.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
@ -83,7 +84,7 @@ public class TestResourcePoolService {
private void validateNodes(TestResourcePoolDTO testResourcePool) {
if (CollectionUtils.isEmpty(testResourcePool.getResources())) {
MSException.throwException("没有节点信息");
MSException.throwException(Translator.get("no_nodes_message"));
}
deleteTestResource(testResourcePool.getId());
@ -95,7 +96,7 @@ public class TestResourcePoolService {
.distinct()
.collect(Collectors.toList());
if (nodeIps.size() < testResourcePool.getResources().size()) {
MSException.throwException("节点 IP 重复");
MSException.throwException(Translator.get("duplicate_node_ip"));
}
for (TestResource resource : testResourcePool.getResources()) {
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
@ -124,7 +125,7 @@ public class TestResourcePoolService {
private void validateK8s(TestResourcePoolDTO testResourcePool) {
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);

View File

@ -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_init_error": "Failed to run test, failed to initialize run environment, test ID:",
"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"
}

View File

@ -14,5 +14,8 @@
"run_load_test_file_content_not_found": "无法运行测试无法获取测试文件内容测试ID",
"run_load_test_file_init_error": "无法运行测试初始化运行环境失败测试ID",
"load_test_is_running": "测试正在运行, 请等待",
"node_deep_limit": "节点深度不超过5层"
"node_deep_limit": "节点深度不超过5层",
"no_nodes_message": "没有节点信息",
"duplicate_node_ip": "节点 IP 重复",
"only_one_k8s": "只能添加一个 K8s"
}