mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 14:04:54 +00:00
add support for tencent CLB
新增腾讯云CLB负载均衡配置支持
This commit is contained in:
@@ -12,6 +12,7 @@ import { Context as DeployEditContext } from "./DeployEdit";
|
||||
import DeployToAliyunOSS from "./DeployToAliyunOSS";
|
||||
import DeployToAliyunCDN from "./DeployToAliyunCDN";
|
||||
import DeployToTencentCDN from "./DeployToTencentCDN";
|
||||
import DeployToTencentCLB from "./DeployToTencentCLB";
|
||||
import DeployToTencentCOS from "./DeployToTencentCOS";
|
||||
import DeployToHuaweiCloudCDN from "./DeployToHuaweiCloudCDN";
|
||||
import DeployToQiniuCDN from "./DeployToQiniuCDN";
|
||||
@@ -119,6 +120,9 @@ const DeployEditDialog = ({ trigger, deployConfig, onSave }: DeployEditDialogPro
|
||||
case "tencent-cdn":
|
||||
childComponent = <DeployToTencentCDN />;
|
||||
break;
|
||||
case "tencent-clb":
|
||||
childComponent = <DeployToTencentCLB />;
|
||||
break;
|
||||
case "tencent-cos":
|
||||
childComponent = <DeployToTencentCOS />;
|
||||
break;
|
||||
|
197
ui/src/components/certimate/DeployToTencentCLB.tsx
Normal file
197
ui/src/components/certimate/DeployToTencentCLB.tsx
Normal file
@@ -0,0 +1,197 @@
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { z } from "zod";
|
||||
import { produce } from "immer";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { useDeployEditContext } from "./DeployEdit";
|
||||
|
||||
const DeployToTencentCLB = () => {
|
||||
const { deploy: data, setDeploy, error, setError } = useDeployEditContext();
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
setError({});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const resp = domainSchema.safeParse(data.config?.domain);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
domain: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
domain: "",
|
||||
});
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
const clbIdresp = clbIdSchema.safeParse(data.config?.clbId);
|
||||
if (!clbIdresp.success) {
|
||||
setError({
|
||||
...error,
|
||||
clbId: JSON.parse(clbIdresp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
clbId: "",
|
||||
});
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
const lsnIdresp = lsnIdSchema.safeParse(data.config?.lsnId);
|
||||
if (!lsnIdresp.success) {
|
||||
setError({
|
||||
...error,
|
||||
lsnId: JSON.parse(lsnIdresp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
lsnId: "",
|
||||
});
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!data.id) {
|
||||
setDeploy({
|
||||
...data,
|
||||
config: {
|
||||
lsnId: "",
|
||||
clbId: "",
|
||||
domain: "",
|
||||
},
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
const domainSchema = z.string().regex(/^$|^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, {
|
||||
message: t("common.errmsg.domain_invalid"),
|
||||
});
|
||||
|
||||
const clbIdSchema = z.string().regex(/^lb-[a-zA-Z0-9]{8}$/, {
|
||||
message: t("domain.deployment.form.clb_id.placeholder"),
|
||||
});
|
||||
|
||||
const lsnIdSchema = z.string().regex(/^lbl-.{8}$/, {
|
||||
message: t("domain.deployment.form.clb_listener.placeholder"),
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex flex-col space-y-8">
|
||||
<div>
|
||||
<Label>{t("domain.deployment.form.clb_id.label")}</Label>
|
||||
<Input
|
||||
placeholder={t("domain.deployment.form.clb_id.placeholder")}
|
||||
className="w-full mt-1"
|
||||
value={data?.config?.clbId}
|
||||
onChange={(e) => {
|
||||
const temp = e.target.value;
|
||||
|
||||
const resp = clbIdSchema.safeParse(temp);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
clbId: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
clbId: "",
|
||||
});
|
||||
}
|
||||
|
||||
const newData = produce(data, (draft) => {
|
||||
if (!draft.config) {
|
||||
draft.config = {};
|
||||
}
|
||||
draft.config.clbId = temp;
|
||||
});
|
||||
setDeploy(newData);
|
||||
}}
|
||||
/>
|
||||
<div className="text-red-600 text-sm mt-1">{error?.clbId}</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>{t("domain.deployment.form.clb_listener.label")}</Label>
|
||||
<Input
|
||||
placeholder={t("domain.deployment.form.clb_listener.placeholder")}
|
||||
className="w-full mt-1"
|
||||
value={data?.config?.lsnId}
|
||||
onChange={(e) => {
|
||||
const temp = e.target.value;
|
||||
|
||||
const resp = lsnIdSchema.safeParse(temp);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
lsnId: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
lsnId: "",
|
||||
});
|
||||
}
|
||||
|
||||
const newData = produce(data, (draft) => {
|
||||
if (!draft.config) {
|
||||
draft.config = {};
|
||||
}
|
||||
draft.config.lsnId = temp;
|
||||
});
|
||||
setDeploy(newData);
|
||||
}}
|
||||
/>
|
||||
<div className="text-red-600 text-sm mt-1">{error?.lsnId}</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>{t("domain.deployment.form.clb_domain.label")}</Label>
|
||||
<Input
|
||||
placeholder={t("domain.deployment.form.clb_domain.placeholder")}
|
||||
className="w-full mt-1"
|
||||
value={data?.config?.domain}
|
||||
onChange={(e) => {
|
||||
const temp = e.target.value;
|
||||
|
||||
const resp = domainSchema.safeParse(temp);
|
||||
if (!resp.success) {
|
||||
setError({
|
||||
...error,
|
||||
domain: JSON.parse(resp.error.message)[0].message,
|
||||
});
|
||||
} else {
|
||||
setError({
|
||||
...error,
|
||||
domain: "",
|
||||
});
|
||||
}
|
||||
|
||||
const newData = produce(data, (draft) => {
|
||||
if (!draft.config) {
|
||||
draft.config = {};
|
||||
}
|
||||
draft.config.domain = temp;
|
||||
});
|
||||
setDeploy(newData);
|
||||
}}
|
||||
/>
|
||||
<div className="text-red-600 text-sm mt-1">{error?.domain}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DeployToTencentCLB;
|
@@ -75,6 +75,7 @@ export const deployTargetsMap: Map<DeployTarget["type"], DeployTarget> = new Map
|
||||
["aliyun-cdn", "common.provider.aliyun.cdn", "/imgs/providers/aliyun.svg"],
|
||||
["aliyun-dcdn", "common.provider.aliyun.dcdn", "/imgs/providers/aliyun.svg"],
|
||||
["tencent-cdn", "common.provider.tencent.cdn", "/imgs/providers/tencent.svg"],
|
||||
["tencent-clb", "common.provider.tencent.clb", "/imgs/providers/tencent.svg"],
|
||||
["tencent-cos", "common.provider.tencent.cos", "/imgs/providers/tencent.svg"],
|
||||
["huaweicloud-cdn", "common.provider.huaweicloud.cdn", "/imgs/providers/huaweicloud.svg"],
|
||||
["qiniu-cdn", "common.provider.qiniu.cdn", "/imgs/providers/qiniu.svg"],
|
||||
|
@@ -58,6 +58,7 @@
|
||||
"common.provider.aliyun.dcdn": "Alibaba Cloud - DCDN",
|
||||
"common.provider.tencent": "Tencent",
|
||||
"common.provider.tencent.cdn": "Tencent - CDN",
|
||||
"common.provider.tencent.clb": "Tencent - CLB",
|
||||
"common.provider.tencent.cos": "Tencent - COS",
|
||||
"common.provider.huaweicloud": "Huawei Cloud",
|
||||
"common.provider.huaweicloud.cdn": "Huawei Cloud - CDN",
|
||||
|
@@ -58,6 +58,12 @@
|
||||
"domain.deployment.form.cos_region.placeholder": "Please enter region, e.g. ap-guangzhou",
|
||||
"domain.deployment.form.cos_bucket.label": "Bucket",
|
||||
"domain.deployment.form.cos_bucket.placeholder": "Please enter bucket, e.g. example-1250000000",
|
||||
"domain.deployment.form.clb_id.label": "CLB id",
|
||||
"domain.deployment.form.clb_id.placeholder": "Please enter CLB id, e.g. lb-xxxxxxxx",
|
||||
"domain.deployment.form.clb_listener.label": "Listener id",
|
||||
"domain.deployment.form.clb_listener.placeholder": "Please enter listener id, e.g. lbl-xxxxxxxx",
|
||||
"domain.deployment.form.clb_domain.label": "Deploy to domain (Wildcard domain is also supported)",
|
||||
"domain.deployment.form.clb_domain.placeholder": "Please enter domain to be deployed. If SNI is not enabled, you can leave it blank.",
|
||||
"domain.deployment.form.domain.label": "Deploy to domain (Single domain only, not wildcard domain)",
|
||||
"domain.deployment.form.domain.label.wildsupported": "Deploy to domain (Wildcard domain is also supported)",
|
||||
"domain.deployment.form.domain.placeholder": "Please enter domain to be deployed",
|
||||
|
@@ -54,6 +54,7 @@
|
||||
|
||||
"common.provider.tencent": "腾讯云",
|
||||
"common.provider.tencent.cdn": "腾讯云 - CDN",
|
||||
"common.provider.tencent.clb": "腾讯云 - CLB",
|
||||
"common.provider.tencent.cos": "腾讯云 - COS",
|
||||
"common.provider.aliyun": "阿里云",
|
||||
"common.provider.aliyun.oss": "阿里云 - OSS",
|
||||
|
@@ -58,6 +58,12 @@
|
||||
"domain.deployment.form.cos_region.placeholder": "请输入 region, 如 ap-guangzhou",
|
||||
"domain.deployment.form.cos_bucket.label": "存储桶",
|
||||
"domain.deployment.form.cos_bucket.placeholder": "请输入存储桶名, 如 example-1250000000",
|
||||
"domain.deployment.form.clb_id.label": "CLB id",
|
||||
"domain.deployment.form.clb_id.placeholder": "请输入CLB实例id, 如 lb-xxxxxxxx",
|
||||
"domain.deployment.form.clb_listener.label": "监听器 id",
|
||||
"domain.deployment.form.clb_listener.placeholder": "请输入监听器id, 如 lbl-xxxxxxxx",
|
||||
"domain.deployment.form.clb_domain.label": "部署到域名(支持泛域名)",
|
||||
"domain.deployment.form.clb_domain.placeholder": "请输入部署到的域名, 如未开启SNI, 可置空忽略此项",
|
||||
"domain.deployment.form.domain.label": "部署到域名(仅支持单个域名;不支持泛域名)",
|
||||
"domain.deployment.form.domain.label.wildsupported": "部署到域名(支持泛域名)",
|
||||
"domain.deployment.form.domain.placeholder": "请输入部署到的域名",
|
||||
|
Reference in New Issue
Block a user