From 9f72e2efd9b0422b5025d05fc3ccd2db36593a15 Mon Sep 17 00:00:00 2001 From: Harish Govindarajulu Date: Mon, 21 Oct 2024 14:19:55 -0400 Subject: [PATCH] ui: Update regex pattern helper text for validating team name (PROJQUAY-8110) (#3353) * ui: update regex pattern in helpertext for team name(PROJQUAY-8110) Signed-off-by: harishsurf * old ui: update regex pattern for validating team name --------- Signed-off-by: harishsurf --- static/js/constants/name-patterns.constant.ts | 2 +- .../createPermissionDrawer/CreatePermissionDrawer.tsx | 2 +- .../Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx | 2 +- web/src/routes/RepositoryDetails/RepositoryDetails.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/constants/name-patterns.constant.ts b/static/js/constants/name-patterns.constant.ts index 942028ee1e..0ed23ef074 100644 --- a/static/js/constants/name-patterns.constant.ts +++ b/static/js/constants/name-patterns.constant.ts @@ -2,7 +2,7 @@ * Regex patterns to for validating account names. */ export const NAME_PATTERNS: any = { - TEAM_PATTERN: '^[a-z][a-z0-9]+$', + TEAM_PATTERN: '^([a-z0-9]+(?:[._-][a-z0-9]+)*)$', ROBOT_PATTERN: '^[a-z][a-z0-9_]{1,254}$', USERNAME_PATTERN: '^(?=.{2,255}$)([a-z0-9]+(?:[._-][a-z0-9]+)*)$', }; diff --git a/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx b/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx index c70de93cae..afaa68b39c 100644 --- a/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx +++ b/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx @@ -166,7 +166,7 @@ export default function CreatePermissionDrawer( nameLabel="Provide a name for your new team:" descriptionLabel="Provide an optional description for your new team" helperText="Enter a description to provide extra information to your teammates about this team:" - nameHelperText="Choose a name to inform your teammates about this team. Must match ^[a-z][a-z0-9]+$." + nameHelperText="Choose a name to inform your teammates about this team. Must match ^([a-z0-9]+(?:[._-][a-z0-9]+)*)$" isModalOpen={isTeamModalOpen} handleModalToggle={() => setIsTeamModalOpen(!isTeamModalOpen)} handleWizardToggle={() => setIsTeamWizardOpen(!isTeamWizardOpen)} diff --git a/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx b/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx index 3268dcccf2..2da47c98c3 100644 --- a/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx +++ b/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx @@ -54,7 +54,7 @@ export default function TeamsAndMembershipList() { nameLabel="Provide a name for your new team:" descriptionLabel="Provide an optional description for your new team" helperText="Enter a description to provide extra information to your teammates about this team:" - nameHelperText="Choose a name to inform your teammates about this team. Must match ^[a-z][a-z0-9]+$." + nameHelperText="Choose a name to inform your teammates about this team. Must match ^([a-z0-9]+(?:[._-][a-z0-9]+)*)$" isModalOpen={isTeamModalOpen} handleModalToggle={() => { setIsTeamModalOpen(!isTeamModalOpen); diff --git a/web/src/routes/RepositoryDetails/RepositoryDetails.tsx b/web/src/routes/RepositoryDetails/RepositoryDetails.tsx index 55a12402f4..27c9472bb2 100644 --- a/web/src/routes/RepositoryDetails/RepositoryDetails.tsx +++ b/web/src/routes/RepositoryDetails/RepositoryDetails.tsx @@ -125,7 +125,7 @@ export default function RepositoryDetails() { nameLabel="Provide a name for your new team:" descriptionLabel="Provide an optional description for your new team" helperText="Enter a description to provide extra information to your teammates about this team:" - nameHelperText="Choose a name to inform your teammates about this team. Must match ^[a-z][a-z0-9]+$." + nameHelperText="Choose a name to inform your teammates about this team. Must match ^([a-z0-9]+(?:[._-][a-z0-9]+)*)$" isModalOpen={isTeamModalOpen} handleModalToggle={() => setIsTeamModalOpen(!isTeamModalOpen)} validateName={validateTeamName}