feat: add tencentcloud scf deployer

This commit is contained in:
Fu Diwei
2025-03-08 14:58:40 +08:00
parent 563a32ed62
commit c7ad61e319
19 changed files with 317 additions and 22 deletions

View File

@@ -64,6 +64,7 @@ const DeployProviderPicker = ({ className, style, autoFocus, placeholder, onSele
DEPLOY_CATEGORIES.LOADBALANCE,
DEPLOY_CATEGORIES.FIREWALL,
DEPLOY_CATEGORIES.AV,
DEPLOY_CATEGORIES.SERVERLESS,
DEPLOY_CATEGORIES.WEBSITE,
DEPLOY_CATEGORIES.OTHER,
].map((key) => ({

View File

@@ -58,6 +58,7 @@ import DeployNodeConfigFormTencentCloudCOSConfig from "./DeployNodeConfigFormTen
import DeployNodeConfigFormTencentCloudCSSConfig from "./DeployNodeConfigFormTencentCloudCSSConfig.tsx";
import DeployNodeConfigFormTencentCloudECDNConfig from "./DeployNodeConfigFormTencentCloudECDNConfig.tsx";
import DeployNodeConfigFormTencentCloudEOConfig from "./DeployNodeConfigFormTencentCloudEOConfig.tsx";
import DeployNodeConfigFormTencentCloudSCFConfig from "./DeployNodeConfigFormTencentCloudSCFConfig";
import DeployNodeConfigFormTencentCloudSSLDeployConfig from "./DeployNodeConfigFormTencentCloudSSLDeployConfig";
import DeployNodeConfigFormTencentCloudVODConfig from "./DeployNodeConfigFormTencentCloudVODConfig";
import DeployNodeConfigFormTencentCloudWAFConfig from "./DeployNodeConfigFormTencentCloudWAFConfig";
@@ -227,6 +228,8 @@ const DeployNodeConfigForm = forwardRef<DeployNodeConfigFormInstance, DeployNode
return <DeployNodeConfigFormTencentCloudECDNConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.TENCENTCLOUD_EO:
return <DeployNodeConfigFormTencentCloudEOConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.TENCENTCLOUD_SCF:
return <DeployNodeConfigFormTencentCloudSCFConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.TENCENTCLOUD_SSL_DEPLOY:
return <DeployNodeConfigFormTencentCloudSSLDeployConfig {...nestedFormProps} />;
case DEPLOY_PROVIDERS.TENCENTCLOUD_VOD:

View File

@@ -0,0 +1,79 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { validDomainName } from "@/utils/validators";
type DeployNodeConfigFormTencentCloudSCFConfigFieldValues = Nullish<{
region: string;
domain: string;
}>;
export type DeployNodeConfigFormTencentCloudSCFConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: DeployNodeConfigFormTencentCloudSCFConfigFieldValues;
onValuesChange?: (values: DeployNodeConfigFormTencentCloudSCFConfigFieldValues) => void;
};
const initFormModel = (): DeployNodeConfigFormTencentCloudSCFConfigFieldValues => {
return {};
};
const DeployNodeConfigFormTencentCloudSCFConfig = ({
form: formInst,
formName,
disabled,
initialValues,
onValuesChange,
}: DeployNodeConfigFormTencentCloudSCFConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.tencentcloud_scf_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.tencentcloud_scf_region.placeholder"))
.trim(),
domain: z
.string({ message: t("workflow_node.deploy.form.tencentcloud_scf_domain.placeholder") })
.refine((v) => validDomainName(v), t("common.errmsg.domain_invalid")),
});
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.tencentcloud_scf_region.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.tencentcloud_scf_region.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.tencentcloud_scf_region.placeholder")} />
</Form.Item>
<Form.Item
name="domain"
label={t("workflow_node.deploy.form.tencentcloud_scf_domain.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.tencentcloud_scf_domain.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.tencentcloud_scf_domain.placeholder")} />
</Form.Item>
</Form>
);
};
export default DeployNodeConfigFormTencentCloudSCFConfig;

