feat: new deployment providers: ratpanel console & site

This commit is contained in:
Fu Diwei
2025-05-16 20:15:59 +08:00
parent e9f248d8ec
commit 980d1ee0b9
21 changed files with 267 additions and 51 deletions

View File

@@ -63,6 +63,7 @@ import DeployNodeConfigFormQiniuCDNConfig from "./DeployNodeConfigFormQiniuCDNCo
import DeployNodeConfigFormQiniuKodoConfig from "./DeployNodeConfigFormQiniuKodoConfig";
import DeployNodeConfigFormQiniuPiliConfig from "./DeployNodeConfigFormQiniuPiliConfig";
import DeployNodeConfigFormRainYunRCDNConfig from "./DeployNodeConfigFormRainYunRCDNConfig";
import DeployNodeConfigFormRatPanelSiteConfig from "./DeployNodeConfigFormRatPanelSiteConfig";
import DeployNodeConfigFormSafeLineConfig from "./DeployNodeConfigFormSafeLineConfig";
import DeployNodeConfigFormSSHConfig from "./DeployNodeConfigFormSSHConfig.tsx";
import DeployNodeConfigFormTencentCloudCDNConfig from "./DeployNodeConfigFormTencentCloudCDNConfig.tsx";
@@ -273,6 +274,8 @@ const DeployNodeConfigForm = forwardRef<DeployNodeConfigFormInstance, DeployNode
return <DeployNodeConfigFormQiniuPiliConfig {...nestedFormProps} />;
case DEPLOYMENT_PROVIDERS.RAINYUN_RCDN:
return <DeployNodeConfigFormRainYunRCDNConfig {...nestedFormProps} />;
case DEPLOYMENT_PROVIDERS.RATPANEL_SITE:
return <DeployNodeConfigFormRatPanelSiteConfig {...nestedFormProps} />;
case DEPLOYMENT_PROVIDERS.SAFELINE:
return <DeployNodeConfigFormSafeLineConfig {...nestedFormProps} />;
case DEPLOYMENT_PROVIDERS.SSH:

View File

@@ -0,0 +1,63 @@
import { useTranslation } from "react-i18next";
import { Form, type FormInstance, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
type DeployNodeConfigFormRatPanelSiteConfigFieldValues = Nullish<{
siteName: string;
}>;
export type DeployNodeConfigFormRatPanelSiteConfigProps = {
form: FormInstance;
formName: string;
disabled?: boolean;
initialValues?: DeployNodeConfigFormRatPanelSiteConfigFieldValues;
onValuesChange?: (values: DeployNodeConfigFormRatPanelSiteConfigFieldValues) => void;
};
const initFormModel = (): DeployNodeConfigFormRatPanelSiteConfigFieldValues => {
return {
siteName: "",
};
};
const DeployNodeConfigFormRatPanelSiteConfig = ({
form: formInst,
formName,
disabled,
initialValues,
onValuesChange,
}: DeployNodeConfigFormRatPanelSiteConfigProps) => {
const { t } = useTranslation();
const formSchema = z.object({
siteName: z.string().nonempty(t("workflow_node.deploy.form.ratpanel_site_name.placeholder")),
});
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="siteName"
label={t("workflow_node.deploy.form.ratpanel_site_name.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ratpanel_site_name.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.ratpanel_site_name.placeholder")} />
</Form.Item>
</Form>
);
};
export default DeployNodeConfigFormRatPanelSiteConfig;

View File

@@ -68,7 +68,12 @@ const DeployNodeConfigFormSafeLineConfig = ({ form: formInst, formName, disabled
</Form.Item>
<Show when={fieldResourceType === RESOURCE_TYPE_CERTIFICATE}>
<Form.Item name="certificateId" label={t("workflow_node.deploy.form.safeline_certificate_id.label")} rules={[formRule]}>
<Form.Item
name="certificateId"
label={t("workflow_node.deploy.form.safeline_certificate_id.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.safeline_certificate_id.tooltip") }}></span>}
>
<Input type="number" placeholder={t("workflow_node.deploy.form.safeline_certificate_id.placeholder")} />
</Form.Item>
</Show>