mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 13:39:53 +00:00
wip: i18n
- Change locales json to one-dimensional format
This commit is contained in:
parent
b3f1e1e444
commit
e820e5599b
@ -10,6 +10,7 @@ import {
|
||||
import { z } from "zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
@ -39,9 +40,10 @@ const EmailsEdit = ({ className, trigger }: EmailsEditProps) => {
|
||||
} = useConfig();
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
email: z.string().email(),
|
||||
email: z.string().email("email.valid.message"),
|
||||
});
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
@ -54,7 +56,7 @@ const EmailsEdit = ({ className, trigger }: EmailsEditProps) => {
|
||||
const onSubmit = async (data: z.infer<typeof formSchema>) => {
|
||||
if ((emails.content as EmailsSetting).emails.includes(data.email)) {
|
||||
form.setError("email", {
|
||||
message: "邮箱已存在",
|
||||
message: "email.already.exist",
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -100,7 +102,7 @@ const EmailsEdit = ({ className, trigger }: EmailsEditProps) => {
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-[600px] w-full dark:text-stone-200">
|
||||
<DialogHeader>
|
||||
<DialogTitle>添加邮箱</DialogTitle>
|
||||
<DialogTitle>{t('email.add')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="container py-3">
|
||||
@ -118,9 +120,9 @@ const EmailsEdit = ({ className, trigger }: EmailsEditProps) => {
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>邮箱</FormLabel>
|
||||
<FormLabel>{t('email')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="请输入邮箱" {...field} type="email" />
|
||||
<Input placeholder={t('email.not.empty.message')} {...field} type="email" />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@ -129,7 +131,7 @@ const EmailsEdit = ({ className, trigger }: EmailsEditProps) => {
|
||||
/>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button type="submit">保存</Button>
|
||||
<Button type="submit">{t('save')}</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { BookOpen } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Separator } from "../ui/separator";
|
||||
import { version } from "@/domain/version";
|
||||
|
||||
const Version = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className="fixed right-0 bottom-0 w-full flex justify-between p-5">
|
||||
<div className=""></div>
|
||||
@ -14,7 +17,7 @@ const Version = () => {
|
||||
className="flex items-center"
|
||||
>
|
||||
<BookOpen size={16} />
|
||||
<div className="ml-1">文档</div>
|
||||
<div className="ml-1">{t('document')}</div>
|
||||
</a>
|
||||
<Separator orientation="vertical" className="mx-2" />
|
||||
<a
|
||||
|
@ -1,11 +1,108 @@
|
||||
{
|
||||
"username": "username",
|
||||
"password": "password",
|
||||
"email": "email",
|
||||
"logout": "logout",
|
||||
"setting": "setting",
|
||||
"account": "account",
|
||||
"template": "template",
|
||||
"save": "save",
|
||||
"no.data": "no.data",
|
||||
"status": "status",
|
||||
"operation": "operation",
|
||||
"enable": "enable",
|
||||
"disable": "disable",
|
||||
"deploy": "deploy",
|
||||
"download": "download",
|
||||
"delete": "delete",
|
||||
"cancel": "cancel",
|
||||
"confirm": "confirm",
|
||||
"edit": "edit",
|
||||
"succeed": "succeed",
|
||||
"add": "add",
|
||||
"document": "document",
|
||||
"basic.setting": "basic.setting",
|
||||
"advanced.setting": "advanced.setting",
|
||||
"operation.succeed": "operation.succeed",
|
||||
"save.succeed": "save.succeed",
|
||||
"save.failed": "save.failed",
|
||||
"login.submit": "login.submit",
|
||||
"login.username.no.empty.message": "login.username.no.empty.message",
|
||||
"login.password.length.message": "login.password.length.message",
|
||||
"menu.dashboard": "menu.dashboard",
|
||||
"menu.domain.management": "menu.domain.management",
|
||||
"menu.auth.management": "menu.auth.management",
|
||||
"menu.deploy.log": "menu.deploy.log"
|
||||
"theme.light": "theme.light",
|
||||
"theme.dark": "theme.dark",
|
||||
"theme.system": "theme.system",
|
||||
"dashboard": "dashboard",
|
||||
"dashboard.all": "dashboard.all",
|
||||
"dashboard.near.expired": "dashboard.near.expired",
|
||||
"dashboard.enabled": "dashboard.enabled",
|
||||
"dashboard.not.enabled": "dashboard.not.enabled",
|
||||
"dashboard.unit": "dashboard.unit",
|
||||
"deployment.log.name": "deployment.log.name",
|
||||
"deployment.log.empty": "deployment.log.empty",
|
||||
"deployment.log.status": "deployment.log.status",
|
||||
"deployment.log.stage": "deployment.log.stage",
|
||||
"deployment.log.last.execution.time": "deployment.log.last.execution.time",
|
||||
"deployment.log.detail.button.text": "deployment.log.detail.button.text",
|
||||
"deployment.log.detail": "deployment.log.detail",
|
||||
"pagination.next": "pagination.next",
|
||||
"pagination.prev": "pagination.prev",
|
||||
"domain": "domain",
|
||||
"domain.add": "domain.add",
|
||||
"domain.delete": "domain.delete",
|
||||
"domain.not.empty.verify.message": "domain.not.empty.verify.message",
|
||||
"domain.management.name": "domain.management.name",
|
||||
"domain.management.start.deploy.succeed.tips": "domain.management.start.deploy.succeed.tips",
|
||||
"domain.management.execution.failed": "domain.management.execution.failed",
|
||||
"domain.management.execution.failed.tips": "domain.management.execution.failed.tips",
|
||||
"domain.management.empty": "domain.management.empty",
|
||||
"domain.management.expiry.date": "domain.management.expiry.date",
|
||||
"domain.management.expiry.date1": "domain.management.expiry.date1",
|
||||
"domain.management.expiry.date2": "domain.management.expiry.date2",
|
||||
"domain.management.last.execution.time": "domain.management.last.execution.time",
|
||||
"domain.management.last.execution.status": "domain.management.last.execution.status",
|
||||
"domain.management.last.execution.stage": "domain.management.last.execution.stage",
|
||||
"domain.management.enable": "domain.management.enable",
|
||||
"domain.management.start.deploying": "domain.management.start.deploying",
|
||||
"domain.management.forced.deployment": "domain.management.forced.deployment",
|
||||
"domain.management.delete.confirm": "domain.management.delete.confirm",
|
||||
"domain.management.edit.title": "domain.management.edit.title",
|
||||
"domain.management.edit.dns.label": "domain.management.edit.dns.label",
|
||||
"domain.management.edit.dns.verify.tips": "domain.management.edit.dns.verify.tips",
|
||||
"domain.management.edit.target.type.verify.tips": "domain.management.edit.target.type.verify.tips",
|
||||
"domain.management.edit.succeed.tips": "domain.management.edit.succeed.tips",
|
||||
"domain.management.edit.target.access.verify.msg": "domain.management.edit.target.access.verify.msg",
|
||||
"domain.management.edit.email.not.empty.message": "domain.management.edit.email.not.empty.message",
|
||||
"domain.management.edit.email.description": "domain.management.edit.email.description",
|
||||
"domain.management.add.succeed.tips": "domain.management.add.succeed.tips",
|
||||
"email.add": "email.add",
|
||||
"email.list": "email.list",
|
||||
"email.valid.message": "email.valid.message",
|
||||
"email.already.exist": "email.already.exist",
|
||||
"email.not.empty.message": "email.not.empty.message",
|
||||
"setting.notify.menu": "setting.notify.menu",
|
||||
"setting.submit": "setting.submit",
|
||||
"setting.account.email.valid.message": "setting.account.email.valid.message",
|
||||
"setting.account.email.placeholder": "setting.account.email.placeholder",
|
||||
"setting.account.email.change.succeed": "setting.account.email.change.succeed",
|
||||
"setting.account.email.change.failed": "setting.account.email.change.failed",
|
||||
"setting.account.log.back.in": "setting.account.log.back.in",
|
||||
"setting.password.length.message": "setting.password.length.message",
|
||||
"setting.password.not.match": "setting.password.not.match",
|
||||
"setting.password.change.succeed": "setting.password.change.succeed",
|
||||
"setting.password.change.failed": "setting.password.change.failed",
|
||||
"setting.password.current.password": "setting.password.current.password",
|
||||
"setting.password.new.password": "setting.password.new.password",
|
||||
"setting.password.confirm.password": "setting.password.confirm.password",
|
||||
"setting.notify.template.save.succeed": "setting.notify.template.save.succeed",
|
||||
"setting.notify.template.variables.tips.title": "setting.notify.template.variables.tips.title",
|
||||
"setting.notify.template.variables.tips.content": "setting.notify.template.variables.tips.content",
|
||||
"setting.notify.config.enable": "setting.notify.config.enable",
|
||||
"setting.notify.config.save.succeed": "setting.notify.config.save.succeed",
|
||||
"setting.notify.config.save.failed": "setting.notify.config.save.failed",
|
||||
"setting.notify.config.save.failed.url.not.valid": "setting.notify.config.save.failed.url.not.valid",
|
||||
"deploy.progress.check": "deploy.progress.check",
|
||||
"deploy.progress.apply": "deploy.progress.apply",
|
||||
"deploy.progress.deploy": "deploy.progress.deploy"
|
||||
}
|
@ -18,101 +18,115 @@
|
||||
"cancel": "取消",
|
||||
"confirm": "确认",
|
||||
"edit": "编辑",
|
||||
"succeed": "成功",
|
||||
"add": "新增",
|
||||
"document": "文档",
|
||||
"variables": "变量",
|
||||
"dns": "域名服务器",
|
||||
"name": "名称",
|
||||
"create.time": "创建时间",
|
||||
"update.time": "更新时间",
|
||||
"created.in": "创建于",
|
||||
"updated.in": "更新于",
|
||||
"basic.setting": "基础设置",
|
||||
"advanced.setting": "高级设置",
|
||||
"operation.succeed": "操作成功",
|
||||
"save.succeed": "保存成功",
|
||||
"save.failed": "保存失败",
|
||||
"login.submit": "登录",
|
||||
"login.username.no.empty.message": "请输入正确的邮箱地址",
|
||||
"login.password.length.message": "密码至少10个字符",
|
||||
"menu": {
|
||||
"auth.management": "授权管理"
|
||||
},
|
||||
"theme": {
|
||||
"light": "浅色",
|
||||
"dark": "暗黑",
|
||||
"system": "系统"
|
||||
},
|
||||
"menu.auth.management": "授权管理",
|
||||
"theme.light": "浅色",
|
||||
"theme.dark": "暗黑",
|
||||
"theme.system": "系统",
|
||||
"dashboard": "控制面板",
|
||||
"dashboard.all": "所有",
|
||||
"dashboard.near.expired": "即将过期",
|
||||
"dashboard.enabled": "启用中",
|
||||
"dashboard.not.enabled": "未启用",
|
||||
"dashboard.unit": "个",
|
||||
"deployment.log": {
|
||||
"name": "部署历史",
|
||||
"empty": "你暂未创建任何部署,请先添加域名进行部署吧!",
|
||||
"status": "状态",
|
||||
"stage": "阶段",
|
||||
"last.execution.time": "最近执行时间",
|
||||
"detail.button.text": "日志",
|
||||
"detail": "部署详情"
|
||||
},
|
||||
"pagination": {
|
||||
"next": "下一页",
|
||||
"prev": "上一页"
|
||||
},
|
||||
"deployment.log.name": "部署历史",
|
||||
"deployment.log.empty": "你暂未创建任何部署,请先添加域名进行部署吧!",
|
||||
"deployment.log.status": "状态",
|
||||
"deployment.log.stage": "阶段",
|
||||
"deployment.log.last.execution.time": "最近执行时间",
|
||||
"deployment.log.detail.button.text": "日志",
|
||||
"deployment.log.detail": "部署详情",
|
||||
"pagination.next": "下一页",
|
||||
"pagination.prev": "上一页",
|
||||
"domain": "域名",
|
||||
"domain.add": "新增域名",
|
||||
"domain.delete": "删除域名",
|
||||
"domain.management": {
|
||||
"name": "域名列表",
|
||||
"start.deploy.succeed.tips": "已发起部署,请稍后查看部署日志。",
|
||||
"execution.failed": "执行失败",
|
||||
"execution.failed.tips": "执行失败,请在 <1>部署历史</1> 查看详情。",
|
||||
"empty": "请添加域名开始部署证书吧。",
|
||||
"expiry.date": "有效期限",
|
||||
"expiry.date1": "有效期 {{date}} 天",
|
||||
"expiry.date2": "{{date}} 到期",
|
||||
"last.execution.time": "最近执行时间",
|
||||
"last.execution.status": "最近执行状态",
|
||||
"last.execution.stage": "最近执行阶段",
|
||||
"enable": "是否启用",
|
||||
"start.deploying": "立即部署",
|
||||
"forced.deployment": "强行部署",
|
||||
"delete.confirm": "确定要删除域名吗?",
|
||||
"edit": {
|
||||
"title": "编辑域名",
|
||||
"domain.verify.tips": "域名",
|
||||
"dns.verify.tips": "请选择DNS服务商授权配置",
|
||||
"target.type.verify.tips": "请选择部署服务类型"
|
||||
}
|
||||
},
|
||||
"domain.not.empty.verify.message": "请输入域名",
|
||||
"domain.management.name": "域名列表",
|
||||
"domain.management.start.deploy.succeed.tips": "已发起部署,请稍后查看部署日志。",
|
||||
"domain.management.execution.failed": "执行失败",
|
||||
"domain.management.execution.failed.tips": "执行失败,请在 <1>部署历史</1> 查看详情。",
|
||||
"domain.management.empty": "请添加域名开始部署证书吧。",
|
||||
"domain.management.expiry.date": "有效期限",
|
||||
"domain.management.expiry.date1": "有效期 {{date}} 天",
|
||||
"domain.management.expiry.date2": "{{date}} 到期",
|
||||
"domain.management.last.execution.time": "最近执行时间",
|
||||
"domain.management.last.execution.status": "最近执行状态",
|
||||
"domain.management.last.execution.stage": "最近执行阶段",
|
||||
"domain.management.enable": "是否启用",
|
||||
"domain.management.start.deploying": "立即部署",
|
||||
"domain.management.forced.deployment": "强行部署",
|
||||
"domain.management.delete.confirm": "确定要删除域名吗?",
|
||||
"domain.management.edit.title": "编辑域名",
|
||||
"domain.management.edit.dns.access.label": "DNS 服务商授权配置",
|
||||
"domain.management.edit.dns.access.not.empty.message": "请选择DNS服务商授权配置",
|
||||
"domain.management.edit.access.label": "服务商授权配置",
|
||||
"domain.management.edit.access.not.empty.message": "请选择授权配置",
|
||||
"domain.management.edit.target.type": "部署服务类型",
|
||||
"domain.management.edit.target.type.not.empty.message": "请选择部署服务类型",
|
||||
"domain.management.edit.succeed.tips": "域名编辑成功",
|
||||
"domain.management.edit.target.access": "部署服务商授权配置",
|
||||
"domain.management.edit.target.access.content.label": "服务商授权配置",
|
||||
"domain.management.edit.target.access.not.empty.message": "请选择授权配置",
|
||||
"domain.management.edit.target.access.verify.msg": "部署授权和部署授权组至少选一个",
|
||||
"domain.management.edit.group.label": "部署配置组(用于将一个域名证书部署到多个 ssh 主机)",
|
||||
"domain.management.edit.group.not.empty.message": "请选择分组",
|
||||
"domain.management.edit.email.not.empty.message": "请选择邮箱",
|
||||
"domain.management.edit.email.description": "(申请证书需要提供邮箱)",
|
||||
"domain.management.edit.variables.placeholder": "可在SSH部署中使用,形如:\nkey=val;\nkey2=val2;",
|
||||
"domain.management.edit.dns.placeholder": "自定义域名服务器,多个用分号隔开,如:\n8.8.8.8;\n8.8.4.4;",
|
||||
"domain.management.add.succeed.tips": "域名添加成功",
|
||||
"email.add": "添加邮箱",
|
||||
"email.list": "邮箱列表",
|
||||
"email.valid.message": "请输入正确的邮箱地址",
|
||||
"email.already.exist": "邮箱已存在",
|
||||
"email.not.empty.message": "请输入邮箱",
|
||||
"setting.notify.menu": "消息推送",
|
||||
"setting.submit": "确认修改",
|
||||
"setting.account.email": {
|
||||
"valid.message": "请输入正确的邮箱地址",
|
||||
"placeholder": "请输入邮箱",
|
||||
"change.succeed": "修改账户邮箱成功",
|
||||
"change.failed": "修改账户邮箱失败"
|
||||
},
|
||||
"setting.account.email.valid.message": "请输入正确的邮箱地址",
|
||||
"setting.account.email.placeholder": "请输入邮箱",
|
||||
"setting.account.email.change.succeed": "修改账户邮箱成功",
|
||||
"setting.account.email.change.failed": "修改账户邮箱失败",
|
||||
"setting.account.log.back.in": "请重新登录",
|
||||
"setting.password": {
|
||||
"length.message": "密码至少10个字符",
|
||||
"not.match": "两次密码不一致",
|
||||
"change.succeed": "修改密码成功",
|
||||
"change.failed": "修改密码失败",
|
||||
"current.password": "当前密码",
|
||||
"new.password": "新密码",
|
||||
"confirm.password": "确认密码"
|
||||
},
|
||||
"setting.notify": {
|
||||
"template": {
|
||||
"save.succeed": "通知模板保存成功",
|
||||
"variables.tips": {
|
||||
"title": "可选的变量, COUNT:即将过期张数",
|
||||
"content": "可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"enable": "是否启用",
|
||||
"save.succeed": "配置保存成功",
|
||||
"save.failed": "配置保存失败",
|
||||
"save.failed.url.not.valid": "Url格式不正确"
|
||||
}
|
||||
},
|
||||
"deploy.progress": {
|
||||
"check": "检查",
|
||||
"apply": "获取",
|
||||
"deploy": "部署"
|
||||
}
|
||||
"setting.password.length.message": "密码至少10个字符",
|
||||
"setting.password.not.match": "两次密码不一致",
|
||||
"setting.password.change.succeed": "修改密码成功",
|
||||
"setting.password.change.failed": "修改密码失败",
|
||||
"setting.password.current.password": "当前密码",
|
||||
"setting.password.new.password": "新密码",
|
||||
"setting.password.confirm.password": "确认密码",
|
||||
"setting.notify.template.save.succeed": "通知模板保存成功",
|
||||
"setting.notify.template.variables.tips.title": "可选的变量, COUNT:即将过期张数",
|
||||
"setting.notify.template.variables.tips.content": "可选的变量, COUNT:即将过期张数,DOMAINS:域名列表",
|
||||
"setting.notify.config.enable": "是否启用",
|
||||
"setting.notify.config.save.succeed": "配置保存成功",
|
||||
"setting.notify.config.save.failed": "配置保存失败",
|
||||
"setting.notify.config.save.failed.url.not.valid": "Url格式不正确",
|
||||
"deploy.progress.check": "检查",
|
||||
"deploy.progress.apply": "获取",
|
||||
"deploy.progress.deploy": "部署",
|
||||
"access.management": "授权管理",
|
||||
"access.add": "添加授权",
|
||||
"access.list": "授权列表",
|
||||
"access.type": "服务商",
|
||||
"access.empty": "请添加授权开始部署证书吧。",
|
||||
"access.group.management": "授权组管理",
|
||||
"access.group.add": "添加授权组"
|
||||
}
|
@ -9,6 +9,7 @@ import { Access as AccessType, accessTypeMap } from "@/domain/access";
|
||||
import { convertZulu2Beijing } from "@/lib/time";
|
||||
import { useConfig } from "@/providers/config";
|
||||
import { remove } from "@/repository/access";
|
||||
import { t } from "i18next";
|
||||
import { Key } from "lucide-react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
@ -46,11 +47,11 @@ const Access = () => {
|
||||
return (
|
||||
<div className="">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="text-muted-foreground">授权管理</div>
|
||||
<div className="text-muted-foreground">{t('access.management')}</div>
|
||||
{tab != "access_group" ? (
|
||||
<AccessEdit trigger={<Button>添加授权</Button>} op="add" />
|
||||
<AccessEdit trigger={<Button>{t('access.add')}</Button>} op="add" />
|
||||
) : (
|
||||
<AccessGroupEdit trigger={<Button>添加授权组</Button>} />
|
||||
<AccessGroupEdit trigger={<Button>{t('access.group.add')}</Button>} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -66,7 +67,7 @@ const Access = () => {
|
||||
handleTabItemClick("access");
|
||||
}}
|
||||
>
|
||||
授权管理
|
||||
{t('access.management')}
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="access_group"
|
||||
@ -74,7 +75,7 @@ const Access = () => {
|
||||
handleTabItemClick("access_group");
|
||||
}}
|
||||
>
|
||||
授权组管理
|
||||
{t('access.group.management')}
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="access">
|
||||
@ -85,10 +86,10 @@ const Access = () => {
|
||||
</span>
|
||||
|
||||
<div className="text-center text-sm text-muted-foreground mt-3">
|
||||
请添加授权开始部署证书吧。
|
||||
{t('access.empty')}
|
||||
</div>
|
||||
<AccessEdit
|
||||
trigger={<Button>添加授权</Button>}
|
||||
trigger={<Button>{t('access.add')}</Button>}
|
||||
op="add"
|
||||
className="mt-3"
|
||||
/>
|
||||
@ -96,15 +97,15 @@ const Access = () => {
|
||||
) : (
|
||||
<>
|
||||
<div className="hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5">
|
||||
<div className="w-48">名称</div>
|
||||
<div className="w-48">服务商</div>
|
||||
<div className="w-48">{t('name')}</div>
|
||||
<div className="w-48">{t('access.type')}</div>
|
||||
|
||||
<div className="w-52">创建时间</div>
|
||||
<div className="w-52">更新时间</div>
|
||||
<div className="grow">操作</div>
|
||||
<div className="w-52">{t('create.time')}</div>
|
||||
<div className="w-52">{t('update.time')}</div>
|
||||
<div className="grow">{t('operation')}</div>
|
||||
</div>
|
||||
<div className="sm:hidden flex text-sm text-muted-foreground">
|
||||
授权列表
|
||||
{t('access.list')}
|
||||
</div>
|
||||
{accesses
|
||||
.filter((item) => {
|
||||
@ -128,18 +129,18 @@ const Access = () => {
|
||||
</div>
|
||||
|
||||
<div className="sm:w-52 w-full pt-1 sm:pt-0 flex items-center">
|
||||
创建于{" "}
|
||||
{t('created.in')}{" "}
|
||||
{access.created && convertZulu2Beijing(access.created)}
|
||||
</div>
|
||||
<div className="sm:w-52 w-full pt-1 sm:pt-0 flex items-center">
|
||||
更新于{" "}
|
||||
{t('updated.in')}{" "}
|
||||
{access.updated && convertZulu2Beijing(access.updated)}
|
||||
</div>
|
||||
<div className="flex items-center grow justify-start pt-1 sm:pt-0">
|
||||
<AccessEdit
|
||||
trigger={
|
||||
<Button variant={"link"} className="p-0">
|
||||
编辑
|
||||
{t('edit')}
|
||||
</Button>
|
||||
}
|
||||
op="edit"
|
||||
@ -153,7 +154,7 @@ const Access = () => {
|
||||
handleDelete(access);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
{t('delete')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -71,15 +71,15 @@ const Edit = () => {
|
||||
const formSchema = z.object({
|
||||
id: z.string().optional(),
|
||||
domain: z.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, {
|
||||
message: t('domain.management.edit.domain.verify.tips'),
|
||||
message: 'domain.not.empty.verify.message',
|
||||
}),
|
||||
email: z.string().email().optional(),
|
||||
email: z.string().email('email.valid.message').optional(),
|
||||
access: z.string().regex(/^[a-zA-Z0-9]+$/, {
|
||||
message: t('domain.management.edit.dns.verify.tips'),
|
||||
message: 'domain.management.edit.dns.access.not.empty.message',
|
||||
}),
|
||||
targetAccess: z.string().optional(),
|
||||
targetType: z.string().regex(/^[a-zA-Z0-9-]+$/, {
|
||||
message: t('domain.management.edit.target.type.verify.tips'),
|
||||
message: 'domain.management.edit.target.type.not.empty.message',
|
||||
}),
|
||||
variables: z.string().optional(),
|
||||
group: z.string().optional(),
|
||||
@ -140,11 +140,11 @@ const Edit = () => {
|
||||
if (group == "" && targetAccess == "") {
|
||||
form.setError("group", {
|
||||
type: "manual",
|
||||
message: "部署授权和部署授权组至少选一个",
|
||||
message: 'domain.management.edit.target.access.verify.msg',
|
||||
});
|
||||
form.setError("targetAccess", {
|
||||
type: "manual",
|
||||
message: "部署授权和部署授权组至少选一个",
|
||||
message: 'domain.management.edit.target.access.verify.msg',
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -164,13 +164,13 @@ const Edit = () => {
|
||||
|
||||
try {
|
||||
await save(req);
|
||||
let description = "域名编辑成功";
|
||||
let description = t('domain.management.edit.succeed.tips');
|
||||
if (req.id == "") {
|
||||
description = "域名添加成功";
|
||||
description = t('domain.management.add.succeed.tips');
|
||||
}
|
||||
|
||||
toast({
|
||||
title: "成功",
|
||||
title: t('succeed'),
|
||||
description,
|
||||
});
|
||||
navigate("/domains");
|
||||
@ -195,7 +195,7 @@ const Edit = () => {
|
||||
<div className="">
|
||||
<Toaster />
|
||||
<div className=" h-5 text-muted-foreground">
|
||||
{domain?.id ? "编辑" : "新增"}域名
|
||||
{domain?.id ? t('domain.edit') : t('domain.add')}
|
||||
</div>
|
||||
<div className="mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row">
|
||||
<div className="w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex">
|
||||
@ -208,7 +208,7 @@ const Edit = () => {
|
||||
setTab("base");
|
||||
}}
|
||||
>
|
||||
基础设置
|
||||
{t('basic.setting')}
|
||||
</div>
|
||||
<div
|
||||
className={cn(
|
||||
@ -219,7 +219,7 @@ const Edit = () => {
|
||||
setTab("advance");
|
||||
}}
|
||||
>
|
||||
高级设置
|
||||
{t('advanced.setting')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -234,9 +234,9 @@ const Edit = () => {
|
||||
name="domain"
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "base"}>
|
||||
<FormLabel>域名</FormLabel>
|
||||
<FormLabel>{t('domain')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="请输入域名" {...field} />
|
||||
<Input placeholder={t('domain.not.empty.verify.message')} {...field} />
|
||||
</FormControl>
|
||||
|
||||
<FormMessage />
|
||||
@ -249,12 +249,12 @@ const Edit = () => {
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "base"}>
|
||||
<FormLabel className="flex w-full justify-between">
|
||||
<div>Email(申请证书需要提供邮箱)</div>
|
||||
<div>{t('email') + t('domain.management.edit.email.description')}</div>
|
||||
<EmailsEdit
|
||||
trigger={
|
||||
<div className="font-normal text-primary hover:underline cursor-pointer flex items-center">
|
||||
<Plus size={14} />
|
||||
新增
|
||||
{t('add')}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
@ -268,11 +268,11 @@ const Edit = () => {
|
||||
}}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择邮箱" />
|
||||
<SelectValue placeholder={t('domain.management.edit.email.not.empty.message')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel>邮箱列表</SelectLabel>
|
||||
<SelectLabel>{t('email.list')}</SelectLabel>
|
||||
{(emails.content as EmailsSetting).emails.map(
|
||||
(item) => (
|
||||
<SelectItem key={item} value={item}>
|
||||
@ -295,12 +295,12 @@ const Edit = () => {
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "base"}>
|
||||
<FormLabel className="flex w-full justify-between">
|
||||
<div>DNS 服务商授权配置</div>
|
||||
<div>{t('domain.management.edit.dns.access.label')}</div>
|
||||
<AccessEdit
|
||||
trigger={
|
||||
<div className="font-normal text-primary hover:underline cursor-pointer flex items-center">
|
||||
<Plus size={14} />
|
||||
新增
|
||||
{t('add')}
|
||||
</div>
|
||||
}
|
||||
op="add"
|
||||
@ -315,11 +315,11 @@ const Edit = () => {
|
||||
}}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择授权配置" />
|
||||
<SelectValue placeholder={t('domain.management.edit.access.not.empty.message')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel>服务商授权配置</SelectLabel>
|
||||
<SelectLabel>{t('domain.management.edit.access.label')}</SelectLabel>
|
||||
{accesses
|
||||
.filter((item) => item.usage != "deploy")
|
||||
.map((item) => (
|
||||
@ -351,7 +351,7 @@ const Edit = () => {
|
||||
name="targetType"
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "base"}>
|
||||
<FormLabel>部署服务类型</FormLabel>
|
||||
<FormLabel>{t('domain.management.edit.target.type')}</FormLabel>
|
||||
<FormControl>
|
||||
<Select
|
||||
{...field}
|
||||
@ -361,11 +361,11 @@ const Edit = () => {
|
||||
}}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择部署服务类型" />
|
||||
<SelectValue placeholder={t('domain.management.edit.target.type.not.empty.message')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel>部署服务类型</SelectLabel>
|
||||
<SelectLabel>{t('domain.management.edit.target.type')}</SelectLabel>
|
||||
{targetTypeKeys.map((key) => (
|
||||
<SelectItem key={key} value={key}>
|
||||
<div className="flex items-center space-x-2">
|
||||
@ -392,12 +392,12 @@ const Edit = () => {
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "base"}>
|
||||
<FormLabel className="w-full flex justify-between">
|
||||
<div>部署服务商授权配置</div>
|
||||
<div>{t('domain.management.edit.target.access')}</div>
|
||||
<AccessEdit
|
||||
trigger={
|
||||
<div className="font-normal text-primary hover:underline cursor-pointer flex items-center">
|
||||
<Plus size={14} />
|
||||
新增
|
||||
{t('add')}
|
||||
</div>
|
||||
}
|
||||
op="add"
|
||||
@ -411,12 +411,12 @@ const Edit = () => {
|
||||
}}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择授权配置" />
|
||||
<SelectValue placeholder={t('domain.management.edit.target.access.not.empty.message')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel>
|
||||
服务商授权配置{form.getValues().targetAccess}
|
||||
{t('domain.management.edit.target.access.content.label')} {form.getValues().targetAccess}
|
||||
</SelectLabel>
|
||||
<SelectItem value="emptyId">
|
||||
<div className="flex items-center space-x-2">
|
||||
@ -453,7 +453,7 @@ const Edit = () => {
|
||||
<FormItem hidden={tab != "advance" || targetType != "ssh"}>
|
||||
<FormLabel className="w-full flex justify-between">
|
||||
<div>
|
||||
部署配置组(用于将一个域名证书部署到多个 ssh 主机)
|
||||
{t('domain.management.edit.group.label')}
|
||||
</div>
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
@ -466,7 +466,7 @@ const Edit = () => {
|
||||
}}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="请选择分组" />
|
||||
<SelectValue placeholder={t('domain.management.edit.group.not.empty.message')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="emptyId">
|
||||
@ -511,10 +511,10 @@ const Edit = () => {
|
||||
name="variables"
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "advance"}>
|
||||
<FormLabel>变量</FormLabel>
|
||||
<FormLabel>{t('variables')}</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea
|
||||
placeholder={`可在SSH部署中使用,形如:\nkey=val;\nkey2=val2;`}
|
||||
placeholder={t('domain.management.edit.variables.placeholder')}
|
||||
{...field}
|
||||
className="placeholder:whitespace-pre-wrap"
|
||||
/>
|
||||
@ -530,10 +530,10 @@ const Edit = () => {
|
||||
name="nameservers"
|
||||
render={({ field }) => (
|
||||
<FormItem hidden={tab != "advance"}>
|
||||
<FormLabel>域名服务器</FormLabel>
|
||||
<FormLabel>{t('dns')}</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea
|
||||
placeholder={`自定义域名服务器,多个用分号隔开,如:\n8.8.8.8;\n8.8.4.4;`}
|
||||
placeholder={t('domain.management.edit.dns.placeholder')}
|
||||
{...field}
|
||||
className="placeholder:whitespace-pre-wrap"
|
||||
/>
|
||||
@ -545,7 +545,7 @@ const Edit = () => {
|
||||
/>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button type="submit">保存</Button>
|
||||
<Button type="submit">{t('save')}</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user