View File

@@ -281,6 +281,7 @@ export const DEPLOY_CATEGORIES = Object.freeze({
LOADBALANCE: "loadbalance",
FIREWALL: "firewall",
AV: "av",
SERVERLESS: "serverless",
WEBSITE: "website",
OTHER: "other",
} as const);
@@ -315,7 +316,7 @@ export const deployProvidersMap: Map<DeployProvider["type"] | string, DeployProv
[DEPLOY_PROVIDERS.ALIYUN_WAF, "provider.aliyun.waf", DEPLOY_CATEGORIES.FIREWALL],
[DEPLOY_PROVIDERS.ALIYUN_LIVE, "provider.aliyun.live", DEPLOY_CATEGORIES.AV],
[DEPLOY_PROVIDERS.ALIYUN_VOD, "provider.aliyun.vod", DEPLOY_CATEGORIES.AV],
[DEPLOY_PROVIDERS.ALIYUN_FC, "provider.aliyun.fc", DEPLOY_CATEGORIES.OTHER],
[DEPLOY_PROVIDERS.ALIYUN_FC, "provider.aliyun.fc", DEPLOY_CATEGORIES.SERVERLESS],
[DEPLOY_PROVIDERS.ALIYUN_CAS_DEPLOY, "provider.aliyun.cas_deploy", DEPLOY_CATEGORIES.OTHER],
[DEPLOY_PROVIDERS.TENCENTCLOUD_COS, "provider.tencentcloud.cos", DEPLOY_CATEGORIES.STORAGE],
[DEPLOY_PROVIDERS.TENCENTCLOUD_CDN, "provider.tencentcloud.cdn", DEPLOY_CATEGORIES.CDN],
@@ -325,7 +326,7 @@ export const deployProvidersMap: Map<DeployProvider["type"] | string, DeployProv
[DEPLOY_PROVIDERS.TENCENTCLOUD_WAF, "provider.tencentcloud.waf", DEPLOY_CATEGORIES.FIREWALL],
[DEPLOY_PROVIDERS.TENCENTCLOUD_CSS, "provider.tencentcloud.css", DEPLOY_CATEGORIES.AV],
[DEPLOY_PROVIDERS.TENCENTCLOUD_VOD, "provider.tencentcloud.vod", DEPLOY_CATEGORIES.AV],
// TODO: [DEPLOY_PROVIDERS.TENCENTCLOUD_SCF, "provider.tencentcloud.scf", DEPLOY_CATEGORIES.OTHER],
[DEPLOY_PROVIDERS.TENCENTCLOUD_SCF, "provider.tencentcloud.scf", DEPLOY_CATEGORIES.SERVERLESS],
[DEPLOY_PROVIDERS.TENCENTCLOUD_SSL_DEPLOY, "provider.tencentcloud.ssl_deploy", DEPLOY_CATEGORIES.OTHER],
[DEPLOY_PROVIDERS.HUAWEICLOUD_CDN, "provider.huaweicloud.cdn", DEPLOY_CATEGORIES.CDN],
[DEPLOY_PROVIDERS.HUAWEICLOUD_ELB, "provider.huaweicloud.elb", DEPLOY_CATEGORIES.LOADBALANCE],

View File

@@ -110,6 +110,7 @@
"provider.category.loadbalance": "Loadbalance",
"provider.category.firewall": "Firewall",
"provider.category.av": "Audio/Video",
"provider.category.serverless": "Serverless",
"provider.category.website": "Website",
"provider.category.other": "Other"
}

View File

