From cb0866ca9be3a447192ecc07829f08edefe13056 Mon Sep 17 00:00:00 2001 From: calvin Date: Mon, 10 Jul 2023 13:33:58 +0800 Subject: [PATCH] [Fix-14488][UI] When creating a tenant add the strong validation of its tenant code. (#14492) --- dolphinscheduler-ui/src/locales/en_US/security.ts | 1 + dolphinscheduler-ui/src/locales/zh_CN/security.ts | 1 + .../views/security/tenant-manage/components/use-modalData.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/dolphinscheduler-ui/src/locales/en_US/security.ts b/dolphinscheduler-ui/src/locales/en_US/security.ts index 8c55ff7ef3..c6dcb02892 100644 --- a/dolphinscheduler-ui/src/locales/en_US/security.ts +++ b/dolphinscheduler-ui/src/locales/en_US/security.ts @@ -28,6 +28,7 @@ export default { actions: 'Operation', edit_tenant: 'Edit Tenant', tenant_code_tips: 'Please enter the operating system tenant', + tenant_code_invalid_tips: 'The tenant code is invalid.', queue_name_tips: 'Please select queue', description_tips: 'Please enter a description', delete_confirm: 'Delete?', diff --git a/dolphinscheduler-ui/src/locales/zh_CN/security.ts b/dolphinscheduler-ui/src/locales/zh_CN/security.ts index 5eeace0155..cc86de5504 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/security.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/security.ts @@ -28,6 +28,7 @@ export default { actions: '操作', edit_tenant: '编辑租户', tenant_code_tips: '请输入操作系统租户', + tenant_code_invalid_tips: '操作系统租户名称含有非法字符', queue_name_tips: '请选择队列', description_tips: '请输入描述', delete_confirm: '确定删除吗?', diff --git a/dolphinscheduler-ui/src/views/security/tenant-manage/components/use-modalData.ts b/dolphinscheduler-ui/src/views/security/tenant-manage/components/use-modalData.ts index bd3c00bfc8..332f220b3f 100644 --- a/dolphinscheduler-ui/src/views/security/tenant-manage/components/use-modalData.ts +++ b/dolphinscheduler-ui/src/views/security/tenant-manage/components/use-modalData.ts @@ -47,6 +47,9 @@ export function useModalData( if (!variables.model.tenantCode) { return new Error(t('security.tenant.tenant_code_tips')) } + if (variables.model.tenantCode.search('[^-._a-zA-Z0-9]') !== -1) { + return new Error(t('security.tenant.tenant_code_invalid_tips')) + } } }, queueId: {