Merge pull request #407 from fudiwei/feat/new-workflow-ui

bugfix #405 on v0.3.x
This commit is contained in:
Yoan.liu 2025-01-08 18:10:20 +08:00 committed by GitHub
commit aa1b69d7f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 19 additions and 19 deletions

View File

@ -210,7 +210,7 @@ func createDeployer(provider domain.DeployProviderType, accessConfig string, dep
return deployer, logger, err
}
case domain.DeployProviderTypeK8sSecret:
case domain.DeployProviderTypeKubernetesSecret:
{
access := &domain.AccessConfigForKubernetes{}
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {

View File

@ -51,7 +51,7 @@ const (
DeployProviderTypeDogeCloudCDN = DeployProviderType("dogecloud-cdn")
DeployProviderTypeHuaweiCloudCDN = DeployProviderType("huaweicloud-cdn")
DeployProviderTypeHuaweiCloudELB = DeployProviderType("huaweicloud-elb")
DeployProviderTypeK8sSecret = DeployProviderType("k8s-secret")
DeployProviderTypeKubernetesSecret = DeployProviderType("k8s-secret")
DeployProviderTypeLocal = DeployProviderType("local")
DeployProviderTypeQiniuCDN = DeployProviderType("qiniu-cdn")
DeployProviderTypeSSH = DeployProviderType("ssh")

View File

@ -147,7 +147,7 @@ func (d *TencentCloudCDNDeployer) getDomainsByCertificateId(cloudCertId string)
}
domains := make([]string, 0)
if describeCertDomainsResp.Response.Domains == nil {
if describeCertDomainsResp.Response.Domains != nil {
for _, domain := range describeCertDomainsResp.Response.Domains {
domains = append(domains, *domain)
}

View File

@ -130,7 +130,7 @@ func (d *TencentCloudECDNDeployer) getDomainsByCertificateId(cloudCertId string)
}
domains := make([]string, 0)
if describeCertDomainsResp.Response.Domains == nil {
if describeCertDomainsResp.Response.Domains != nil {
for _, domain := range describeCertDomainsResp.Response.Domains {
domains = append(domains, *domain)
}

View File

@ -50,7 +50,7 @@ const ApplyNodeConfigForm = forwardRef<ApplyNodeConfigFormInstance, ApplyNodeCon
domains: z.string({ message: t("workflow_node.apply.form.domains.placeholder") }).refine((v) => {
return String(v)
.split(MULTIPLE_INPUT_DELIMITER)
.every((e) => validDomainName(e, true));
.every((e) => validDomainName(e, { allowWildcard: true }));
}, t("common.errmsg.domain_invalid")),
contactEmail: z.string({ message: t("workflow_node.apply.form.contact_email.placeholder") }).email(t("common.errmsg.email_invalid")),
providerAccessId: z
@ -308,7 +308,7 @@ const DomainsModalInput = memo(({ value, trigger, onChange }: { value?: string;
const formSchema = z.object({
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")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormAliyunCDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormAliyunDCDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -43,7 +43,7 @@ const DeployNodeConfigFormAliyunOSSConfig = ({
.trim(),
domain: z
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormBaiduCloudCDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormBytePlusCDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -27,7 +27,7 @@ const DeployNodeConfigFormQiniuCDNConfig = ({ form: formInst, formName, disabled
const formSchema = z.object({
domain: z
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormTencentCloudCDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -66,7 +66,7 @@ const DeployNodeConfigFormTencentCloudCLBConfig = ({
domain: z
.string({ message: t("workflow_node.deploy.form.tencentcloud_clb_domain.placeholder") })
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormTencentCloudECDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormVolcEngineCDNConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -33,7 +33,7 @@ const DeployNodeConfigFormVolcEngineLiveConfig = ({
const formSchema = z.object({
domain: z
.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);

View File

@ -4,8 +4,8 @@ export const validCronExpression = (value: string) => {
return _validCronExpression(value);
};
export const validDomainName = (value: string, wildcard = false) => {
const re = wildcard ? /^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{1,}$/ : /^(?!-)[A-Za-z0-9-]{1,}(?<!-)(\.[A-Za-z0-9-]{1,}(?<!-)){0,}$/;
export const validDomainName = (value: string, { allowWildcard = false }: { allowWildcard?: boolean }) => {
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);
};