Skip to content

Commit

Permalink
fix(instance) validate name does not start with a number
Browse files Browse the repository at this point in the history
  • Loading branch information
edlerd committed Sep 18, 2023
1 parent ca5321e commit e9a472a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/instances/CreateInstanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ const CreateInstanceForm: FC = () => {
.matches(/^[A-Za-z0-9-]+$/, {
message: "Only alphanumeric and hyphen characters are allowed",
})
.matches(/^[A-Za-z].*$/, {
message: "Instance name must start with a letter",
})
.optional(),
instanceType: Yup.string().required("Instance type is required"),
});
Expand Down
3 changes: 3 additions & 0 deletions src/pages/instances/InstanceDetailHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const InstanceDetailHeader: FC<Props> = ({ name, instance, project }) => {
.matches(/^[A-Za-z0-9-]+$/, {
message: "Only alphanumeric and hyphen characters are allowed",
})
.matches(/^[A-Za-z].*$/, {
message: "Instance name must start with a letter",
})
.required("Instance name is required"),
});

Expand Down

0 comments on commit e9a472a

Please sign in to comment.