mirror of
https://github.com/usual2970/certimate.git
synced 2025-07-27 19:48:33 +00:00
feat: add volcengine alb deployer
This commit is contained in:
@@ -70,6 +70,7 @@ import DeployNodeConfigFormUCloudUCDNConfig from "./DeployNodeConfigFormUCloudUC
|
||||
import DeployNodeConfigFormUCloudUS3Config from "./DeployNodeConfigFormUCloudUS3Config.tsx";
|
||||
import DeployNodeConfigFormUpyunCDNConfig from "./DeployNodeConfigFormUpyunCDNConfig.tsx";
|
||||
import DeployNodeConfigFormUpyunFileConfig from "./DeployNodeConfigFormUpyunFileConfig.tsx";
|
||||
import DeployNodeConfigFormVolcEngineALBConfig from "./DeployNodeConfigFormVolcEngineALBConfig.tsx";
|
||||
import DeployNodeConfigFormVolcEngineCDNConfig from "./DeployNodeConfigFormVolcEngineCDNConfig.tsx";
|
||||
import DeployNodeConfigFormVolcEngineCLBConfig from "./DeployNodeConfigFormVolcEngineCLBConfig.tsx";
|
||||
import DeployNodeConfigFormVolcEngineDCDNConfig from "./DeployNodeConfigFormVolcEngineDCDNConfig.tsx";
|
||||
@@ -258,6 +259,8 @@ const DeployNodeConfigForm = forwardRef<DeployNodeConfigFormInstance, DeployNode
|
||||
return <DeployNodeConfigFormUpyunCDNConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.UPYUN_FILE:
|
||||
return <DeployNodeConfigFormUpyunFileConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.VOLCENGINE_ALB:
|
||||
return <DeployNodeConfigFormVolcEngineALBConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.VOLCENGINE_CDN:
|
||||
return <DeployNodeConfigFormVolcEngineCDNConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.VOLCENGINE_CLB:
|
||||
|
@@ -0,0 +1,150 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, type FormInstance, Input, Select } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import Show from "@/components/Show";
|
||||
import { validDomainName } from "@/utils/validators";
|
||||
|
||||
type DeployNodeConfigFormVolcEngineALBConfigFieldValues = Nullish<{
|
||||
resourceType: string;
|
||||
region: string;
|
||||
loadbalancerId?: string;
|
||||
listenerId?: string;
|
||||
domain?: string;
|
||||
}>;
|
||||
|
||||
export type DeployNodeConfigFormVolcEngineALBConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: DeployNodeConfigFormVolcEngineALBConfigFieldValues;
|
||||
onValuesChange?: (values: DeployNodeConfigFormVolcEngineALBConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const RESOURCE_TYPE_LOADBALANCER = "loadbalancer" as const;
|
||||
const RESOURCE_TYPE_LISTENER = "listener" as const;
|
||||
|
||||
const initFormModel = (): DeployNodeConfigFormVolcEngineALBConfigFieldValues => {
|
||||
return {
|
||||
resourceType: RESOURCE_TYPE_LISTENER,
|
||||
};
|
||||
};
|
||||
|
||||
const DeployNodeConfigFormVolcEngineALBConfig = ({
|
||||
form: formInst,
|
||||
formName,
|
||||
disabled,
|
||||
initialValues,
|
||||
onValuesChange,
|
||||
}: DeployNodeConfigFormVolcEngineALBConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
resourceType: z.union([z.literal(RESOURCE_TYPE_LOADBALANCER), z.literal(RESOURCE_TYPE_LISTENER)], {
|
||||
message: t("workflow_node.deploy.form.volcengine_alb_resource_type.placeholder"),
|
||||
}),
|
||||
region: z
|
||||
.string({ message: t("workflow_node.deploy.form.volcengine_alb_region.placeholder") })
|
||||
.nonempty(t("workflow_node.deploy.form.volcengine_alb_region.placeholder"))
|
||||
.trim(),
|
||||
loadbalancerId: z
|
||||
.string()
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 }))
|
||||
.trim()
|
||||
.nullish()
|
||||
.refine(
|
||||
(v) => ![RESOURCE_TYPE_LOADBALANCER].includes(fieldResourceType) || !!v?.trim(),
|
||||
t("workflow_node.deploy.form.volcengine_alb_loadbalancer_id.placeholder")
|
||||
),
|
||||
listenerId: z
|
||||
.string()
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 }))
|
||||
.trim()
|
||||
.nullish()
|
||||
.refine(
|
||||
(v) => ![RESOURCE_TYPE_LISTENER].includes(fieldResourceType) || !!v?.trim(),
|
||||
t("workflow_node.deploy.form.volcengine_alb_listener_id.placeholder")
|
||||
),
|
||||
domain: z
|
||||
.string()
|
||||
.nullish()
|
||||
.refine((v) => {
|
||||
if (![RESOURCE_TYPE_LOADBALANCER, RESOURCE_TYPE_LISTENER].includes(fieldResourceType)) return true;
|
||||
return !v || validDomainName(v!, { allowWildcard: true });
|
||||
}, t("common.errmsg.domain_invalid")),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
|
||||
const fieldResourceType = Form.useWatch("resourceType", formInst);
|
||||
|
||||
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="resourceType" label={t("workflow_node.deploy.form.volcengine_alb_resource_type.label")} rules={[formRule]}>
|
||||
<Select placeholder={t("workflow_node.deploy.form.volcengine_alb_resource_type.placeholder")}>
|
||||
<Select.Option key={RESOURCE_TYPE_LOADBALANCER} value={RESOURCE_TYPE_LOADBALANCER}>
|
||||
{t("workflow_node.deploy.form.volcengine_alb_resource_type.option.loadbalancer.label")}
|
||||
</Select.Option>
|
||||
<Select.Option key={RESOURCE_TYPE_LISTENER} value={RESOURCE_TYPE_LISTENER}>
|
||||
{t("workflow_node.deploy.form.volcengine_alb_resource_type.option.listener.label")}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="region"
|
||||
label={t("workflow_node.deploy.form.volcengine_alb_region.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_alb_region.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.volcengine_alb_region.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Show when={fieldResourceType === RESOURCE_TYPE_LOADBALANCER}>
|
||||
<Form.Item
|
||||
name="listenerId"
|
||||
label={t("workflow_node.deploy.form.volcengine_alb_loadbalancer_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_alb_loadbalancer_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.volcengine_alb_loadbalancer_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Show>
|
||||
|
||||
<Show when={fieldResourceType === RESOURCE_TYPE_LISTENER}>
|
||||
<Form.Item
|
||||
name="listenerId"
|
||||
label={t("workflow_node.deploy.form.volcengine_alb_listener_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_alb_listener_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.volcengine_alb_listener_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Show>
|
||||
|
||||
<Show when={fieldResourceType === RESOURCE_TYPE_LOADBALANCER || fieldResourceType === RESOURCE_TYPE_LISTENER}>
|
||||
<Form.Item
|
||||
name="domain"
|
||||
label={t("workflow_node.deploy.form.volcengine_alb_snidomain.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_alb_snidomain.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.volcengine_alb_snidomain.placeholder")} />
|
||||
</Form.Item>
|
||||
</Show>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default DeployNodeConfigFormVolcEngineALBConfig;
|
@@ -10,7 +10,6 @@ type DeployNodeConfigFormVolcEngineCLBConfigFieldValues = Nullish<{
|
||||
region: string;
|
||||
loadbalancerId?: string;
|
||||
listenerId?: string;
|
||||
domain?: string;
|
||||
}>;
|
||||
|
||||
export type DeployNodeConfigFormVolcEngineCLBConfigProps = {
|
||||
@@ -21,6 +20,7 @@ export type DeployNodeConfigFormVolcEngineCLBConfigProps = {
|
||||
onValuesChange?: (values: DeployNodeConfigFormVolcEngineCLBConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const RESOURCE_TYPE_LOADBALANCER = "loadbalancer" as const;
|
||||
const RESOURCE_TYPE_LISTENER = "listener" as const;
|
||||
|
||||
const initFormModel = (): DeployNodeConfigFormVolcEngineCLBConfigFieldValues => {
|
||||
@@ -39,11 +39,22 @@ const DeployNodeConfigFormVolcEngineCLBConfig = ({
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
resourceType: z.literal(RESOURCE_TYPE_LISTENER, { message: t("workflow_node.deploy.form.volcengine_clb_resource_type.placeholder") }),
|
||||
resourceType: z.union([z.literal(RESOURCE_TYPE_LOADBALANCER), z.literal(RESOURCE_TYPE_LISTENER)], {
|
||||
message: t("workflow_node.deploy.form.volcengine_clb_resource_type.placeholder"),
|
||||
}),
|
||||
region: z
|
||||
.string({ message: t("workflow_node.deploy.form.volcengine_clb_region.placeholder") })
|
||||
.nonempty(t("workflow_node.deploy.form.volcengine_clb_region.placeholder"))
|
||||
.trim(),
|
||||
loadbalancerId: z
|
||||
.string()
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 }))
|
||||
.trim()
|
||||
.nullish()
|
||||
.refine(
|
||||
(v) => ![RESOURCE_TYPE_LOADBALANCER].includes(fieldResourceType) || !!v?.trim(),
|
||||
t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.placeholder")
|
||||
),
|
||||
listenerId: z
|
||||
.string()
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 }))
|
||||
@@ -73,6 +84,9 @@ const DeployNodeConfigFormVolcEngineCLBConfig = ({
|
||||
>
|
||||
<Form.Item name="resourceType" label={t("workflow_node.deploy.form.volcengine_clb_resource_type.label")} rules={[formRule]}>
|
||||
<Select placeholder={t("workflow_node.deploy.form.volcengine_clb_resource_type.placeholder")}>
|
||||
<Select.Option key={RESOURCE_TYPE_LOADBALANCER} value={RESOURCE_TYPE_LOADBALANCER}>
|
||||
{t("workflow_node.deploy.form.volcengine_clb_resource_type.option.loadbalancer.label")}
|
||||
</Select.Option>
|
||||
<Select.Option key={RESOURCE_TYPE_LISTENER} value={RESOURCE_TYPE_LISTENER}>
|
||||
{t("workflow_node.deploy.form.volcengine_clb_resource_type.option.listener.label")}
|
||||
</Select.Option>
|
||||
@@ -88,6 +102,17 @@ const DeployNodeConfigFormVolcEngineCLBConfig = ({
|
||||
<Input placeholder={t("workflow_node.deploy.form.volcengine_clb_region.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Show when={fieldResourceType === RESOURCE_TYPE_LOADBALANCER}>
|
||||
<Form.Item
|
||||
name="listenerId"
|
||||
label={t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.volcengine_clb_loadbalancer_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Show>
|
||||
|
||||
<Show when={fieldResourceType === RESOURCE_TYPE_LISTENER}>
|
||||
<Form.Item
|
||||
name="listenerId"
|
||||
|
Reference in New Issue
Block a user