feat: add jdcloud dns-01 applicant
This commit is contained in:
@@ -35,6 +35,7 @@ import { validDomainName, validIPv4Address, validIPv6Address } from "@/utils/val
|
||||
|
||||
import ApplyNodeConfigFormAWSRoute53Config from "./ApplyNodeConfigFormAWSRoute53Config";
|
||||
import ApplyNodeConfigFormHuaweiCloudDNSConfig from "./ApplyNodeConfigFormHuaweiCloudDNSConfig";
|
||||
import ApplyNodeConfigFormJDCloudDNSConfig from "./ApplyNodeConfigFormJDCloudDNSConfig";
|
||||
|
||||
type ApplyNodeConfigFormFieldValues = Partial<WorkflowNodeConfigForApply>;
|
||||
|
||||
@@ -145,6 +146,9 @@ const ApplyNodeConfigForm = forwardRef<ApplyNodeConfigFormInstance, ApplyNodeCon
|
||||
case APPLY_DNS_PROVIDERS.HUAWEICLOUD:
|
||||
case APPLY_DNS_PROVIDERS.HUAWEICLOUD_DNS:
|
||||
return <ApplyNodeConfigFormHuaweiCloudDNSConfig {...nestedFormProps} />;
|
||||
case APPLY_DNS_PROVIDERS.JDCLOUD:
|
||||
case APPLY_DNS_PROVIDERS.JDCLOUD_DNS:
|
||||
return <ApplyNodeConfigFormJDCloudDNSConfig {...nestedFormProps} />;
|
||||
}
|
||||
}, [disabled, initialValues?.providerConfig, fieldProvider, nestedFormInst, nestedFormName]);
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
type ApplyNodeConfigFormJDCloudDNSConfigFieldValues = Nullish<{
|
||||
regionId: string;
|
||||
}>;
|
||||
|
||||
export type ApplyNodeConfigFormJDCloudDNSConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: ApplyNodeConfigFormJDCloudDNSConfigFieldValues;
|
||||
onValuesChange?: (values: ApplyNodeConfigFormJDCloudDNSConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const initFormModel = (): ApplyNodeConfigFormJDCloudDNSConfigFieldValues => {
|
||||
return {
|
||||
regionId: "cn-north-1",
|
||||
};
|
||||
};
|
||||
|
||||
const ApplyNodeConfigFormJDCloudDNSConfig = ({
|
||||
form: formInst,
|
||||
formName,
|
||||
disabled,
|
||||
initialValues,
|
||||
onValuesChange,
|
||||
}: ApplyNodeConfigFormJDCloudDNSConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
regionId: z
|
||||
.string({ message: t("workflow_node.apply.form.jdcloud_dns_region_id.placeholder") })
|
||||
.nonempty(t("workflow_node.apply.form.jdcloud_dns_region_id.placeholder"))
|
||||
.trim(),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
|
||||
const handleFormChange = (_: unknown, values: z.infer<typeof formSchema>) => {
|
||||
onValuesChange?.(values);
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
form={formInst}
|
||||
disabled={disabled}
|
||||
initialValues={initialValues ?? initFormModel()}
|
||||
layout="vertical"
|
||||
name={formName}
|
||||
onValuesChange={handleFormChange}
|
||||
>
|
||||
<Form.Item name="regionId" label={t("workflow_node.apply.form.jdcloud_dns_region_id_id.label")} rules={[formRule]}>
|
||||
<Input placeholder={t("workflow_node.apply.form.jdcloud_dns_region_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default ApplyNodeConfigFormJDCloudDNSConfig;
|
||||
Reference in New Issue
Block a user