mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-17 09:59:51 +00:00
Merge pull request #407 from fudiwei/feat/new-workflow-ui
bugfix #405 on v0.3.x
This commit is contained in:
commit
aa1b69d7f2
@ -210,7 +210,7 @@ func createDeployer(provider domain.DeployProviderType, accessConfig string, dep
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case domain.DeployProviderTypeK8sSecret:
|
case domain.DeployProviderTypeKubernetesSecret:
|
||||||
{
|
{
|
||||||
access := &domain.AccessConfigForKubernetes{}
|
access := &domain.AccessConfigForKubernetes{}
|
||||||
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
||||||
|
@ -51,7 +51,7 @@ const (
|
|||||||
DeployProviderTypeDogeCloudCDN = DeployProviderType("dogecloud-cdn")
|
DeployProviderTypeDogeCloudCDN = DeployProviderType("dogecloud-cdn")
|
||||||
DeployProviderTypeHuaweiCloudCDN = DeployProviderType("huaweicloud-cdn")
|
DeployProviderTypeHuaweiCloudCDN = DeployProviderType("huaweicloud-cdn")
|
||||||
DeployProviderTypeHuaweiCloudELB = DeployProviderType("huaweicloud-elb")
|
DeployProviderTypeHuaweiCloudELB = DeployProviderType("huaweicloud-elb")
|
||||||
DeployProviderTypeK8sSecret = DeployProviderType("k8s-secret")
|
DeployProviderTypeKubernetesSecret = DeployProviderType("k8s-secret")
|
||||||
DeployProviderTypeLocal = DeployProviderType("local")
|
DeployProviderTypeLocal = DeployProviderType("local")
|
||||||
DeployProviderTypeQiniuCDN = DeployProviderType("qiniu-cdn")
|
DeployProviderTypeQiniuCDN = DeployProviderType("qiniu-cdn")
|
||||||
DeployProviderTypeSSH = DeployProviderType("ssh")
|
DeployProviderTypeSSH = DeployProviderType("ssh")
|
||||||
|
@ -147,7 +147,7 @@ func (d *TencentCloudCDNDeployer) getDomainsByCertificateId(cloudCertId string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains := make([]string, 0)
|
domains := make([]string, 0)
|
||||||
if describeCertDomainsResp.Response.Domains == nil {
|
if describeCertDomainsResp.Response.Domains != nil {
|
||||||
for _, domain := range describeCertDomainsResp.Response.Domains {
|
for _, domain := range describeCertDomainsResp.Response.Domains {
|
||||||
domains = append(domains, *domain)
|
domains = append(domains, *domain)
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ func (d *TencentCloudECDNDeployer) getDomainsByCertificateId(cloudCertId string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
domains := make([]string, 0)
|
domains := make([]string, 0)
|
||||||
if describeCertDomainsResp.Response.Domains == nil {
|
if describeCertDomainsResp.Response.Domains != nil {
|
||||||
for _, domain := range describeCertDomainsResp.Response.Domains {
|
for _, domain := range describeCertDomainsResp.Response.Domains {
|
||||||
domains = append(domains, *domain)
|
domains = append(domains, *domain)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ const ApplyNodeConfigForm = forwardRef<ApplyNodeConfigFormInstance, ApplyNodeCon
|
|||||||
domains: z.string({ message: t("workflow_node.apply.form.domains.placeholder") }).refine((v) => {
|
domains: z.string({ message: t("workflow_node.apply.form.domains.placeholder") }).refine((v) => {
|
||||||
return String(v)
|
return String(v)
|
||||||
.split(MULTIPLE_INPUT_DELIMITER)
|
.split(MULTIPLE_INPUT_DELIMITER)
|
||||||
.every((e) => validDomainName(e, true));
|
.every((e) => validDomainName(e, { allowWildcard: true }));
|
||||||
}, t("common.errmsg.domain_invalid")),
|
}, t("common.errmsg.domain_invalid")),
|
||||||
contactEmail: z.string({ message: t("workflow_node.apply.form.contact_email.placeholder") }).email(t("common.errmsg.email_invalid")),
|
contactEmail: z.string({ message: t("workflow_node.apply.form.contact_email.placeholder") }).email(t("common.errmsg.email_invalid")),
|
||||||
providerAccessId: z
|
providerAccessId: z
|
||||||
@ -308,7 +308,7 @@ const DomainsModalInput = memo(({ value, trigger, onChange }: { value?: string;
|
|||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domains: z.array(z.string()).refine((v) => {
|
domains: z.array(z.string()).refine((v) => {
|
||||||
return v.every((e) => !e?.trim() || validDomainName(e.trim(), true));
|
return v.every((e) => !e?.trim() || validDomainName(e.trim(), { allowWildcard: true }));
|
||||||
}, t("common.errmsg.domain_invalid")),
|
}, t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormAliyunCDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.aliyun_cdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.aliyun_cdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormAliyunDCDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.aliyun_dcdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.aliyun_dcdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ const DeployNodeConfigFormAliyunOSSConfig = ({
|
|||||||
.trim(),
|
.trim(),
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.aliyun_oss_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.aliyun_oss_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormBaiduCloudCDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.baiducloud_cdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.baiducloud_cdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormBytePlusCDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.byteplus_cdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.byteplus_cdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ const DeployNodeConfigFormQiniuCDNConfig = ({ form: formInst, formName, disabled
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.qiniu_cdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.qiniu_cdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormTencentCloudCDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.tencentcloud_cdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.tencentcloud_cdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ const DeployNodeConfigFormTencentCloudCLBConfig = ({
|
|||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.tencentcloud_clb_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.tencentcloud_clb_domain.placeholder") })
|
||||||
.nullish()
|
.nullish()
|
||||||
.refine((v) => RESOURCE_TYPE_RULEDOMAIN !== fieldResourceType || validDomainName(v!, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => RESOURCE_TYPE_RULEDOMAIN !== fieldResourceType || validDomainName(v!, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormTencentCloudECDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.tencentcloud_ecdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.tencentcloud_ecdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormVolcEngineCDNConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.volcengine_cdn_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.volcengine_cdn_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const DeployNodeConfigFormVolcEngineLiveConfig = ({
|
|||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.volcengine_live_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.volcengine_live_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v, true), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ export const validCronExpression = (value: string) => {
|
|||||||
return _validCronExpression(value);
|
return _validCronExpression(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const validDomainName = (value: string, wildcard = false) => {
|
export const validDomainName = (value: string, { allowWildcard = false }: { allowWildcard?: boolean }) => {
|
||||||
const re = wildcard ? /^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{1,}$/ : /^(?!-)[A-Za-z0-9-]{1,}(?<!-)(\.[A-Za-z0-9-]{1,}(?<!-)){0,}$/;
|
const re = allowWildcard ? /^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{1,}$/ : /^(?!-)[A-Za-z0-9-]{1,}(?<!-)(\.[A-Za-z0-9-]{1,}(?<!-)){0,}$/;
|
||||||
return re.test(value);
|
return re.test(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user