mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-07 21:19:51 +00:00
chore(deps): upgrade npm dependencies
This commit is contained in:
parent
984aae1ca6
commit
cda54085b9
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -11,6 +11,7 @@
|
||||
"gopls": {
|
||||
"formatting.gofumpt": true,
|
||||
},
|
||||
"typescript.tsdk": "ui/node_modules/typescript/lib",
|
||||
"[go]": {
|
||||
"editor.defaultFormatter": "golang.go"
|
||||
},
|
||||
|
1371
ui/package-lock.json
generated
1371
ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -20,51 +20,51 @@
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@tanstack/react-table": "^8.20.5",
|
||||
"ahooks": "^3.8.4",
|
||||
"antd": "^5.22.2",
|
||||
"antd": "^5.22.5",
|
||||
"antd-zod": "^6.0.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.1.1",
|
||||
"cron-parser": "^4.9.0",
|
||||
"i18next": "^23.15.1",
|
||||
"i18next-browser-languagedetector": "^8.0.0",
|
||||
"i18next-http-backend": "^2.6.1",
|
||||
"i18next": "^24.2.0",
|
||||
"i18next-browser-languagedetector": "^8.0.2",
|
||||
"i18next-http-backend": "^3.0.1",
|
||||
"immer": "^10.1.1",
|
||||
"jszip": "^3.10.1",
|
||||
"lucide-react": "^0.417.0",
|
||||
"nanoid": "^5.0.7",
|
||||
"lucide-react": "^0.469.0",
|
||||
"nanoid": "^5.0.9",
|
||||
"pocketbase": "^0.21.4",
|
||||
"react": "^18.3.1",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-hook-form": "^7.52.1",
|
||||
"react-i18next": "^15.0.2",
|
||||
"react-router-dom": "^6.25.1",
|
||||
"tailwind-merge": "^2.4.0",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"zod": "^3.23.8",
|
||||
"zustand": "^5.0.1"
|
||||
"react-i18next": "^15.2.0",
|
||||
"react-router-dom": "^7.1.0",
|
||||
"tailwind-merge": "^2.5.5",
|
||||
"zod": "^3.24.1",
|
||||
"zustand": "^5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-copy-to-clipboard": "^5.0.7",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
||||
"@typescript-eslint/parser": "^7.15.0",
|
||||
"@vitejs/plugin-legacy": "^5.4.3",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
||||
"@typescript-eslint/parser": "^8.18.1",
|
||||
"@vitejs/plugin-legacy": "^6.0.0",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-react-hooks": "^4.6.2",
|
||||
"eslint-plugin-react-refresh": "^0.4.7",
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.16",
|
||||
"fs-extra": "^11.2.0",
|
||||
"postcss": "^8.4.40",
|
||||
"prettier": "^3.3.3",
|
||||
"tailwindcss": "^3.4.7",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.3.4"
|
||||
"postcss": "^8.4.49",
|
||||
"prettier": "^3.4.2",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.5"
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ export type AccessEditFormProps = {
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
mode: AccessEditFormModes;
|
||||
model?: AccessEditFormModelType;
|
||||
onModelChange?: (model: AccessEditFormModelType) => void;
|
||||
@ -45,7 +44,7 @@ export type AccessEditFormInstance = {
|
||||
validateFields: () => Promise<AccessEditFormModelType>;
|
||||
};
|
||||
|
||||
const AccessEditForm = forwardRef<AccessEditFormInstance, AccessEditFormProps>(({ className, style, disabled, loading, mode, model, onModelChange }, ref) => {
|
||||
const AccessEditForm = forwardRef<AccessEditFormInstance, AccessEditFormProps>(({ className, style, disabled, mode, model, onModelChange }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -77,7 +76,7 @@ const AccessEditForm = forwardRef<AccessEditFormInstance, AccessEditFormProps>((
|
||||
注意:如果追加新的子组件,请保持以 ASCII 排序。
|
||||
NOTICE: If you add new child component, please keep ASCII order.
|
||||
*/
|
||||
const configFormProps = { form: configFormInst, formName: configFormName, disabled: disabled, loading: loading, model: model?.config };
|
||||
const configFormProps = { form: configFormInst, formName: configFormName, disabled: disabled, model: model?.config };
|
||||
switch (configType) {
|
||||
case ACCESS_PROVIDER_TYPES.ACMEHTTPREQ:
|
||||
return <AccessEditFormACMEHttpReqConfig {...configFormProps} />;
|
||||
@ -150,7 +149,7 @@ const AccessEditForm = forwardRef<AccessEditFormInstance, AccessEditFormProps>((
|
||||
return (
|
||||
<Form.Provider onFormChange={handleFormProviderChange}>
|
||||
<div className={className} style={style}>
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" onValuesChange={handleFormChange}>
|
||||
<Form.Item name="name" label={t("access.form.name.label")} rules={[formRule]}>
|
||||
<Input placeholder={t("access.form.name.placeholder")} />
|
||||
</Form.Item>
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormACMEHttpReqConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormACMEHttpReqConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormACMEHttpReqConfigModelType) => void;
|
||||
};
|
||||
@ -22,12 +21,10 @@ const initModel = () => {
|
||||
return {
|
||||
endpoint: "https://example.com/api/",
|
||||
mode: "",
|
||||
username: "",
|
||||
password: "",
|
||||
} as AccessEditFormACMEHttpReqConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormACMEHttpReqConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormACMEHttpReqConfigProps) => {
|
||||
const AccessEditFormACMEHttpReqConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormACMEHttpReqConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -58,7 +55,7 @@ const AccessEditFormACMEHttpReqConfig = ({ form, formName, disabled, loading, mo
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="endpoint"
|
||||
label={t("access.form.acmehttpreq_endpoint.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormAWSConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormAWSConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormAWSConfigModelType) => void;
|
||||
};
|
||||
@ -27,7 +26,7 @@ const initModel = () => {
|
||||
} as AccessEditFormAWSConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormAWSConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormAWSConfigProps) => {
|
||||
const AccessEditFormAWSConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormAWSConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -68,7 +67,7 @@ const AccessEditFormAWSConfig = ({ form, formName, disabled, loading, model, onM
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKeyId"
|
||||
label={t("access.form.aws_access_key_id.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormAliyunConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormAliyunConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormAliyunConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormAliyunConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormAliyunConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormAliyunConfigProps) => {
|
||||
const AccessEditFormAliyunConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormAliyunConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormAliyunConfig = ({ form, formName, disabled, loading, model,
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKeyId"
|
||||
label={t("access.form.aliyun_access_key_id.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormBaiduCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormBaiduCloudConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormBaiduCloudConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormBaiduCloudConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormBaiduCloudConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormBaiduCloudConfigProps) => {
|
||||
const AccessEditFormBaiduCloudConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormBaiduCloudConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormBaiduCloudConfig = ({ form, formName, disabled, loading, mod
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKeyId"
|
||||
label={t("access.form.baiducloud_access_key_id.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormBytePlusConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormBytePlusConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormBytePlusConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormBytePlusConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormBytePlusConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormBytePlusConfigProps) => {
|
||||
const AccessEditFormBytePlusConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormBytePlusConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormBytePlusConfig = ({ form, formName, disabled, loading, model
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKey"
|
||||
label={t("access.form.byteplus_access_key.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormCloudflareConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormCloudflareConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormCloudflareConfigModelType) => void;
|
||||
};
|
||||
@ -24,7 +23,7 @@ const initModel = () => {
|
||||
} as AccessEditFormCloudflareConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormCloudflareConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormCloudflareConfigProps) => {
|
||||
const AccessEditFormCloudflareConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormCloudflareConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -46,7 +45,7 @@ const AccessEditFormCloudflareConfig = ({ form, formName, disabled, loading, mod
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="dnsApiToken"
|
||||
label={t("access.form.cloudflare_dns_api_token.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormDogeCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormDogeCloudConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormDogeCloudConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormDogeCloudConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormDogeCloudConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormDogeCloudConfigProps) => {
|
||||
const AccessEditFormDogeCloudConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormDogeCloudConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormDogeCloudConfig = ({ form, formName, disabled, loading, mode
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKey"
|
||||
label={t("access.form.dogecloud_access_key.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormGoDaddyConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormGoDaddyConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormGoDaddyConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormGoDaddyConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormGoDaddyConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormGoDaddyConfigProps) => {
|
||||
const AccessEditFormGoDaddyConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormGoDaddyConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormGoDaddyConfig = ({ form, formName, disabled, loading, model,
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="apiKey"
|
||||
label={t("access.form.godaddy_api_key.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormHuaweiCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormHuaweiCloudConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormHuaweiCloudConfigModelType) => void;
|
||||
};
|
||||
@ -26,7 +25,7 @@ const initModel = () => {
|
||||
} as AccessEditFormHuaweiCloudConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormHuaweiCloudConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormHuaweiCloudConfigProps) => {
|
||||
const AccessEditFormHuaweiCloudConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormHuaweiCloudConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -60,7 +59,7 @@ const AccessEditFormHuaweiCloudConfig = ({ form, formName, disabled, loading, mo
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKeyId"
|
||||
label={t("access.form.huaweicloud_access_key_id.label")}
|
||||
|
@ -16,7 +16,6 @@ export type AccessEditFormKubernetesConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormKubernetesConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormKubernetesConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
return {} as AccessEditFormKubernetesConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormKubernetesConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormKubernetesConfigProps) => {
|
||||
const AccessEditFormKubernetesConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormKubernetesConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -37,6 +36,7 @@ const AccessEditFormKubernetesConfig = ({ form, formName, disabled, loading, mod
|
||||
.nullish(),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
const formInst = form as FormInstance<z.infer<typeof formSchema>>;
|
||||
|
||||
const [initialValues, setInitialValues] = useState<Partial<z.infer<typeof formSchema>>>(model ?? initModel());
|
||||
useDeepCompareEffect(() => {
|
||||
@ -52,20 +52,25 @@ const AccessEditFormKubernetesConfig = ({ form, formName, disabled, loading, mod
|
||||
|
||||
const handleUploadChange: UploadProps["onChange"] = async ({ file }) => {
|
||||
if (file && file.status !== "removed") {
|
||||
form.setFieldValue("kubeConfig", (await readFileContent(file.originFileObj ?? (file as unknown as File))).trim());
|
||||
formInst.setFieldValue("kubeConfig", (await readFileContent(file.originFileObj ?? (file as unknown as File))).trim());
|
||||
setKubeFileList([file]);
|
||||
} else {
|
||||
form.setFieldValue("kubeConfig", "");
|
||||
formInst.setFieldValue("kubeConfig", "");
|
||||
setKubeFileList([]);
|
||||
}
|
||||
|
||||
flushSync(() => onModelChange?.(form.getFieldsValue(true)));
|
||||
flushSync(() => onModelChange?.(formInst.getFieldsValue(true)));
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item name="kubeConfig" noStyle rules={[formRule]}>
|
||||
<Input.TextArea autoComplete="new-password" hidden placeholder={t("access.form.k8s_kubeconfig.placeholder")} value={form.getFieldValue("kubeConfig")} />
|
||||
<Input.TextArea
|
||||
autoComplete="new-password"
|
||||
hidden
|
||||
placeholder={t("access.form.k8s_kubeconfig.placeholder")}
|
||||
value={formInst.getFieldValue("kubeConfig")}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("access.form.k8s_kubeconfig.label")}
|
||||
|
@ -10,7 +10,6 @@ export type AccessEditFormLocalConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormLocalConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormLocalConfigModelType) => void;
|
||||
};
|
||||
@ -19,13 +18,13 @@ const initModel = () => {
|
||||
return {} as AccessEditFormLocalConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormLocalConfig = ({ form, formName, disabled, loading, model }: AccessEditFormLocalConfigProps) => {
|
||||
const AccessEditFormLocalConfig = ({ form, formName, disabled, model }: AccessEditFormLocalConfigProps) => {
|
||||
const [initialValues, setInitialValues] = useState(model ?? initModel());
|
||||
useDeepCompareEffect(() => {
|
||||
setInitialValues(model ?? initModel());
|
||||
}, [model]);
|
||||
|
||||
return <Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName}></Form>;
|
||||
return <Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName}></Form>;
|
||||
};
|
||||
|
||||
export default AccessEditFormLocalConfig;
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormNameSiloConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormNameSiloConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormNameSiloConfigModelType) => void;
|
||||
};
|
||||
@ -24,7 +23,7 @@ const initModel = () => {
|
||||
} as AccessEditFormNameSiloConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormNameSiloConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormNameSiloConfigProps) => {
|
||||
const AccessEditFormNameSiloConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormNameSiloConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -46,7 +45,7 @@ const AccessEditFormNameSiloConfig = ({ form, formName, disabled, loading, model
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="apiKey"
|
||||
label={t("access.form.namesilo_api_key.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormPowerDNSConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormPowerDNSConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormPowerDNSConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormPowerDNSConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormPowerDNSConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormPowerDNSConfigProps) => {
|
||||
const AccessEditFormPowerDNSConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormPowerDNSConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -48,7 +47,7 @@ const AccessEditFormPowerDNSConfig = ({ form, formName, disabled, loading, model
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="apiUrl"
|
||||
label={t("access.form.powerdns_api_url.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormQiniuConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormQiniuConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormQiniuConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormQiniuConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormQiniuConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormQiniuConfigProps) => {
|
||||
const AccessEditFormQiniuConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormQiniuConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormQiniuConfig = ({ form, formName, disabled, loading, model, o
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKey"
|
||||
label={t("access.form.qiniu_access_key.label")}
|
||||
|
@ -16,7 +16,6 @@ export type AccessEditFormSSHConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormSSHConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormSSHConfigModelType) => void;
|
||||
};
|
||||
@ -29,7 +28,7 @@ const initModel = () => {
|
||||
} as AccessEditFormSSHConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormSSHConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormSSHConfigProps) => {
|
||||
const AccessEditFormSSHConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormSSHConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -69,9 +68,10 @@ const AccessEditFormSSHConfig = ({ form, formName, disabled, loading, model, onM
|
||||
.min(0, "access.form.ssh_key_passphrase.placeholder")
|
||||
.max(20480, t("common.errmsg.string_max", { max: 20480 }))
|
||||
.nullish()
|
||||
.refine((v) => !v || form.getFieldValue("key"), { message: t("access.form.ssh_key.placeholder") }),
|
||||
.and(z.string().refine((v) => !v || form.getFieldValue("key"), { message: t("access.form.ssh_key.placeholder") })),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
const formInst = form as FormInstance<z.infer<typeof formSchema>>;
|
||||
|
||||
const [initialValues, setInitialValues] = useState<Partial<z.infer<typeof formSchema>>>(model ?? initModel());
|
||||
useDeepCompareEffect(() => {
|
||||
@ -87,18 +87,18 @@ const AccessEditFormSSHConfig = ({ form, formName, disabled, loading, model, onM
|
||||
|
||||
const handleUploadChange: UploadProps["onChange"] = async ({ file }) => {
|
||||
if (file && file.status !== "removed") {
|
||||
form.setFieldValue("key", (await readFileContent(file.originFileObj ?? (file as unknown as File))).trim());
|
||||
formInst.setFieldValue("key", (await readFileContent(file.originFileObj ?? (file as unknown as File))).trim());
|
||||
setKeyFileList([file]);
|
||||
} else {
|
||||
form.setFieldValue("key", "");
|
||||
formInst.setFieldValue("key", "");
|
||||
setKeyFileList([]);
|
||||
}
|
||||
|
||||
flushSync(() => onModelChange?.(form.getFieldsValue(true)));
|
||||
flushSync(() => onModelChange?.(formInst.getFieldsValue(true)));
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<div className="flex space-x-2">
|
||||
<div className="w-2/3">
|
||||
<Form.Item name="host" label={t("access.form.ssh_host.label")} rules={[formRule]}>
|
||||
@ -135,7 +135,7 @@ const AccessEditFormSSHConfig = ({ form, formName, disabled, loading, model, onM
|
||||
<div className="flex space-x-2">
|
||||
<div className="w-1/2">
|
||||
<Form.Item name="key" noStyle rules={[formRule]}>
|
||||
<Input.TextArea autoComplete="new-password" hidden placeholder={t("access.form.ssh_key.placeholder")} value={form.getFieldValue("key")} />
|
||||
<Input.TextArea autoComplete="new-password" hidden placeholder={t("access.form.ssh_key.placeholder")} value={formInst.getFieldValue("key")} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("access.form.ssh_key.label")} tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.ssh_key.tooltip") }}></span>}>
|
||||
<Upload beforeUpload={() => false} fileList={keyFileList} maxCount={1} onChange={handleUploadChange}>
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormTencentCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormTencentCloudConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormTencentCloudConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormTencentCloudConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormTencentCloudConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormTencentCloudConfigProps) => {
|
||||
const AccessEditFormTencentCloudConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormTencentCloudConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormTencentCloudConfig = ({ form, formName, disabled, loading, m
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="secretId"
|
||||
label={t("access.form.tencentcloud_secret_id.label")}
|
||||
|
@ -13,7 +13,6 @@ export type AccessEditFormVolcEngineConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormVolcEngineConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormVolcEngineConfigModelType) => void;
|
||||
};
|
||||
@ -25,7 +24,7 @@ const initModel = () => {
|
||||
} as AccessEditFormVolcEngineConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormVolcEngineConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormVolcEngineConfigProps) => {
|
||||
const AccessEditFormVolcEngineConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormVolcEngineConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -52,7 +51,7 @@ const AccessEditFormVolcEngineConfig = ({ form, formName, disabled, loading, mod
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item
|
||||
name="accessKeyId"
|
||||
label={t("access.form.volcengine_access_key_id.label")}
|
||||
|
@ -12,7 +12,6 @@ export type AccessEditFormWebhookConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: AccessEditFormWebhookConfigModelType;
|
||||
onModelChange?: (model: AccessEditFormWebhookConfigModelType) => void;
|
||||
};
|
||||
@ -23,7 +22,7 @@ const initModel = () => {
|
||||
} as AccessEditFormWebhookConfigModelType;
|
||||
};
|
||||
|
||||
const AccessEditFormWebhookConfig = ({ form, formName, disabled, loading, model, onModelChange }: AccessEditFormWebhookConfigProps) => {
|
||||
const AccessEditFormWebhookConfig = ({ form, formName, disabled, model, onModelChange }: AccessEditFormWebhookConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
@ -44,7 +43,7 @@ const AccessEditFormWebhookConfig = ({ form, formName, disabled, loading, model,
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} disabled={loading || disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form form={form} disabled={disabled} initialValues={initialValues} layout="vertical" name={formName} onValuesChange={handleFormChange}>
|
||||
<Form.Item name="url" label={t("access.form.webhook_url.label")} rules={[formRule]}>
|
||||
<Input placeholder={t("access.form.webhook_url.placeholder")} />
|
||||
</Form.Item>
|
||||
|
@ -19,7 +19,6 @@ export type NotifyChannelEditFormProps = {
|
||||
style?: React.CSSProperties;
|
||||
channel: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
model?: NotifyChannelEditFormModelType;
|
||||
onModelChange?: (model: NotifyChannelEditFormModelType) => void;
|
||||
};
|
||||
@ -31,7 +30,7 @@ export type NotifyChannelEditFormInstance = {
|
||||
};
|
||||
|
||||
const NotifyChannelEditForm = forwardRef<NotifyChannelEditFormInstance, NotifyChannelEditFormProps>(
|
||||
({ className, style, channel, disabled, loading, model, onModelChange }, ref) => {
|
||||
({ className, style, channel, disabled, model, onModelChange }, ref) => {
|
||||
const [form] = Form.useForm();
|
||||
const formName = useCreation(() => `notifyChannelEditForm_${Math.random().toString(36).substring(2, 10)}${new Date().getTime()}`, []);
|
||||
const formFieldsComponent = useMemo(() => {
|
||||
@ -85,7 +84,7 @@ const NotifyChannelEditForm = forwardRef<NotifyChannelEditFormInstance, NotifyCh
|
||||
className={className}
|
||||
style={style}
|
||||
form={form}
|
||||
disabled={loading || disabled}
|
||||
disabled={disabled}
|
||||
initialValues={initialValues}
|
||||
layout="vertical"
|
||||
name={formName}
|
||||
|
@ -36,7 +36,7 @@ const NotifyChannelEditFormEmailFields = () => {
|
||||
.email({ message: t("common.errmsg.email_invalid") }),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
const form = Form.useFormInstance();
|
||||
const form = Form.useFormInstance<z.infer<typeof formSchema>>();
|
||||
|
||||
const handleTLSSwitchChange = (checked: boolean) => {
|
||||
const oldPort = form.getFieldValue("smtpPort");
|
||||
|
@ -54,7 +54,7 @@ const NotifyTemplateForm = ({ className, style }: NotifyTemplateFormProps) => {
|
||||
},
|
||||
onFinally: (_, resp) => {
|
||||
const template = resp?.content?.notifyTemplates?.[0] ?? defaultNotifyTemplate;
|
||||
setInitialValues({ ...template });
|
||||
setInitialValues(template);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -24,7 +24,7 @@ const SSLProviderEditFormLetsEncryptConfig = () => {
|
||||
|
||||
const { pending, settings, updateSettings } = useContext(SSLProviderContext);
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const [form] = Form.useForm<NonNullable<unknown>>();
|
||||
|
||||
const [initialValues, setInitialValues] = useState(settings?.content?.config?.[SSLPROVIDERS.LETS_ENCRYPT]);
|
||||
const [initialChanged, setInitialChanged] = useState(false);
|
||||
@ -209,7 +209,7 @@ const SettingsSSLProvider = () => {
|
||||
const [messageApi, MessageContextHolder] = message.useMessage();
|
||||
const [notificationApi, NotificationContextHolder] = notification.useNotification();
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const [form] = Form.useForm<{ provider?: string }>();
|
||||
const [formPending, setFormPending] = useState(false);
|
||||
|
||||
const [settings, setSettings] = useState<SettingsModel<SSLProviderSettingsContent>>();
|
||||
|
@ -1,9 +1,8 @@
|
||||
import path from "path";
|
||||
import legacy from "@vitejs/plugin-legacy";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig, Plugin } from "vite";
|
||||
|
||||
import path from "node:path";
|
||||
import fs from "fs-extra";
|
||||
import legacyPlugin from "@vitejs/plugin-legacy";
|
||||
import reactPlugin from "@vitejs/plugin-react";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
|
||||
const preserveFilesPlugin = (filesToPreserve: string[]): Plugin => {
|
||||
return {
|
||||
@ -34,8 +33,8 @@ const preserveFilesPlugin = (filesToPreserve: string[]): Plugin => {
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react({}),
|
||||
legacy({
|
||||
reactPlugin({}),
|
||||
legacyPlugin({
|
||||
targets: ["defaults", "not IE 11"],
|
||||
}),
|
||||
preserveFilesPlugin(["dist/.gitkeep"]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user