refactor: clean code

This commit is contained in:
Fu Diwei
2025-03-27 20:39:06 +08:00
parent fb860981d6
commit 7503d52857
3 changed files with 16 additions and 10 deletions

View File

@@ -38,10 +38,13 @@ const DeployNodeConfigFormCdnflyConfig = ({ form: formInst, formName, disabled,
if (fieldResourceType !== RESOURCE_TYPE_SITE) return true;
return /^\d+$/.test(v + "") && +v > 0;
}, t("workflow_node.deploy.form.cdnfly_site_id.placeholder")),
certificateId: z.union([z.string(), z.number().int()]).refine((v) => {
if (fieldResourceType !== RESOURCE_TYPE_CERTIFICATE) return true;
return /^\d+$/.test(v + "") && +v > 0;
}, t("workflow_node.deploy.form.cdnfly_certificate_id.placeholder")),
certificateId: z
.union([z.string(), z.number().int()])
.nullish()
.refine((v) => {
if (fieldResourceType !== RESOURCE_TYPE_CERTIFICATE) return true;
return /^\d+$/.test(v + "") && +v! > 0;
}, t("workflow_node.deploy.form.cdnfly_certificate_id.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);