fix some bugs

This commit is contained in:
yoan
2024-09-22 20:00:55 +08:00
parent 2cca82eb95
commit a259ccdfec
10 changed files with 756 additions and 30 deletions

View File

@@ -56,13 +56,22 @@ const AccessSSHForm = ({
const originGroup = data ? (data.group ? data.group : "") : "";
const domainReg = /^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
const ipReg =
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
const formSchema = z.object({
id: z.string().optional(),
name: z.string().min(1).max(64),
configType: accessFormType,
host: z.string().ip({
message: "请输入合法的IP地址",
}),
host: z.string().refine(
(str) => {
return ipReg.test(str) || domainReg.test(str);
},
{
message: "请输入正确的域名或IP",
}
),
group: z.string().optional(),
port: z.string().min(1).max(5),
username: z.string().min(1).max(64),
@@ -316,7 +325,7 @@ const AccessSSHForm = ({
name="host"
render={({ field }) => (
<FormItem className="grow">
<FormLabel>IP</FormLabel>
<FormLabel>HOST</FormLabel>
<FormControl>
<Input placeholder="请输入Host" {...field} />
</FormControl>

View File

@@ -22,7 +22,7 @@ const DeployState = ({ deployment }: DeployStateProps) => {
return (
<>
{deployment.phase === "deploy" && deployment.phaseSuccess ? (
{(deployment.phase === "deploy" && deployment.phaseSuccess) || deployment.wholeSuccess ? (
<CircleCheck size={16} className="text-green-700" />
) : (
<>