Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
6a4af34b
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6a4af34b
编写于
4月 08, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
资源池国际化
上级
0f6607cd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
5 deletion
+12
-5
backend/src/main/java/io/metersphere/service/TestResourcePoolService.java
.../java/io/metersphere/service/TestResourcePoolService.java
+4
-3
backend/src/main/resources/i18n/en-US.json
backend/src/main/resources/i18n/en-US.json
+4
-1
backend/src/main/resources/i18n/zh-CN.json
backend/src/main/resources/i18n/zh-CN.json
+4
-1
未找到文件。
backend/src/main/java/io/metersphere/service/TestResourcePoolService.java
浏览文件 @
6a4af34b
...
...
@@ -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
);
...
...
backend/src/main/resources/i18n/en-US.json
浏览文件 @
6a4af34b
...
...
@@ -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"
}
\ No newline at end of file
backend/src/main/resources/i18n/zh-CN.json
浏览文件 @
6a4af34b
...
...
@@ -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"
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录