From 9c226435e377e055c64c4c5586a2fcd426ca61af Mon Sep 17 00:00:00 2001 From: guohaozhang Date: Tue, 5 Jan 2021 09:32:19 +0800 Subject: [PATCH] [Feature-4318][API] Rename tenant code (#4320) Rename tenant code Rename tenant code (English version) Rname tenant name in ui label Rname TENANT_CODE_EXIST to OS_TENANT_CODE_EXIST Rname enum TENANT_CODE_* to OS_TENANT_CODE_* --- .../api/controller/TenantController.java | 4 ++-- .../org/apache/dolphinscheduler/api/enums/Status.java | 10 +++++----- .../api/service/impl/TenantServiceImpl.java | 8 ++++---- .../src/main/resources/i18n/messages.properties | 2 +- .../src/main/resources/i18n/messages_en_US.properties | 2 +- .../src/main/resources/i18n/messages_zh_CN.properties | 2 +- .../api/controller/TenantControllerTest.java | 2 +- .../api/service/TenantServiceTest.java | 4 ++-- .../pages/tenement/_source/createTenement.vue | 8 ++++---- .../pages/security/pages/tenement/_source/list.vue | 2 +- .../src/js/module/i18n/locale/en_US.js | 11 ++++++----- .../src/js/module/i18n/locale/zh_CN.js | 10 +++++----- 12 files changed, 33 insertions(+), 32 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java index 9b9790fe23..bbd9b1d7b5 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java @@ -22,7 +22,7 @@ import static org.apache.dolphinscheduler.api.enums.Status.DELETE_TENANT_BY_ID_E import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TENANT_LIST_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TENANT_LIST_PAGING_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_TENANT_ERROR; -import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_TENANT_CODE_ERROR; +import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_OS_TENANT_CODE_ERROR; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ApiException; @@ -220,7 +220,7 @@ public class TenantController extends BaseController { }) @GetMapping(value = "/verify-tenant-code") @ResponseStatus(HttpStatus.OK) - @ApiException(VERIFY_TENANT_CODE_ERROR) + @ApiException(VERIFY_OS_TENANT_CODE_ERROR) public Result verifyTenantCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "tenantCode") String tenantCode) { logger.info("login user {}, verfiy tenant code: {}", diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java index e6935d658f..86b815cf9a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java @@ -36,7 +36,7 @@ public enum Status { USER_NAME_NULL(10004, "user name is null", "用户名不能为空"), HDFS_OPERATION_ERROR(10006, "hdfs operation error", "hdfs操作错误"), TASK_INSTANCE_NOT_FOUND(10008, "task instance not found", "任务实例不存在"), - TENANT_CODE_EXIST(10009, "tenant code {0} already exists", "租户编码[{0}]已存在"), + OS_TENANT_CODE_EXIST(10009, "os tenant code {0} already exists", "操作系统租户[{0}]已存在"), USER_NOT_EXIST(10010, "user {0} not exists", "用户[{0}]不存在"), ALERT_GROUP_NOT_EXIST(10011, "alarm group not found", "告警组不存在"), ALERT_GROUP_EXIST(10012, "alarm group already exists", "告警组名称已存在"), @@ -116,7 +116,7 @@ public enum Status { QUERY_TENANT_LIST_ERROR(10086, "query tenant list error", "查询租户列表错误"), UPDATE_TENANT_ERROR(10087, "update tenant error", "更新租户错误"), DELETE_TENANT_BY_ID_ERROR(10088, "delete tenant by id error", "删除租户错误"), - VERIFY_TENANT_CODE_ERROR(10089, "verify tenant code error", "租户编码验证错误"), + VERIFY_OS_TENANT_CODE_ERROR(10089, "verify os tenant code error", "操作系统租户验证错误"), CREATE_USER_ERROR(10090, "create user error", "创建用户错误"), QUERY_USER_LIST_PAGING_ERROR(10091, "query user list paging error", "分页查询用户列表错误"), UPDATE_USER_ERROR(10092, "update user error", "更新用户错误"), @@ -151,7 +151,7 @@ public enum Status { ENCAPSULATION_PROCESS_INSTANCE_GANTT_STRUCTURE_ERROR(10121, "encapsulation process instance gantt structure error", "查询工作流实例甘特图数据错误"), QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR(10122, "query process definition list paging error", "分页查询工作流定义列表错误"), SIGN_OUT_ERROR(10123, "sign out error", "退出错误"), - TENANT_CODE_HAS_ALREADY_EXISTS(10124, "tenant code has already exists", "租户编码已存在"), + OS_TENANT_CODE_HAS_ALREADY_EXISTS(10124, "os tenant code has already exists", "操作系统租户已存在"), IP_IS_EMPTY(10125, "ip is empty", "IP地址不能为空"), SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE(10126, "schedule release is already {0}", "调度配置上线错误[{0}]"), CREATE_QUEUE_ERROR(10127, "create queue error", "创建队列错误"), @@ -195,7 +195,7 @@ public enum Status { QUERY_WORKFLOW_LINEAGE_ERROR(10161, "query workflow lineage error", "查询血缘失败"), QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162, "query authorized and user created project error error", "查询授权的和用户创建的项目错误"), DELETE_PROCESS_DEFINITION_BY_ID_FAIL(10163,"delete process definition by id fail, for there are {0} process instances in executing using it", "删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"), - CHECK_TENANT_CODE_ERROR(10164, "Please enter the English tenant code", "请输入英文租户编码"), + CHECK_OS_TENANT_CODE_ERROR(10164, "Please enter the English os tenant code", "请输入英文操作系统租户"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), @@ -296,4 +296,4 @@ public enum Status { return this.enMsg; } } -} \ No newline at end of file +} diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java index ecb9bae98c..d27ce47122 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java @@ -94,7 +94,7 @@ public class TenantServiceImpl extends BaseService implements TenantService { } if (RegexUtils.isNumeric(tenantCode)) { - putMsg(result, Status.CHECK_TENANT_CODE_ERROR); + putMsg(result, Status.CHECK_OS_TENANT_CODE_ERROR); return result; } @@ -107,7 +107,7 @@ public class TenantServiceImpl extends BaseService implements TenantService { Date now = new Date(); if (!tenantCode.matches("^[0-9a-zA-Z_.-]{1,}$") || tenantCode.startsWith("-") || tenantCode.startsWith(".")) { - putMsg(result, Status.VERIFY_TENANT_CODE_ERROR); + putMsg(result, Status.VERIFY_OS_TENANT_CODE_ERROR); return result; } tenant.setTenantCode(tenantCode); @@ -200,7 +200,7 @@ public class TenantServiceImpl extends BaseService implements TenantService { HadoopUtils.getInstance().mkdir(udfsPath); } } else { - putMsg(result, Status.TENANT_CODE_HAS_ALREADY_EXISTS); + putMsg(result, Status.OS_TENANT_CODE_HAS_ALREADY_EXISTS); return result; } } @@ -329,7 +329,7 @@ public class TenantServiceImpl extends BaseService implements TenantService { public Result verifyTenantCode(String tenantCode) { Result result = new Result(); if (checkTenantExists(tenantCode)) { - putMsg(result, Status.TENANT_CODE_EXIST, tenantCode); + putMsg(result, Status.OS_TENANT_CODE_EXIST, tenantCode); } else { putMsg(result, Status.SUCCESS); } diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages.properties b/dolphinscheduler-api/src/main/resources/i18n/messages.properties index 233d3b7edb..4d5055b775 100644 --- a/dolphinscheduler-api/src/main/resources/i18n/messages.properties +++ b/dolphinscheduler-api/src/main/resources/i18n/messages.properties @@ -116,7 +116,7 @@ UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation CREATE_TENANT_NOTES=create tenant -TENANT_CODE=tenant code +TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...} diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties b/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties index a32ffb026d..6f4777f44d 100644 --- a/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties +++ b/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties @@ -116,7 +116,7 @@ UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation CREATE_TENANT_NOTES=create tenant -TENANT_CODE=tenant code +TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...} diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties b/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties index 24e51ad522..a333ef1fa5 100644 --- a/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties +++ b/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties @@ -115,7 +115,7 @@ UNAUTHORIZED_UDF_FUNC_NOTES=取消udf函数授权 VERIFY_QUEUE_NOTES=验证队列 TENANT_TAG=租户相关操作 CREATE_TENANT_NOTES=创建租户 -TENANT_CODE=租户编码 +TENANT_CODE=操作系统租户 QUEUE_NAME=队列名 PASSWORD=密码 DATA_SOURCE_OTHER=jdbc连接参数,格式为:{"key1":"value1",...} diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TenantControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TenantControllerTest.java index 010b7ba36c..12b0715a35 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TenantControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TenantControllerTest.java @@ -131,7 +131,7 @@ public class TenantControllerTest extends AbstractControllerTest{ .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); - Assert.assertEquals(Status.TENANT_CODE_EXIST.getCode(), result.getCode().intValue()); + Assert.assertEquals(Status.OS_TENANT_CODE_EXIST.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TenantServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TenantServiceTest.java index 86b2079f26..5310eabc1c 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TenantServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TenantServiceTest.java @@ -83,7 +83,7 @@ public class TenantServiceTest { Map result = tenantService.createTenant(getLoginUser(), "%!1111", 1, "TenantServiceTest"); logger.info(result.toString()); - Assert.assertEquals(Status.VERIFY_TENANT_CODE_ERROR, result.get(Constants.STATUS)); + Assert.assertEquals(Status.VERIFY_OS_TENANT_CODE_ERROR, result.get(Constants.STATUS)); //check exist result = tenantService.createTenant(loginUser, tenantCode, 1, "TenantServiceTest"); @@ -193,7 +193,7 @@ public class TenantServiceTest { result = tenantService.verifyTenantCode(getTenant().getTenantCode()); String resultString; if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) { - resultString = "租户编码[TenantServiceTest]已存在"; + resultString = "操作系统租户[TenantServiceTest]已存在"; } else { resultString = "tenant code TenantServiceTest already exists"; } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue index f9d1dcb6bc..59e0390dfc 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue @@ -24,7 +24,7 @@