Merge pull request #328 from fudiwei/bugfix/tencentcloud-deploy-config-not-saving

bugfix #324
This commit is contained in:
usual2970 2024-11-13 08:14:05 +08:00 committed by GitHub
commit 6ac7a51ce0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,9 +44,7 @@ const DeployToTencentCLB = () => {
}), }),
loadbalancerId: z.string().min(1, t("domain.deployment.form.tencent_clb_loadbalancer_id.placeholder")), loadbalancerId: z.string().min(1, t("domain.deployment.form.tencent_clb_loadbalancer_id.placeholder")),
listenerId: z.string().optional(), listenerId: z.string().optional(),
domain: z.string().regex(/^$|^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, { domain: z.string().optional(),
message: t("common.errmsg.domain_invalid"),
}),
}) })
.refine( .refine(
(data) => { (data) => {
@ -63,10 +61,20 @@ const DeployToTencentCLB = () => {
path: ["listenerId"], path: ["listenerId"],
} }
) )
.refine((data) => (data.resourceType === "ruledomain" ? !!data.domain?.trim() : true), { .refine(
message: t("domain.deployment.form.tencent_clb_ruledomain.placeholder"), (data) => {
path: ["domain"], switch (data.resourceType) {
}); case "ssl-deploy":
case "ruledomain":
return !!data.domain?.trim() && /^$|^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(data.domain);
}
return true;
},
{
message: t("domain.deployment.form.tencent_clb_ruledomain.placeholder"),
path: ["domain"],
}
);
useEffect(() => { useEffect(() => {
const res = formSchema.safeParse(config.config); const res = formSchema.safeParse(config.config);