Skip to content

Commit

Permalink
[master] fix: add name rules when create yaml app (#4388)
Browse files Browse the repository at this point in the history
fix: add name rules when create yaml app

Signed-off-by: ROOMrepair <[email protected]>
Co-authored-by: ROOMrepair <[email protected]>
  • Loading branch information
ks-ci-bot and ROOMrepair authored Dec 24, 2024
1 parent 91b30dd commit 09bd2b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export function CreateYamlApp(props: Props) {
name={['appName']}
rules={[
{ required: true, message: t('NAME_EMPTY_DESC') },
{
pattern: Pattern.PATTERN_ALIAS_NAME,
message: t('PROJECT_NAME_INVALID_DESC'),
},
// {
// pattern: Pattern.PATTERN_SERVICE_NAME,
// message: t('PROJECT_NAME_INVALID_DESC'),
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/constants/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ 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_ALIAS_NAME=/^[a-zA-Z0-9\u4e00-\u9fa5]([a-zA-Z0-9\u4e00-\u9fa5-]*[a-zA-Z0-9\u4e00-\u9fa5])*$/;
export const PATTERN_ALIAS_NAME =
/^[a-zA-Z0-9\u4e00-\u9fa5](?:[a-zA-Z0-9\u4e00-\u9fa5]|-(?=[a-zA-Z0-9\u4e00-\u9fa5]))*$/;

0 comments on commit 09bd2b9

Please sign in to comment.