feat: normalize provider names
This commit is contained in:
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type AliyunConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type AliyunAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -27,24 +27,24 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
accessKeyId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
||||
.min(1, "access.form.access_key_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
accessSecretId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
||||
.min(1, "access.form.access_key_secret.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: AliyunConfig = {
|
||||
let config: AliyunAccessConfig = {
|
||||
accessKeyId: "",
|
||||
accessKeySecret: "",
|
||||
};
|
||||
if (data) config = data.config as AliyunConfig;
|
||||
if (data) config = data.config as AliyunAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -113,9 +113,9 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -128,7 +128,7 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -143,7 +143,7 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -158,9 +158,9 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
||||
name="accessKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -173,9 +173,9 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
||||
name="accessSecretId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key_secret.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key_secret.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key_secret.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key_secret.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { AccessModel, accessProvidersMap, accessTypeFormSchema, type AwsConfig } from "@/domain/access";
|
||||
import { AccessModel, accessProvidersMap, accessTypeFormSchema, type AWSAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -27,34 +27,34 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
region: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.region.placeholder")
|
||||
.min(1, "access.form.region.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
accessKeyId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
||||
.min(1, "access.form.access_key_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
secretAccessKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
||||
.min(1, "access.form.secret_access_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
hostedZoneId: z
|
||||
.string()
|
||||
.min(0, "access.authorization.form.aws_hosted_zone_id.placeholder")
|
||||
.min(0, "access.form.aws_hosted_zone_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: AwsConfig = {
|
||||
let config: AWSAccessConfig = {
|
||||
region: "cn-north-1",
|
||||
accessKeyId: "",
|
||||
secretAccessKey: "",
|
||||
hostedZoneId: "",
|
||||
};
|
||||
if (data) config = data.config as AwsConfig;
|
||||
if (data) config = data.config as AWSAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -127,9 +127,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -142,7 +142,7 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -157,7 +157,7 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -172,9 +172,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="region"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.region.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.region.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.region.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.region.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -187,9 +187,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="accessKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -202,9 +202,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="secretAccessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -217,9 +217,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
||||
name="hostedZoneId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.aws_hosted_zone_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.aws_hosted_zone_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.aws_hosted_zone_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.aws_hosted_zone_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type BaiduCloudConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type BaiduCloudAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -27,24 +27,24 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
accessKeyId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
||||
.min(1, "access.form.access_key_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
secretAccessKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
||||
.min(1, "access.form.secret_access_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: BaiduCloudConfig = {
|
||||
let config: BaiduCloudAccessConfig = {
|
||||
accessKeyId: "",
|
||||
secretAccessKey: "",
|
||||
};
|
||||
if (data) config = data.config as BaiduCloudConfig;
|
||||
if (data) config = data.config as BaiduCloudAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -113,9 +113,9 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -128,7 +128,7 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -143,7 +143,7 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -158,9 +158,9 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
||||
name="accessKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -173,9 +173,9 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
||||
name="secretAccessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type ByteplusConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type BytePlusAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,24 +25,24 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
accessKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key.placeholder")
|
||||
.min(1, "access.form.access_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
secretKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_key.placeholder")
|
||||
.min(1, "access.form.secret_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: ByteplusConfig = {
|
||||
let config: BytePlusAccessConfig = {
|
||||
accessKey: "",
|
||||
secretKey: "",
|
||||
};
|
||||
if (data) config = data.config as ByteplusConfig;
|
||||
if (data) config = data.config as BytePlusAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -110,9 +110,9 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -125,7 +125,7 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -140,7 +140,7 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -155,9 +155,9 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
||||
name="accessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -170,9 +170,9 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
||||
name="secretKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type CloudflareConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type CloudflareAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,19 +25,19 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
dnsApiToken: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.cloud_dns_api_token.placeholder")
|
||||
.min(1, "access.form.cloud_dns_api_token.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: CloudflareConfig = {
|
||||
let config: CloudflareAccessConfig = {
|
||||
dnsApiToken: "",
|
||||
};
|
||||
if (data) config = data.config as CloudflareConfig;
|
||||
if (data) config = data.config as CloudflareAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -101,9 +101,9 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -116,7 +116,7 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -131,7 +131,7 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -146,9 +146,9 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
||||
name="dnsApiToken"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.cloud_dns_api_token.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.cloud_dns_api_token.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.cloud_dns_api_token.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.cloud_dns_api_token.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type DogeCloudConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type DogeCloudAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,18 +25,18 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
accessKey: z.string().min(1, "access.authorization.form.access_key.placeholder").max(64),
|
||||
secretKey: z.string().min(1, "access.authorization.form.secret_key.placeholder").max(64),
|
||||
accessKey: z.string().min(1, "access.form.access_key.placeholder").max(64),
|
||||
secretKey: z.string().min(1, "access.form.secret_key.placeholder").max(64),
|
||||
});
|
||||
|
||||
let config: DogeCloudConfig = {
|
||||
let config: DogeCloudAccessConfig = {
|
||||
accessKey: "",
|
||||
secretKey: "",
|
||||
};
|
||||
if (data) config = data.config as DogeCloudConfig;
|
||||
if (data) config = data.config as DogeCloudAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -104,9 +104,9 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -119,7 +119,7 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -134,7 +134,7 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -149,9 +149,9 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
||||
name="accessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -164,9 +164,9 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
||||
name="secretKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -5,7 +5,6 @@ import { cn } from "@/components/ui/utils";
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||
import AccessEditForm from "@/components/access/AccessEditForm";
|
||||
import AccessTypeSelect from "@/components/access/AccessTypeSelect";
|
||||
import AccessAliyunForm from "./AccessAliyunForm";
|
||||
import AccessTencentForm from "./AccessTencentForm";
|
||||
@@ -61,7 +60,7 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "tencent":
|
||||
case "tencentcloud":
|
||||
childComponent = (
|
||||
<AccessTencentForm
|
||||
data={data}
|
||||
@@ -160,7 +159,7 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "pdns":
|
||||
case "powerdns":
|
||||
childComponent = (
|
||||
<AccessPdnsForm
|
||||
data={data}
|
||||
@@ -171,7 +170,7 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "httpreq":
|
||||
case "acmehttpreq":
|
||||
childComponent = (
|
||||
<AccessHttpreqForm
|
||||
data={data}
|
||||
@@ -282,13 +281,12 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
<ScrollArea className="max-h-[80vh]">
|
||||
<AccessEditForm data={data} />
|
||||
<div className="container py-3">
|
||||
<div>
|
||||
<Label>{t("access.authorization.form.type.label")}</Label>
|
||||
<Label>{t("access.form.type.label")}</Label>
|
||||
<AccessTypeSelect
|
||||
className="w-full mt-3"
|
||||
placeholder={t("access.authorization.form.type.placeholder")}
|
||||
placeholder={t("access.form.type.placeholder")}
|
||||
value={configType}
|
||||
showSearch={true}
|
||||
onChange={(val) => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type GodaddyConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type GoDaddyAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,24 +25,24 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
apiKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.godaddy_api_key.placeholder")
|
||||
.min(1, "access.form.godaddy_api_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
apiSecret: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.godaddy_api_secret.placeholder")
|
||||
.min(1, "access.form.godaddy_api_secret.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: GodaddyConfig = {
|
||||
let config: GoDaddyAccessConfig = {
|
||||
apiKey: "",
|
||||
apiSecret: "",
|
||||
};
|
||||
if (data) config = data.config as GodaddyConfig;
|
||||
if (data) config = data.config as GoDaddyAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -108,9 +108,9 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -123,7 +123,7 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -138,7 +138,7 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -153,9 +153,9 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
||||
name="apiKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.godaddy_api_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.godaddy_api_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.godaddy_api_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.godaddy_api_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -168,9 +168,9 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
||||
name="apiSecret"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.godaddy_api_secret.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.godaddy_api_secret.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.godaddy_api_secret.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.godaddy_api_secret.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type HttpreqConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type ACMEHttpReqAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,35 +25,35 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
endpoint: z.string().url("common.errmsg.url_invalid"),
|
||||
mode: z.enum(["RAW", ""]),
|
||||
username: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
||||
.min(1, "access.form.access_key_secret.placeholder")
|
||||
.max(128, t("common.errmsg.string_max", { max: 128 })),
|
||||
password: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
||||
.min(1, "access.form.access_key_secret.placeholder")
|
||||
.max(128, t("common.errmsg.string_max", { max: 128 })),
|
||||
});
|
||||
|
||||
let config: HttpreqConfig = {
|
||||
let config: ACMEHttpReqAccessConfig = {
|
||||
endpoint: "",
|
||||
mode: "",
|
||||
username: "",
|
||||
password: "",
|
||||
};
|
||||
if (data) config = data.config as HttpreqConfig;
|
||||
if (data) config = data.config as ACMEHttpReqAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
id: data?.id,
|
||||
name: data?.name || "",
|
||||
configType: "httpreq",
|
||||
configType: "acmehttpreq",
|
||||
endpoint: config.endpoint,
|
||||
mode: config.mode === "RAW" ? "RAW" : "",
|
||||
username: config.username,
|
||||
@@ -119,9 +119,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -134,7 +134,7 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -149,7 +149,7 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -164,9 +164,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="endpoint"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.httpreq_endpoint.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.httpreq_endpoint.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.httpreq_endpoint.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.httpreq_endpoint.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -179,9 +179,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="mode"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.httpreq_mode.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.httpreq_mode.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.httpreq_mode.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.httpreq_mode.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -194,9 +194,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="username"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.username.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.username.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.username.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.username.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -209,9 +209,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
||||
name="password"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.password.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.password.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.password.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.password.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type HuaweiCloudConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type HuaweiCloudAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,29 +25,29 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
region: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.region.placeholder")
|
||||
.min(1, "access.form.region.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
accessKeyId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
||||
.min(1, "access.form.access_key_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
secretAccessKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
||||
.min(1, "access.form.secret_access_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: HuaweiCloudConfig = {
|
||||
let config: HuaweiCloudAccessConfig = {
|
||||
region: "cn-north-1",
|
||||
accessKeyId: "",
|
||||
secretAccessKey: "",
|
||||
};
|
||||
if (data) config = data.config as HuaweiCloudConfig;
|
||||
if (data) config = data.config as HuaweiCloudAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -117,9 +117,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -132,7 +132,7 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -147,7 +147,7 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -162,9 +162,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
name="region"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.region.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.region.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.region.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.region.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -177,9 +177,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
name="accessKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -192,9 +192,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
||||
name="secretAccessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { readFileContent } from "@/utils/file";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type KubernetesConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type KubernetesAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -32,17 +32,17 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
kubeConfig: z
|
||||
.string()
|
||||
.min(0, "access.authorization.form.k8s_kubeconfig.placeholder")
|
||||
.min(0, "access.form.k8s_kubeconfig.placeholder")
|
||||
.max(20480, t("common.errmsg.string_max", { max: 20480 })),
|
||||
kubeConfigFile: z.any().optional(),
|
||||
});
|
||||
|
||||
let config: KubernetesConfig & { kubeConfigFile?: string } = {
|
||||
let config: KubernetesAccessConfig & { kubeConfigFile?: string } = {
|
||||
kubeConfig: "",
|
||||
kubeConfigFile: "",
|
||||
};
|
||||
@@ -126,9 +126,9 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -141,9 +141,9 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
||||
name="kubeConfig"
|
||||
render={({ field }) => (
|
||||
<FormItem hidden>
|
||||
<FormLabel>{t("access.authorization.form.k8s_kubeconfig.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.k8s_kubeconfig.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.k8s_kubeconfig.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.k8s_kubeconfig.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -156,14 +156,14 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
||||
name="kubeConfigFile"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.k8s_kubeconfig.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.k8s_kubeconfig.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<div>
|
||||
<Button type={"button"} variant={"secondary"} size={"sm"} className="w-48" onClick={handleSelectFileClick}>
|
||||
{fileName ? fileName : t("access.authorization.form.k8s_kubeconfig_file.placeholder")}
|
||||
{fileName ? fileName : t("access.form.k8s_kubeconfig_file.placeholder")}
|
||||
</Button>
|
||||
<Input
|
||||
placeholder={t("access.authorization.form.k8s_kubeconfig.placeholder")}
|
||||
placeholder={t("access.form.k8s_kubeconfig.placeholder")}
|
||||
{...field}
|
||||
ref={fileInputRef}
|
||||
className="hidden"
|
||||
|
||||
@@ -26,7 +26,7 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
});
|
||||
@@ -93,9 +93,9 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -108,7 +108,7 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -123,7 +123,7 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
|
||||
@@ -8,36 +8,36 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type NamesiloConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type NameSiloAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
type AccessNamesiloFormProps = {
|
||||
type AccessNameSiloFormProps = {
|
||||
op: "add" | "edit" | "copy";
|
||||
data?: AccessModel;
|
||||
onAfterReq: () => void;
|
||||
};
|
||||
|
||||
const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) => {
|
||||
const AccessNameSiloForm = ({ data, op, onAfterReq }: AccessNameSiloFormProps) => {
|
||||
const { createAccess, updateAccess } = useAccessStore();
|
||||
const { t } = useTranslation();
|
||||
const formSchema = z.object({
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
apiKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.namesilo_api_key.placeholder")
|
||||
.min(1, "access.form.namesilo_api_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: NamesiloConfig = {
|
||||
let config: NameSiloAccessConfig = {
|
||||
apiKey: "",
|
||||
};
|
||||
if (data) config = data.config as NamesiloConfig;
|
||||
if (data) config = data.config as NameSiloAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -101,9 +101,9 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -116,7 +116,7 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -131,7 +131,7 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -146,9 +146,9 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
||||
name="apiKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.namesilo_api_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.namesilo_api_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.namesilo_api_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.namesilo_api_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -165,4 +165,4 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
||||
);
|
||||
};
|
||||
|
||||
export default AccessNamesiloForm;
|
||||
export default AccessNameSiloForm;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type PdnsConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type PowerDNSAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,28 +25,28 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
apiUrl: z.string().url("common.errmsg.url_invalid"),
|
||||
apiKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
||||
.min(1, "access.form.access_key_secret.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: PdnsConfig = {
|
||||
let config: PowerDNSAccessConfig = {
|
||||
apiUrl: "",
|
||||
apiKey: "",
|
||||
};
|
||||
if (data) config = data.config as PdnsConfig;
|
||||
if (data) config = data.config as PowerDNSAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
id: data?.id,
|
||||
name: data?.name || "",
|
||||
configType: "pdns",
|
||||
configType: "powerdns",
|
||||
apiUrl: config.apiUrl,
|
||||
apiKey: config.apiKey,
|
||||
},
|
||||
@@ -108,9 +108,9 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -123,7 +123,7 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -138,7 +138,7 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -153,9 +153,9 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
||||
name="apiUrl"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.pdns_api_url.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.pdns_api_url.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.pdns_api_url.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.pdns_api_url.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -168,9 +168,9 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
||||
name="apiKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.pdns_api_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.pdns_api_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.pdns_api_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.pdns_api_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type QiniuConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type QiniuAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,18 +25,18 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
accessKey: z.string().min(1, "access.authorization.form.access_key.placeholder").max(64),
|
||||
secretKey: z.string().min(1, "access.authorization.form.secret_key.placeholder").max(64),
|
||||
accessKey: z.string().min(1, "access.form.access_key.placeholder").max(64),
|
||||
secretKey: z.string().min(1, "access.form.secret_key.placeholder").max(64),
|
||||
});
|
||||
|
||||
let config: QiniuConfig = {
|
||||
let config: QiniuAccessConfig = {
|
||||
accessKey: "",
|
||||
secretKey: "",
|
||||
};
|
||||
if (data) config = data.config as QiniuConfig;
|
||||
if (data) config = data.config as QiniuAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -104,9 +104,9 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -119,7 +119,7 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -134,7 +134,7 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -149,9 +149,9 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
||||
name="accessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -164,9 +164,9 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
||||
name="secretKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { readFileContent } from "@/utils/file";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type SSHConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type SSHAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -36,7 +36,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
host: z.string().refine(
|
||||
@@ -50,28 +50,28 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
group: z.string().optional(),
|
||||
port: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.ssh_port.placeholder")
|
||||
.min(1, "access.form.ssh_port.placeholder")
|
||||
.max(5, t("common.errmsg.string_max", { max: 5 })),
|
||||
username: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.ssh_username.placeholder")
|
||||
.min(1, "access.form.ssh_username.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
password: z
|
||||
.string()
|
||||
.min(0, "access.authorization.form.ssh_password.placeholder")
|
||||
.min(0, "access.form.ssh_password.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
key: z
|
||||
.string()
|
||||
.min(0, "access.authorization.form.ssh_key.placeholder")
|
||||
.min(0, "access.form.ssh_key.placeholder")
|
||||
.max(20480, t("common.errmsg.string_max", { max: 20480 })),
|
||||
keyFile: z.any().optional(),
|
||||
keyPassphrase: z
|
||||
.string()
|
||||
.min(0, "access.authorization.form.ssh_key_passphrase.placeholder")
|
||||
.min(0, "access.form.ssh_key_passphrase.placeholder")
|
||||
.max(2048, t("common.errmsg.string_max", { max: 2048 })),
|
||||
});
|
||||
|
||||
let config: SSHConfig = {
|
||||
let config: SSHAccessConfig = {
|
||||
host: "127.0.0.1",
|
||||
port: "22",
|
||||
username: "root",
|
||||
@@ -80,7 +80,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
keyFile: "",
|
||||
keyPassphrase: "",
|
||||
};
|
||||
if (data) config = data.config as SSHConfig;
|
||||
if (data) config = data.config as SSHAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -175,9 +175,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -190,7 +190,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -205,7 +205,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -220,9 +220,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="host"
|
||||
render={({ field }) => (
|
||||
<FormItem className="grow">
|
||||
<FormLabel>{t("access.authorization.form.ssh_host.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_host.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.ssh_host.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.ssh_host.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -235,9 +235,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="port"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.ssh_port.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_port.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.ssh_port.placeholder")} {...field} type="number" />
|
||||
<Input placeholder={t("access.form.ssh_port.placeholder")} {...field} type="number" />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -251,9 +251,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="username"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.ssh_username.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_username.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.ssh_username.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.ssh_username.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -266,9 +266,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="password"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.ssh_password.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_password.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.ssh_password.placeholder")} {...field} type="password" />
|
||||
<Input placeholder={t("access.form.ssh_password.placeholder")} {...field} type="password" />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -281,9 +281,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="key"
|
||||
render={({ field }) => (
|
||||
<FormItem hidden>
|
||||
<FormLabel>{t("access.authorization.form.ssh_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.ssh_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.ssh_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -296,14 +296,14 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="keyFile"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.ssh_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<div>
|
||||
<Button type={"button"} variant={"secondary"} size={"sm"} className="w-48" onClick={handleSelectFileClick}>
|
||||
{fileName ? fileName : t("access.authorization.form.ssh_key_file.placeholder")}
|
||||
{fileName ? fileName : t("access.form.ssh_key_file.placeholder")}
|
||||
</Button>
|
||||
<Input
|
||||
placeholder={t("access.authorization.form.ssh_key.placeholder")}
|
||||
placeholder={t("access.form.ssh_key.placeholder")}
|
||||
{...field}
|
||||
ref={fileInputRef}
|
||||
className="hidden"
|
||||
@@ -324,9 +324,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
||||
name="keyPassphrase"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.ssh_key_passphrase.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.ssh_key_passphrase.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.ssh_key_passphrase.placeholder")} {...field} type="password" />
|
||||
<Input placeholder={t("access.form.ssh_key_passphrase.placeholder")} {...field} type="password" />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type TencentConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type TencentCloudAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,31 +25,31 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
secretId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_id.placeholder")
|
||||
.min(1, "access.form.secret_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
secretKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_key.placeholder")
|
||||
.min(1, "access.form.secret_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: TencentConfig = {
|
||||
let config: TencentCloudAccessConfig = {
|
||||
secretId: "",
|
||||
secretKey: "",
|
||||
};
|
||||
if (data) config = data.config as TencentConfig;
|
||||
if (data) config = data.config as TencentCloudAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
id: data?.id,
|
||||
name: data?.name || "",
|
||||
configType: "tencent",
|
||||
configType: "tencentcloud",
|
||||
secretId: config.secretId,
|
||||
secretKey: config.secretKey,
|
||||
},
|
||||
@@ -108,9 +108,9 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -123,7 +123,7 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -138,7 +138,7 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -153,9 +153,9 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
||||
name="secretId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -168,9 +168,9 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
||||
name="secretKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type VolcengineConfig } from "@/domain/access";
|
||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type VolcEngineAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,24 +25,24 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
accessKeyId: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
||||
.min(1, "access.form.access_key_id.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
secretAccessKey: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
||||
.min(1, "access.form.secret_access_key.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
});
|
||||
|
||||
let config: VolcengineConfig = {
|
||||
let config: VolcEngineAccessConfig = {
|
||||
accessKeyId: "",
|
||||
secretAccessKey: "",
|
||||
};
|
||||
if (data) config = data.config as VolcengineConfig;
|
||||
if (data) config = data.config as VolcEngineAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -110,9 +110,9 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -125,7 +125,7 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -140,7 +140,7 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -155,9 +155,9 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
||||
name="accessKeyId"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -170,9 +170,9 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
||||
name="secretAccessKey"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { PbErrorData } from "@/domain/base";
|
||||
import { AccessModel, accessProvidersMap, accessTypeFormSchema, WebhookConfig } from "@/domain/access";
|
||||
import { AccessModel, accessProvidersMap, accessTypeFormSchema, WebhookAccessConfig } from "@/domain/access";
|
||||
import { save } from "@/repository/access";
|
||||
import { useAccessStore } from "@/stores/access";
|
||||
|
||||
@@ -25,16 +25,16 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
||||
id: z.string().optional(),
|
||||
name: z
|
||||
.string()
|
||||
.min(1, "access.authorization.form.name.placeholder")
|
||||
.min(1, "access.form.name.placeholder")
|
||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||
configType: accessTypeFormSchema,
|
||||
url: z.string().url("common.errmsg.url_invalid"),
|
||||
});
|
||||
|
||||
let config: WebhookConfig = {
|
||||
let config: WebhookAccessConfig = {
|
||||
url: "",
|
||||
};
|
||||
if (data) config = data.config as WebhookConfig;
|
||||
if (data) config = data.config as WebhookAccessConfig;
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
@@ -98,9 +98,9 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@@ -113,7 +113,7 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
||||
name="id"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -128,7 +128,7 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
||||
name="configType"
|
||||
render={({ field }) => (
|
||||
<FormItem className="hidden">
|
||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -143,9 +143,9 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
||||
name="url"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("access.authorization.form.webhook_url.label")}</FormLabel>
|
||||
<FormLabel>{t("access.form.webhook_url.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder={t("access.authorization.form.webhook_url.placeholder")} {...field} />
|
||||
<Input placeholder={t("access.form.webhook_url.placeholder")} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
|
||||
@@ -4,15 +4,16 @@ import { BookOpen as BookOpenIcon } from "lucide-react";
|
||||
|
||||
import { version } from "@/domain/version";
|
||||
|
||||
type VersionProps = {
|
||||
export type VersionProps = {
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
|
||||
const Version = ({ className }: VersionProps) => {
|
||||
const Version = ({ className, style }: VersionProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Space className={className} size={4}>
|
||||
<Space className={className} style={style} size={4}>
|
||||
<Typography.Link type="secondary" href="https://docs.certimate.me" target="_blank">
|
||||
<div className="flex items-center justify-center space-x-1">
|
||||
<BookOpenIcon size={16} />
|
||||
|
||||
@@ -60,14 +60,14 @@ const getForm = (data: WorkflowNode, defaultProivder?: string) => {
|
||||
return <DeployToQiniuCDN data={data} />;
|
||||
case "webhook":
|
||||
return <DeployToWebhook data={data} />;
|
||||
case "tencent-cdn":
|
||||
case "tencent-ecdn":
|
||||
case "tencentcloud-cdn":
|
||||
case "tencentcloud-ecdn":
|
||||
return <DeployToTencentCDN data={data} />;
|
||||
case "tencent-clb":
|
||||
case "tencentcloud-clb":
|
||||
return <DeployToTencentCLB data={data} />;
|
||||
case "tencent-cos":
|
||||
case "tencentcloud-cos":
|
||||
return <DeployToTencentCOS data={data} />;
|
||||
case "tencent-teo":
|
||||
case "tencentcloud-eo":
|
||||
return <DeployToTencentTEO data={data} />;
|
||||
case "ssh":
|
||||
return <DeployToSSH data={data} />;
|
||||
|
||||
@@ -56,7 +56,7 @@ const DeployToTencentCDN = ({ data }: DeployFormProps) => {
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
providerType: "tencent-cdn",
|
||||
providerType: "tencentcloud-cdn",
|
||||
access: config.access as string,
|
||||
certificate: config.certificate as string,
|
||||
domain: config.domain as string,
|
||||
@@ -94,7 +94,7 @@ const DeployToTencentCDN = ({ data }: DeployFormProps) => {
|
||||
</div>
|
||||
}
|
||||
op="add"
|
||||
outConfigType="tencent"
|
||||
outConfigType="tencentcloud"
|
||||
/>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
@@ -104,7 +104,7 @@ const DeployToTencentCDN = ({ data }: DeployFormProps) => {
|
||||
onValueChange={(value) => {
|
||||
form.setValue("access", value);
|
||||
}}
|
||||
providerType="tencent-cdn"
|
||||
providerType="tencentcloud-cdn"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ const DeployToTencentCLB = ({ data }: DeployFormProps) => {
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
providerType: "tencent-clb",
|
||||
providerType: "tencentcloud-clb",
|
||||
access: config.access as string,
|
||||
certificate: config.certificate as string,
|
||||
region: config.region as string,
|
||||
@@ -134,7 +134,7 @@ const DeployToTencentCLB = ({ data }: DeployFormProps) => {
|
||||
</div>
|
||||
}
|
||||
op="add"
|
||||
outConfigType="tencent"
|
||||
outConfigType="tencentcloud"
|
||||
/>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
@@ -144,7 +144,7 @@ const DeployToTencentCLB = ({ data }: DeployFormProps) => {
|
||||
onValueChange={(value) => {
|
||||
form.setValue("access", value);
|
||||
}}
|
||||
providerType="tencent-clb"
|
||||
providerType="tencentcloud-clb"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ const DeployToTencentCOS = ({ data }: DeployFormProps) => {
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
providerType: "tencent-cos",
|
||||
providerType: "tencentcloud-cos",
|
||||
access: config.access as string,
|
||||
certificate: config.certificate as string,
|
||||
region: config.region as string,
|
||||
@@ -100,7 +100,7 @@ const DeployToTencentCOS = ({ data }: DeployFormProps) => {
|
||||
</div>
|
||||
}
|
||||
op="add"
|
||||
outConfigType="tencent"
|
||||
outConfigType="tencentcloud"
|
||||
/>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
@@ -110,7 +110,7 @@ const DeployToTencentCOS = ({ data }: DeployFormProps) => {
|
||||
onValueChange={(value) => {
|
||||
form.setValue("access", value);
|
||||
}}
|
||||
providerType="tencent-cos"
|
||||
providerType="tencentcloud-cos"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ const DeployToTencentTEO = ({ data }: DeployFormProps) => {
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
providerType: "tencent-teo",
|
||||
providerType: "tencentcloud-eo",
|
||||
access: config.access as string,
|
||||
certificate: config.certificate as string,
|
||||
zoneId: config.zoneId as string,
|
||||
@@ -97,7 +97,7 @@ const DeployToTencentTEO = ({ data }: DeployFormProps) => {
|
||||
</div>
|
||||
}
|
||||
op="add"
|
||||
outConfigType="tencent"
|
||||
outConfigType="tencentcloud"
|
||||
/>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
@@ -107,7 +107,7 @@ const DeployToTencentTEO = ({ data }: DeployFormProps) => {
|
||||
onValueChange={(value) => {
|
||||
form.setValue("access", value);
|
||||
}}
|
||||
providerType="tencent-teo"
|
||||
providerType="tencentcloud-eo"
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user