From a672c34afc54bdf66b2ae02ea9f6ba99b46bc596 Mon Sep 17 00:00:00 2001 From: KubeSphere CI Bot <47586280+ks-ci-bot@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:45:19 +0800 Subject: [PATCH] [master] fix: add rule on app category name to match backend rule (#4408) fix: add rule on app category name to match backend rule Signed-off-by: ROOMrepair Co-authored-by: ROOMrepair --- locales/en/l10n-appStoreManagement-appCategories-list.js | 2 ++ locales/es/l10n-appStoreManagement-appCategories-list.js | 2 ++ locales/tc/l10n-appStoreManagement-appCategories-list.js | 2 ++ locales/zh/l10n-appStoreManagement-appCategories-list.js | 4 +++- packages/shared/src/constants/patterns.ts | 2 ++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/locales/en/l10n-appStoreManagement-appCategories-list.js b/locales/en/l10n-appStoreManagement-appCategories-list.js index f482efe2255..13ced22e73a 100644 --- a/locales/en/l10n-appStoreManagement-appCategories-list.js +++ b/locales/en/l10n-appStoreManagement-appCategories-list.js @@ -15,6 +15,8 @@ module.exports = { ENTER_CATEGORY_NAME_TIP: 'Please enter a category name.', CATEGORY_NAME_DESC: 'The name can contain any characters and the maximum length is 20 characters.', + APP_CATEGORY_NAME_DESC: + 'The name must consist of lower case alphanumeric characters, (-) or (.) and must start and end with an alphanumeric character.', // All Categories > Eit // All Categories > Delete DELETE_CATEGORY_DESC: 'Are you sure you want to delete the category {name}?', diff --git a/locales/es/l10n-appStoreManagement-appCategories-list.js b/locales/es/l10n-appStoreManagement-appCategories-list.js index fedcce43bc4..ca14962f1bd 100644 --- a/locales/es/l10n-appStoreManagement-appCategories-list.js +++ b/locales/es/l10n-appStoreManagement-appCategories-list.js @@ -15,6 +15,8 @@ module.exports = { ENTER_CATEGORY_NAME_TIP: 'Por favor, introduzca un nombre de categoría.', CATEGORY_NAME_DESC: 'El nombre puede contener cualquier carácter y el largo máximo es de 20 caracteres.', + APP_CATEGORY_NAME_DESC: + 'El nombre debe consistir en caracteres alfanuméricos en minúsculas, (-) o (.) y debe comenzar y terminar con un carácter alfanumérico.', // All Categories > Eit // All Categories > Delete DELETE_CATEGORY_DESC: '¿Está seguro que desea eliminar la categoría {name}?', diff --git a/locales/tc/l10n-appStoreManagement-appCategories-list.js b/locales/tc/l10n-appStoreManagement-appCategories-list.js index 3140f1573ad..37fe0b8e9dc 100644 --- a/locales/tc/l10n-appStoreManagement-appCategories-list.js +++ b/locales/tc/l10n-appStoreManagement-appCategories-list.js @@ -13,6 +13,8 @@ module.exports = { // All Categories > Add ENTER_CATEGORY_NAME_TIP: '請輸入類別名稱。', CATEGORY_NAME_DESC: '名稱可包含任意字元,最長 20 個字元。', + APP_CATEGORY_NAME_DESC: + '名稱只能包含小寫字母、數字、隔符號(-)和點(.),必須以小寫字母或數字開頭及結尾,最長 20 個字元。', // All Categories > Eit // All Categories > Delete DELETE_CATEGORY_DESC: '您確定要刪除類別 {name} 嗎?', diff --git a/locales/zh/l10n-appStoreManagement-appCategories-list.js b/locales/zh/l10n-appStoreManagement-appCategories-list.js index 3aeafbcb84d..95305e0a45d 100644 --- a/locales/zh/l10n-appStoreManagement-appCategories-list.js +++ b/locales/zh/l10n-appStoreManagement-appCategories-list.js @@ -14,7 +14,9 @@ module.exports = { // All Categories > Add ENTER_CATEGORY_NAME_TIP: '请输入分类名称。', CATEGORY_NAME_DESC: '名称可包含任意字符,最长 20 个字符。', - // All Categories > Eit + APP_CATEGORY_NAME_DESC: + '名称只能包含小写字母、数字、连字符(-)和句点(.),必须以小写字母或数字开头及结尾,最长 20 个字符', + // All Categories > Eikt // All Categories > Delete DELETE_CATEGORY_DESC: '您确定要删除分类 {name} 吗?', // List diff --git a/packages/shared/src/constants/patterns.ts b/packages/shared/src/constants/patterns.ts index 237b0b5ed19..aef63ca2860 100644 --- a/packages/shared/src/constants/patterns.ts +++ b/packages/shared/src/constants/patterns.ts @@ -38,3 +38,5 @@ export const PATTERN_UTC_TIME = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[ export const PATTERN_WORD = /(?=.*?[A-Z])(?=.*?[a-z])/; export const PATTERN_NUMBER = /(?=.*?[0-9])/; export const PATTERN_INTEGER_NUMBER = /^[+]{0,1}(\d+)$/; +export const PATTERN_APPTEMPLATE_CATEGORY_NAME = + /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/;