feat: add aliyun esa deployer

This commit is contained in:
Fu Diwei
2025-02-10 17:59:36 +08:00
parent 1f6b33f4f6
commit ac4c375243
13 changed files with 331 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import DeployNodeConfigFormAliyunALBConfig from "./DeployNodeConfigFormAliyunALB
import DeployNodeConfigFormAliyunCDNConfig from "./DeployNodeConfigFormAliyunCDNConfig";
import DeployNodeConfigFormAliyunCLBConfig from "./DeployNodeConfigFormAliyunCLBConfig";
import DeployNodeConfigFormAliyunDCDNConfig from "./DeployNodeConfigFormAliyunDCDNConfig";
import DeployNodeConfigFormAliyunESAConfig from "./DeployNodeConfigFormAliyunESAConfig";
import DeployNodeConfigFormAliyunLiveConfig from "./DeployNodeConfigFormAliyunLiveConfig";
import DeployNodeConfigFormAliyunNLBConfig from "./DeployNodeConfigFormAliyunNLBConfig";
import DeployNodeConfigFormAliyunOSSConfig from "./DeployNodeConfigFormAliyunOSSConfig";
@@ -129,6 +130,8 @@ const DeployNodeConfigForm = forwardRef<DeployNodeConfigFormInstance, DeployNode
return <DeployNodeConfigFormAliyunCDNConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.ALIYUN_DCDN:
return <DeployNodeConfigFormAliyunDCDNConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.ALIYUN_ESA:
return <DeployNodeConfigFormAliyunESAConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.ALIYUN_LIVE:
return <DeployNodeConfigFormAliyunLiveConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.ALIYUN_NLB:

View File

