From 6e3ec26fc02a03776bb91d5fa4ad6f8a0114aaf0 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 24 Apr 2020 13:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8B=E9=9A=86=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/service/TestCaseService.java | 11 +++++ .../main/resources/i18n/messages.properties | 1 + .../resources/i18n/messages_en_US.properties | 1 + .../resources/i18n/messages_zh_CN.properties | 49 ++++++++++--------- .../common/components/MsTableOperator.vue | 9 ++-- .../components/MsTableOperatorButton.vue | 18 ++++--- .../common/components/MsTipButton.vue | 4 ++ .../components/track/case/TestCase.vue | 8 +++ .../track/case/components/TestCaseEdit.vue | 7 ++- .../track/case/components/TestCaseList.vue | 14 +++++- frontend/src/i18n/en-US.js | 9 ++-- frontend/src/i18n/zh-CN.js | 3 ++ 12 files changed, 93 insertions(+), 41 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/TestCaseService.java b/backend/src/main/java/io/metersphere/service/TestCaseService.java index 55916272a4..581f28287d 100644 --- a/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; +import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; import io.metersphere.excel.domain.ExcelErrData; @@ -16,6 +17,7 @@ import io.metersphere.excel.domain.TestCaseExcelData; import io.metersphere.excel.listener.EasyExcelListener; import io.metersphere.excel.listener.TestCaseDataListener; import io.metersphere.excel.utils.EasyExcelUtil; +import io.metersphere.i18n.Translator; import io.metersphere.user.SessionUser; import io.metersphere.user.SessionUtils; import org.apache.commons.lang3.StringUtils; @@ -62,6 +64,15 @@ public class TestCaseService { UserMapper userMapper; public void addTestCase(TestCaseWithBLOBs testCase) { + testCase.setName(testCase.getName()); + TestCaseExample testCaseExample = new TestCaseExample(); + testCaseExample.createCriteria() + .andProjectIdEqualTo(testCase.getProjectId()) + .andNameEqualTo(testCase.getName()); + List testCases = testCaseMapper.selectByExample(testCaseExample); + if (testCases.size() > 0) { + MSException.throwException(Translator.get("test_case_exist") + testCase.getName()); + } testCase.setId(UUID.randomUUID().toString()); testCase.setCreateTime(System.currentTimeMillis()); testCase.setUpdateTime(System.currentTimeMillis()); diff --git a/backend/src/main/resources/i18n/messages.properties b/backend/src/main/resources/i18n/messages.properties index e69de29bb2..5fe6c263b3 100644 --- a/backend/src/main/resources/i18n/messages.properties +++ b/backend/src/main/resources/i18n/messages.properties @@ -0,0 +1 @@ +test_case_exist= \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index a29e9abee7..c888227a02 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -1,3 +1,4 @@ +test_case_exist=A test case already exists under this project: error_lang_invalid=Invalid language parameter load_test_already_exists=Duplicate load test name project_name_is_null=Project name cannot be null diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index f5fe455fac..01dfb8308d 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -1,24 +1,25 @@ -error_lang_invalid=语言参数错误 -load_test_already_exists=测试名称不能重复 -project_name_is_null=项目名称不能为空 -project_name_already_exists=项目名称已存在 -workspace_name_is_null=工作空间名不能为空 -workspace_name_already_exists=工作空间名已存在 -workspace_does_not_belong_to_user=当前工作空间不属于当前用户 -organization_does_not_belong_to_user=当前组织不属于当前用户 -file_cannot_be_null=文件不能为空! -edit_load_test_not_found=无法编辑测试,未找到测试: -run_load_test_not_found=无法运行测试,未找到测试: -run_load_test_file_not_found=无法运行测试,无法获取测试文件元信息,测试ID: -run_load_test_file_content_not_found=无法运行测试,无法获取测试文件内容,测试ID: -run_load_test_file_init_error=无法运行测试,初始化运行环境失败,测试ID: -load_test_is_running=测试正在运行, 请等待 -node_deep_limit=节点深度不超过5层! -no_nodes_message=没有节点信息 -duplicate_node_ip=节点 IP 重复 -only_one_k8s=只能添加一个 K8s -organization_id_is_null=组织 ID 不能为空 -max_thread_insufficient=并发用户数超额 -cannot_edit_load_test_running=不能修改正在运行的测试 -test_not_found=测试不存在: -test_not_running=测试未运行 \ No newline at end of file +test_case_exist=\u8BE5\u9879\u76EE\u4E0B\u5DF2\u5B58\u5728\u7528\u4F8B\uFF1A +error_lang_invalid=\u8BED\u8A00\u53C2\u6570\u9519\u8BEF +load_test_already_exists=\u6D4B\u8BD5\u540D\u79F0\u4E0D\u80FD\u91CD\u590D +project_name_is_null=\u9879\u76EE\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A +project_name_already_exists=\u9879\u76EE\u540D\u79F0\u5DF2\u5B58\u5728 +workspace_name_is_null=\u5DE5\u4F5C\u7A7A\u95F4\u540D\u4E0D\u80FD\u4E3A\u7A7A +workspace_name_already_exists=\u5DE5\u4F5C\u7A7A\u95F4\u540D\u5DF2\u5B58\u5728 +workspace_does_not_belong_to_user=\u5F53\u524D\u5DE5\u4F5C\u7A7A\u95F4\u4E0D\u5C5E\u4E8E\u5F53\u524D\u7528\u6237 +organization_does_not_belong_to_user=\u5F53\u524D\u7EC4\u7EC7\u4E0D\u5C5E\u4E8E\u5F53\u524D\u7528\u6237 +file_cannot_be_null=\u6587\u4EF6\u4E0D\u80FD\u4E3A\u7A7A\uFF01 +edit_load_test_not_found=\u65E0\u6CD5\u7F16\u8F91\u6D4B\u8BD5\uFF0C\u672A\u627E\u5230\u6D4B\u8BD5\uFF1A +run_load_test_not_found=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u672A\u627E\u5230\u6D4B\u8BD5\uFF1A +run_load_test_file_not_found=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u6587\u4EF6\u5143\u4FE1\u606F\uFF0C\u6D4B\u8BD5ID\uFF1A +run_load_test_file_content_not_found=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u6587\u4EF6\u5185\u5BB9\uFF0C\u6D4B\u8BD5ID\uFF1A +run_load_test_file_init_error=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u521D\u59CB\u5316\u8FD0\u884C\u73AF\u5883\u5931\u8D25\uFF0C\u6D4B\u8BD5ID\uFF1A +load_test_is_running=\u6D4B\u8BD5\u6B63\u5728\u8FD0\u884C, \u8BF7\u7B49\u5F85 +node_deep_limit=\u8282\u70B9\u6DF1\u5EA6\u4E0D\u8D85\u8FC75\u5C42\uFF01 +no_nodes_message=\u6CA1\u6709\u8282\u70B9\u4FE1\u606F +duplicate_node_ip=\u8282\u70B9 IP \u91CD\u590D +only_one_k8s=\u53EA\u80FD\u6DFB\u52A0\u4E00\u4E2A K8s +organization_id_is_null=\u7EC4\u7EC7 ID \u4E0D\u80FD\u4E3A\u7A7A +max_thread_insufficient=\u5E76\u53D1\u7528\u6237\u6570\u8D85\u989D +cannot_edit_load_test_running=\u4E0D\u80FD\u4FEE\u6539\u6B63\u5728\u8FD0\u884C\u7684\u6D4B\u8BD5 +test_not_found=\u6D4B\u8BD5\u4E0D\u5B58\u5728: +test_not_running=\u6D4B\u8BD5\u672A\u8FD0\u884C \ No newline at end of file diff --git a/frontend/src/business/components/common/components/MsTableOperator.vue b/frontend/src/business/components/common/components/MsTableOperator.vue index 72b22d8464..7c871f30b8 100644 --- a/frontend/src/business/components/common/components/MsTableOperator.vue +++ b/frontend/src/business/components/common/components/MsTableOperator.vue @@ -1,9 +1,10 @@ diff --git a/frontend/src/business/components/common/components/MsTableOperatorButton.vue b/frontend/src/business/components/common/components/MsTableOperatorButton.vue index f318247e19..3e7e873337 100644 --- a/frontend/src/business/components/common/components/MsTableOperatorButton.vue +++ b/frontend/src/business/components/common/components/MsTableOperatorButton.vue @@ -1,14 +1,17 @@