@@ -453,6 +453,12 @@
"workflow_node.deploy.form.tencentcloud_eo_domain.label": "Tencent Cloud EdgeOne domain",
"workflow_node.deploy.form.tencentcloud_eo_domain.placeholder": "Please enter Tencent Cloud EdgeOne domain name",
"workflow_node.deploy.form.tencentcloud_eo_domain.tooltip": "For more information, see <a href=\"https://console.tencentcloud.com/edgeone\" target=\"_blank\">https://console.tencentcloud.com/edgeone</a>",
"workflow_node.deploy.form.tencentcloud_scf_region.label": "Tencent Cloud SCF region",
"workflow_node.deploy.form.tencentcloud_scf_region.placeholder": "Please enter Tencent Cloud SCF region (e.g. ap-guangzhou)",
"workflow_node.deploy.form.tencentcloud_scf_region.tooltip": "For more information, see <a href=\"https://www.tencentcloud.com/document/product/583/17299\" target=\"_blank\">https://www.tencentcloud.com/document/product/583/17299</a>",
"workflow_node.deploy.form.tencentcloud_scf_domain.label": "Tencent Cloud SCF domain",
"workflow_node.deploy.form.tencentcloud_scf_domain.placeholder": "Please enter Tencent Cloud SCF domain name",
"workflow_node.deploy.form.tencentcloud_scf_domain.tooltip": "For more information, see <a href=\"https://console.tencentcloud.com/scf\" target=\"_blank\">https://console.tencentcloud.com/scf</a>",
"workflow_node.deploy.form.tencentcloud_ssl_deploy.guide": "TIPS: You need to go to the Tencent Cloud console to check the actual deployment results by yourself, because Tencent Cloud deployment tasks are running asynchronously.",
"workflow_node.deploy.form.tencentcloud_ssl_deploy_region.label": "Tencent Cloud service region",
"workflow_node.deploy.form.tencentcloud_ssl_deploy_region.placeholder": "Please enter Tencent Cloud service region (e.g. ap-guangzhou)",

View File

@@ -110,6 +110,7 @@
"provider.category.loadbalance": "负载均衡",
"provider.category.firewall": "防火墙",
"provider.category.av": "音视频",
"provider.category.website": "网站",
"provider.category.serverless": "Serverless",
"provider.category.website": "网站托管",
"provider.category.other": "其他"
}

View File

@@ -453,6 +453,12 @@
"workflow_node.deploy.form.tencentcloud_eo_domain.label": "腾讯云 EdgeOne 加速域名",
"workflow_node.deploy.form.tencentcloud_eo_domain.placeholder": "请输入腾讯云 EdgeOne 加速域名",
"workflow_node.deploy.form.tencentcloud_eo_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/edgeone\" target=\"_blank\">https://console.cloud.tencent.com/edgeone</a>",
"workflow_node.deploy.form.tencentcloud_scf_region.label": "腾讯云 SCF 产品地域",
"workflow_node.deploy.form.tencentcloud_scf_region.placeholder": "输入腾讯云 SCF 产品地域例如ap-guangzhou",
"workflow_node.deploy.form.tencentcloud_scf_region.tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/583/17299\" target=\"_blank\">https://cloud.tencent.com/document/product/583/17299</a>",
"workflow_node.deploy.form.tencentcloud_scf_domain.label": "腾讯云 SCF 自定义域名",
"workflow_node.deploy.form.tencentcloud_scf_domain.placeholder": "输入腾讯云 SCF 自定义域名",
"workflow_node.deploy.form.tencentcloud_scf_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.tencentcloud.com/scf\" target=\"_blank\">https://console.tencentcloud.com/scf</a>",
"workflow_node.deploy.form.tencentcloud_ssl_deploy.guide": "小贴士:由于腾讯云证书部署任务是异步的,此节点若执行成功仅代表已创建部署任务,实际部署结果需要你自行前往腾讯云控制台查询。",
"workflow_node.deploy.form.tencentcloud_ssl_deploy_region.label": "腾讯云云产品地域",
"workflow_node.deploy.form.tencentcloud_ssl_deploy_region.placeholder": "请输入腾讯云云产品地域例如ap-guangzhou",