From c9cd4101dcc1138459cc1ba114bc018213d53ae8 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Fri, 9 Jun 2023 12:49:43 +0530 Subject: [PATCH] fix( #11589):japanese/chinese language support in custom property name (#11916) * fix( #11589):japanese/chinese language support in custom property name * update regex * update cypress test --- .../src/main/resources/ui/cypress/common/common.js | 8 ++++++++ .../main/resources/ui/src/constants/regex.constants.ts | 5 +++-- .../src/main/resources/ui/src/locale/languages/en-us.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index 93732bfa23e..a0c41f85fb1 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -899,6 +899,14 @@ export const addCustomPropertiesForEntity = ( CUSTOM_PROPERTY_NAME_VALIDATION_ERROR ); + // should allow name in another languages + cy.get('[data-testid="name"]') + .should('be.visible') + .clear() + .type('汝らヴェディア'); + // should not throw the validation error + cy.get('#name_help').should('not.exist'); + cy.get('[data-testid="name"]') .should('be.visible') .clear() diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/regex.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/regex.constants.ts index 7f5a31c7e65..4a5b25c386f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/regex.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/regex.constants.ts @@ -20,7 +20,7 @@ export const FQN_REGEX = new RegExp( 'g' ); -export const ENTITY_NAME_REGEX = /^[\w\- .'&()]+$/; +export const ENTITY_NAME_REGEX = /^[\p{L}\w\- .'&()]+$/; export const delimiterRegex = /[\\[\]\\()\\;\\,\\|\\{}\\``\\/\\<>\\^]/g; export const nameWithSpace = /\s/g; @@ -35,7 +35,8 @@ export const ONEOF_ANYOF_ALLOF_REGEX = /(oneof|anyof|allof)/; export const markdownTextAndIdRegex = /^(\S.*?)\s*\$\(id="(.*?)"\)/; export const MARKDOWN_MATCH_ID = /\$\(id="(.*?)"\)/; -export const CUSTOM_PROPERTY_NAME_REGEX = /^[a-z][a-zA-Z0-9]*$/; +export const CUSTOM_PROPERTY_NAME_REGEX = + /^(?![\p{Lu}\p{Lt}])[\p{L}a-z][\p{L}a-zA-Z0-9]*$/u; export const ENDS_WITH_NUMBER_REGEX = /\d+$/; diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json index 57de1edeae0..dcfd28c01f9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json @@ -170,7 +170,7 @@ "custom-logo": "Custom Logo", "custom-logo-configuration": "Custom Logo Configuration", "custom-oidc": "CustomOidc", - "custom-property": "Custom property", + "custom-property": "Custom Property", "custom-property-plural": "Custom Properties", "custom-range": "Custom Range", "dag": "Dag",