From cad44202425cddb116dde8cab232146cc6f2e214 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Fri, 9 Oct 2020 15:42:47 +0800 Subject: [PATCH 1/4] [fixBug-3840][ui]The tenant code only allows letters or a combination of letters and numbers --- .../pages/tenement/_source/createTenement.vue | 19 +++++++++++-------- .../src/js/module/i18n/locale/en_US.js | 6 ++++-- .../src/js/module/i18n/locale/zh_CN.js | 4 +++- 3 files changed, 18 insertions(+), 11 deletions(-) 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 ebf644c016..a258b6ca73 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 @@ -30,7 +30,7 @@ :disabled="item ? true : false" v-model="tenantCode" maxlength="60" - :placeholder="$t('Please enter name')"> + :placeholder="$t('Please enter tenant code')"> @@ -41,7 +41,7 @@ type="input" v-model="tenantName" maxlength="60" - :placeholder="$t('Please enter name')" + :placeholder="$t('Please enter tenant Name')" autocomplete="off"> @@ -88,7 +88,7 @@ store, queueList: [], queueId: '', - tenantCode: '', + tenantCode: null, tenantName: '', description: '', } @@ -133,17 +133,20 @@ }, _verification () { let isEn = /^[0-9a-zA-Z_.-]{1,}$/ + let isNumber = /^\d+$/ + let isComb =/^[0-9a-zA-Z]*$/g - if (!this.tenantCode.replace(/\s*/g,"")) { - this.$message.warning(`${i18n.$t('Please enter the tenant code in English')}`) + if(!isComb.test(this.tenantCode)) { + this.$message.warning(`${i18n.$t('The tenant code. Only letters or a combination of letters and numbers are allowed')}`) return false } - if (!isEn.test(this.tenantCode) || _.startsWith(this.tenantCode, '_', 0) || _.startsWith(this.tenantCode, '.', 0)) { - this.$message.warning(`${i18n.$t('Please enter tenant code in English')}`) + if(isNumber.test(this.tenantCode)) { + this.$message.warning(`${i18n.$t('The tenant code. Only letters or a combination of letters and numbers are allowed')}`) return false } + if (!this.tenantName.replace(/\s*/g,"")) { - this.$message.warning(`${i18n.$t('Please enter name')}`) + this.$message.warning(`${i18n.$t('Please enter tenant Name')}`) return false } return true diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js index c9754c2669..de31fc23eb 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js @@ -173,8 +173,10 @@ export default { 'Tenant Name': 'Tenant Name', Queue: 'Queue', 'Please select a queue': 'default is tenant association queue', - 'Please enter the tenant code in English': 'Please enter the tenant code in English', - 'Please enter tenant code in English': 'Please enter tenant code in English', + 'Please enter tenant code': 'Please enter tenant code', + 'Please enter tenant Name': 'Please enter tenant Name', + 'The tenant code. Only letters or a combination of letters and numbers are allowed': 'The tenant code. Only letters or a combination of letters and numbers are allowed', + 'The tenant code cannot be all numbers': 'The tenant code cannot be all numbers', 'Edit User': 'Edit User', Tenant: 'Tenant', Email: 'Email', diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js index 5f8898adc4..85235476fd 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -177,7 +177,9 @@ export default { 'Tenant Name': '租户名称', Queue: '队列', 'Please enter the tenant code in English': '请输入租户编码只允许英文', - 'Please enter tenant code in English': '请输入英文租户编码', + 'Please enter tenant code': '请输入租户编码', + 'Please enter tenant Name': '请输入租户名称', + 'The tenant code. Only letters or a combination of letters and numbers are allowed': '租户编码只允许字母或字母与数字组合', 'Edit User': '编辑用户', Tenant: '租户', Email: '邮件', From a7e7d09540943cc9ab1f2b915c55ee8be6da07df Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Fri, 9 Oct 2020 16:01:12 +0800 Subject: [PATCH 2/4] fix --- dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js | 1 - 1 file changed, 1 deletion(-) diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js index 85235476fd..d6a6f8277b 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -176,7 +176,6 @@ export default { 'Tenant Code': '租户编码', 'Tenant Name': '租户名称', Queue: '队列', - 'Please enter the tenant code in English': '请输入租户编码只允许英文', 'Please enter tenant code': '请输入租户编码', 'Please enter tenant Name': '请输入租户名称', 'The tenant code. Only letters or a combination of letters and numbers are allowed': '租户编码只允许字母或字母与数字组合', From 0ee1552d461728b1b1a1645e15cac0abb11f2f00 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Fri, 9 Oct 2020 16:56:18 +0800 Subject: [PATCH 3/4] fix --- .../dolphinscheduler/data/security/TenantManageData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java index 71e50e7150..c8851041d8 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java @@ -25,12 +25,12 @@ public class TenantManageData { /** * Tenant Code */ - public static final String TENANT_CODE = "selenium_tenant_code_1"; + public static final String TENANT_CODE = "seleniumTenantCode_1"; /** * Tenant Name */ - public static final String TENANT_NAME = "selenium_tenant_Name"; + public static final String TENANT_NAME = "seleniumTenantName"; /** * Queue From 6829119958c554bfbdcd9561ab67f76ba462db21 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Fri, 9 Oct 2020 17:00:44 +0800 Subject: [PATCH 4/4] fix --- .../apache/dolphinscheduler/data/security/TenantManageData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java index c8851041d8..da36fee84d 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java @@ -25,7 +25,7 @@ public class TenantManageData { /** * Tenant Code */ - public static final String TENANT_CODE = "seleniumTenantCode_1"; + public static final String TENANT_CODE = "seleniumTenantCode1"; /** * Tenant Name