资源池国际化0.2
This commit is contained in:
parent
a6618d20be
commit
35a5c3c13e
|
@ -10,6 +10,7 @@ import io.metersphere.base.mapper.TestResourcePoolMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper;
|
||||
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||
import io.metersphere.dto.NodeDTO;
|
||||
import io.metersphere.dto.TestResourcePoolDTO;
|
||||
|
@ -25,6 +26,7 @@ import org.springframework.web.client.RestTemplate;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static io.metersphere.commons.constants.ResourceStatusEnum.VALID;
|
||||
|
||||
|
@ -81,10 +83,20 @@ public class TestResourcePoolService {
|
|||
|
||||
private void validateNodes(TestResourcePoolDTO testResourcePool) {
|
||||
if (CollectionUtils.isEmpty(testResourcePool.getResources())) {
|
||||
throw new RuntimeException("没有节点信息");
|
||||
MSException.throwException("没有节点信息");
|
||||
}
|
||||
|
||||
deleteTestResource(testResourcePool.getId());
|
||||
List<String> nodeIps = testResourcePool.getResources().stream()
|
||||
.map(resource -> {
|
||||
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
|
||||
return nodeDTO.getIp();
|
||||
})
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (nodeIps.size() < testResourcePool.getResources().size()) {
|
||||
MSException.throwException("节点 IP 重复");
|
||||
}
|
||||
for (TestResource resource : testResourcePool.getResources()) {
|
||||
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
|
||||
boolean isValidate = validateNode(nodeDTO);
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
createVisible: false,
|
||||
infoList: [],
|
||||
updateVisible: false,
|
||||
btnTips: "添加资源池",
|
||||
btnTips: this.$t('test_resource_pool.create_resource_pool'),
|
||||
btnTipsAdd: this.$t("commons.add"),
|
||||
btnTipsDel: this.$t("commons.delete"),
|
||||
queryPath: "testresourcepool/list",
|
||||
|
@ -256,20 +256,20 @@
|
|||
form: {},
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: '请输入资源池名称', trigger: 'blur'},
|
||||
{required: true, message: this.$t('test_resource_pool.input_pool_name'), trigger: 'blur'},
|
||||
{min: 2, max: 64, message: this.$t('commons.input_limit', [2, 64]), trigger: 'blur'},
|
||||
{
|
||||
required: true,
|
||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||
message: '资源池名称不支持特殊字符',
|
||||
message: this.$t('test_resource_pool.pool_name_valid'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
description: [
|
||||
{max: 60, message: '最大长度 60 个字符', trigger: 'blur'}
|
||||
{max: 60, message: this.$t('commons.input_limit', [0, 60]), trigger: 'blur'}
|
||||
],
|
||||
type: [
|
||||
{required: true, message: '请选择资源类型', trigger: 'blur'}
|
||||
{required: true, message: this.$t('test_resource_pool.select_pool_type'), trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -305,16 +305,16 @@
|
|||
} else {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: "不能删除所有独立节点"
|
||||
message: this.$t('test_resource_pool.cannot_remove_all_node')
|
||||
});
|
||||
}
|
||||
},
|
||||
validateResourceInfo() {
|
||||
if (this.infoList.length <= 0) {
|
||||
return {validate: false, msg: "资源池不能为空"}
|
||||
return {validate: false, msg: this.$t('test_resource_pool.cannot_empty')}
|
||||
}
|
||||
|
||||
let resultValidate = {validate: true, msg: "请完善数据"}
|
||||
let resultValidate = {validate: true, msg: this.$t('test_resource_pool.fill_the_data')};
|
||||
this.infoList.forEach(function (info) {
|
||||
for (let key in info) {
|
||||
if (info[key] != '0' && !info[key]) {
|
||||
|
@ -362,7 +362,7 @@
|
|||
},
|
||||
del(row) {
|
||||
window.console.log(row);
|
||||
this.$confirm('此操作将永久删除该资源池, 是否继续?', '提示', {
|
||||
this.$confirm(this.$t('test_resource_pool.delete_prompt'), this.$t('commons.prompt'), {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
|
@ -391,7 +391,7 @@
|
|||
this.$post("/testresourcepool/add", this.form, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '添加成功!'
|
||||
message: this.$t('commons.save_success')
|
||||
},
|
||||
this.createVisible = false,
|
||||
this.initTableData());
|
||||
|
@ -460,7 +460,7 @@
|
|||
this.$post('/testresourcepool/update', row).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '状态修改成功!'
|
||||
message: this.$t('test_resource_pool.status_change_success')
|
||||
});
|
||||
})
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ export default {
|
|||
'select_execute_result': 'Select execute result',
|
||||
'save': 'Save'
|
||||
},
|
||||
'test_resource_pool': {
|
||||
test_resource_pool: {
|
||||
'type': 'type',
|
||||
'enable_disable': 'Enable / disable',
|
||||
'search_by_name': 'Search by name',
|
||||
|
@ -245,6 +245,13 @@ export default {
|
|||
'update_resource_pool': 'Create resource pool',
|
||||
'select_pool_type': 'Select resource type',
|
||||
'max_threads': 'Maximum concurrent number',
|
||||
'input_pool_name': 'Please enter the resource pool name',
|
||||
'pool_name_valid': 'Resource pool name does not support special characters',
|
||||
'cannot_remove_all_node': 'Cannot delete all independent nodes',
|
||||
'cannot_empty': 'Resource pool cannot be empty',
|
||||
'fill_the_data': 'Please complete the data',
|
||||
'delete_prompt': 'This operation will permanently delete the resource pool, continue?',
|
||||
'status_change_success': 'Successfully changed the status!',
|
||||
},
|
||||
i18n: {
|
||||
'home': 'Home'
|
||||
|
|
|
@ -224,7 +224,6 @@ export default {
|
|||
'plan_status_completed': '已完成',
|
||||
'delete_module_confirm': '确认删除模块: ',
|
||||
'delete_module_resource': '以及模块下所有子模块和测试用例',
|
||||
|
||||
'relevance_test_case': '关联测试用例',
|
||||
'executor': '执行人',
|
||||
'execute_result': '执行结果',
|
||||
|
@ -237,9 +236,8 @@ export default {
|
|||
'step_result': '步骤执行结果',
|
||||
'select_execute_result': '选择执行结果',
|
||||
'save': '保 存'
|
||||
|
||||
},
|
||||
'test_resource_pool': {
|
||||
test_resource_pool: {
|
||||
'type': '类型',
|
||||
'enable_disable': '启用/禁用',
|
||||
'search_by_name': '根据名称搜索',
|
||||
|
@ -247,6 +245,13 @@ export default {
|
|||
'update_resource_pool': '创建资源池',
|
||||
'select_pool_type': '选择资源类型',
|
||||
'max_threads': '最大并发数',
|
||||
'input_pool_name': '请输入资源池名称',
|
||||
'pool_name_valid': '资源池名称不支持特殊字符',
|
||||
'cannot_remove_all_node': '不能删除所有独立节点',
|
||||
'cannot_empty': '资源池不能为空',
|
||||
'fill_the_data': '请完善数据',
|
||||
'delete_prompt': '此操作将永久删除该资源池, 是否继续?',
|
||||
'status_change_success': '状态修改成功!',
|
||||
},
|
||||
i18n: {
|
||||
'home': '首页'
|
||||
|
|
Loading…
Reference in New Issue