@@ -0,0 +1,78 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
type DeployNodeConfigFormAliyunESAConfigFieldValues = Nullish<{
region: string;
siteId: string;
}>;
export type DeployNodeConfigFormAliyunESAConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: DeployNodeConfigFormAliyunESAConfigFieldValues;
onValuesChange?: (values: DeployNodeConfigFormAliyunESAConfigFieldValues) => void;
};
const initFormModel = (): DeployNodeConfigFormAliyunESAConfigFieldValues => {
return {};
};
const DeployNodeConfigFormAliyunESAConfig = ({
form: formInst,
formName,
disabled,
initialValues,
onValuesChange,
}: DeployNodeConfigFormAliyunESAConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_esa_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_esa_region.placeholder"))
.trim(),
siteId: z
.string({ message: t("workflow_node.deploy.form.aliyun_esa_site_id.placeholder") })
.regex(/^[1-9]\d*$/, t("workflow_node.deploy.form.aliyun_esa_site_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="region"
label={t("workflow_node.deploy.form.aliyun_esa_region.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_esa_region.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.aliyun_esa_region.placeholder")} />
</Form.Item>
<Form.Item
name="siteId"
label={t("workflow_node.deploy.form.aliyun_esa_site_id.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_esa_site_id.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.aliyun_esa_site_id.placeholder")} />
</Form.Item>
</Form>
);
};
export default DeployNodeConfigFormAliyunESAConfig;

View File

@@ -179,6 +179,7 @@ export const DEPLOY_PROVIDERS = Object.freeze({
ALIYUN_CDN: `${ACCESS_PROVIDERS.ALIYUN}-cdn`,
ALIYUN_CLB: `${ACCESS_PROVIDERS.ALIYUN}-clb`,
ALIYUN_DCDN: `${ACCESS_PROVIDERS.ALIYUN}-dcdn`,
ALIYUN_ESA: `${ACCESS_PROVIDERS.ALIYUN}-esa`,
ALIYUN_LIVE: `${ACCESS_PROVIDERS.ALIYUN}-live`,
ALIYUN_NLB: `${ACCESS_PROVIDERS.ALIYUN}-nlb`,
ALIYUN_OSS: `${ACCESS_PROVIDERS.ALIYUN}-oss`,
@@ -233,6 +234,7 @@ export const deployProvidersMap: Map<DeployProvider["type"] | string, DeployProv
[DEPLOY_PROVIDERS.ALIYUN_OSS, "common.provider.aliyun.oss"],
[DEPLOY_PROVIDERS.ALIYUN_CDN, "common.provider.aliyun.cdn"],
[DEPLOY_PROVIDERS.ALIYUN_DCDN, "common.provider.aliyun.dcdn"],
[DEPLOY_PROVIDERS.ALIYUN_ESA, "common.provider.aliyun.esa"],
[DEPLOY_PROVIDERS.ALIYUN_CLB, "common.provider.aliyun.clb"],
[DEPLOY_PROVIDERS.ALIYUN_ALB, "common.provider.aliyun.alb"],
[DEPLOY_PROVIDERS.ALIYUN_NLB, "common.provider.aliyun.nlb"],

View File

@@ -42,6 +42,7 @@
"common.provider.aliyun.clb": "Alibaba Cloud - CLB (Classic Load Balancer)",
"common.provider.aliyun.dcdn": "Alibaba Cloud - DCDN (Dynamic Route for Content Delivery Network)",
"common.provider.aliyun.dns": "Alibaba Cloud - DNS (Domain Name Service)",
"common.provider.aliyun.esa": "Alibaba Cloud - ESA (Edge Security Acceleration)",
"common.provider.aliyun.live": "Alibaba Cloud - ApsaraVideo Live",
"common.provider.aliyun.nlb": "Alibaba Cloud - NLB (Network Load Balancer)",
"common.provider.aliyun.oss": "Alibaba Cloud - OSS (Object Storage Service)",

View File

@@ -125,6 +125,12 @@
"workflow_node.deploy.form.aliyun_dcdn_domain.label": "Alibaba Cloud DCDN domain",
"workflow_node.deploy.form.aliyun_dcdn_domain.placeholder": "Please enter Alibaba Cloud DCDN domain name",
"workflow_node.deploy.form.aliyun_dcdn_domain.tooltip": "For more information, see <a href=\"https://dcdn.console.aliyun.com\" target=\"_blank\">https://dcdn.console.aliyun.com</a>",
"workflow_node.deploy.form.aliyun_esa_region.label": "Alibaba Cloud region",
"workflow_node.deploy.form.aliyun_esa_region.placeholder": "Please enter Alibaba Cloud region (e.g. cn-hangzhou)",
"workflow_node.deploy.form.aliyun_esa_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint\" target=\"_blank\">https://www.alibabacloud.com/help/en/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint</a>",
"workflow_node.deploy.form.aliyun_esa_site_id.label": "Alibaba Cloud ESA site ID",
"workflow_node.deploy.form.aliyun_esa_site_id.placeholder": "Please enter Alibaba Cloud ESA site ID",
"workflow_node.deploy.form.aliyun_esa_site_id.tooltip": "For more information, see <a href=\"https://esa.console.aliyun.com/siteManage/list\" target=\"_blank\">https://esa.console.aliyun.com/siteManage/list</a>",
"workflow_node.deploy.form.aliyun_live_region.label": "Alibaba Cloud region",
"workflow_node.deploy.form.aliyun_live_region.placeholder": "Please enter Alibaba Cloud region (e.g. cn-hangzhou)",
"workflow_node.deploy.form.aliyun_live_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/live/product-overview/supported-regions\" target=\"_blank\">https://www.alibabacloud.com/help/en/live/product-overview/supported-regions</a>",

View File

@@ -41,6 +41,7 @@
"common.provider.aliyun.cdn": "阿里云 - 内容分发网络 CDN",
"common.provider.aliyun.clb": "阿里云 - 传统型负载均衡 CLB",
"common.provider.aliyun.dcdn": "阿里云 - 全站加速 DCDN",
"common.provider.aliyun.esa": "阿里云 - 边缘安全加速 ESA",
"common.provider.aliyun.dns": "阿里云 - 云解析 DNS",
"common.provider.aliyun.live": "阿里云 - 视频直播 Live",
"common.provider.aliyun.nlb": "阿里云 - 网络型负载均衡 NLB",

View File

@@ -125,6 +125,12 @@
"workflow_node.deploy.form.aliyun_dcdn_domain.label": "阿里云 DCDN 加速域名(支持泛域名)",
"workflow_node.deploy.form.aliyun_dcdn_domain.placeholder": "请输入阿里云 DCDN 加速域名",
"workflow_node.deploy.form.aliyun_dcdn_domain.tooltip": "这是什么?请参阅 <a href=\"https://dcdn.console.aliyun.com\" target=\"_blank\">https://dcdn.console.aliyun.com</a><br><br>泛域名表示形式为:*.example.com",
"workflow_node.deploy.form.aliyun_esa_region.label": "阿里云地域",
"workflow_node.deploy.form.aliyun_esa_region.placeholder": "请输入阿里云地域例如cn-hangzhou",
"workflow_node.deploy.form.aliyun_esa_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint\" target=\"_blank\">https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint</a>",
"workflow_node.deploy.form.aliyun_esa_site_id.label": "阿里云 ESA 站点 ID",
"workflow_node.deploy.form.aliyun_esa_site_id.placeholder": "请输入阿里云 ESA 站点 ID",
"workflow_node.deploy.form.aliyun_esa_site_id.tooltip": "这是什么?请参阅 <a href=\"https://esa.console.aliyun.com/siteManage/list\" target=\"_blank\">https://esa.console.aliyun.com/siteManage/list</a>",
"workflow_node.deploy.form.aliyun_live_region.label": "阿里云地域",
"workflow_node.deploy.form.aliyun_live_region.placeholder": "请输入阿里云地域例如cn-hangzhou",
"workflow_node.deploy.form.aliyun_live_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/live/product-overview/supported-regions\" target=\"_blank\">https://help.aliyun.com/zh/live/product-overview/supported-regions</a>",