Skip to content

Commit

Permalink
Merge branch 'l123wx-local_deployment_translate'
Browse files Browse the repository at this point in the history
  • Loading branch information
usual2970 committed Sep 29, 2024
2 parents 5160b4c + 7f5ff6f commit 3375839
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 46 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ui/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Certimate - Your Trusted SSL Automation Partner</title>
<script type="module" crossorigin src="/assets/index-TzNEc_kS.js"></script>
<script type="module" crossorigin src="/assets/index--un-5Tw_.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-I--T0qY3.css">
</head>
<body class="bg-background">
Expand Down
34 changes: 18 additions & 16 deletions ui/src/components/certimate/AccessLocalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useConfig } from "@/providers/config";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { useTranslation } from "react-i18next";
import {
Form,
FormControl,
Expand All @@ -32,15 +33,16 @@ const AccessLocalForm = ({
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess, reloadAccessGroups } = useConfig();
const { t } = useTranslation();

const formSchema = z.object({
id: z.string().optional(),
name: z.string().min(1).max(64),
name: z.string().min(1, 'access.form.name.not.empty').max(64, t('zod.rule.string.max', { max: 64 })),
configType: accessFormType,

command: z.string().min(1).max(2048),
certPath: z.string().min(0).max(2048),
keyPath: z.string().min(0).max(2048),
command: z.string().min(1, 'access.form.ssh.command.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
certPath: z.string().min(0, 'access.form.ssh.cert.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
keyPath: z.string().min(0, 'access.form.ssh.key.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
});

let config: LocalConfig = {
Expand All @@ -54,7 +56,7 @@ const AccessLocalForm = ({
resolver: zodResolver(formSchema),
defaultValues: {
id: data?.id,
name: data?.name,
name: data?.name || '',
configType: "local",
certPath: config.certPath,
keyPath: config.keyPath,
Expand Down Expand Up @@ -123,9 +125,9 @@ const AccessLocalForm = ({
name="name"
render={({ field }) => (
<FormItem>
<FormLabel>名称</FormLabel>
<FormLabel>{t('name')}</FormLabel>
<FormControl>
<Input placeholder="请输入授权名称" {...field} />
<Input placeholder={t('access.form.name.not.empty')} {...field} />
</FormControl>

<FormMessage />
Expand All @@ -138,7 +140,7 @@ const AccessLocalForm = ({
name="id"
render={({ field }) => (
<FormItem className="hidden">
<FormLabel>配置类型</FormLabel>
<FormLabel>{t('access.form.config.field')}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
Expand All @@ -153,7 +155,7 @@ const AccessLocalForm = ({
name="configType"
render={({ field }) => (
<FormItem className="hidden">
<FormLabel>配置类型</FormLabel>
<FormLabel>{t('access.form.config.field')}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
Expand All @@ -168,9 +170,9 @@ const AccessLocalForm = ({
name="certPath"
render={({ field }) => (
<FormItem>
<FormLabel>证书保存路径</FormLabel>
<FormLabel>{t('access.form.ssh.cert.path')}</FormLabel>
<FormControl>
<Input placeholder="请输入证书上传路径" {...field} />
<Input placeholder={t('access.form.ssh.cert.path.not.empty')} {...field} />
</FormControl>

<FormMessage />
Expand All @@ -183,9 +185,9 @@ const AccessLocalForm = ({
name="keyPath"
render={({ field }) => (
<FormItem>
<FormLabel>私钥保存路径</FormLabel>
<FormLabel>{t('access.form.ssh.key.path')}</FormLabel>
<FormControl>
<Input placeholder="请输入私钥上传路径" {...field} />
<Input placeholder={t('access.form.ssh.key.path.not.empty')} {...field} />
</FormControl>

<FormMessage />
Expand All @@ -198,9 +200,9 @@ const AccessLocalForm = ({
name="command"
render={({ field }) => (
<FormItem>
<FormLabel>Command</FormLabel>
<FormLabel>{t('access.form.ssh.command')}</FormLabel>
<FormControl>
<Textarea placeholder="请输入要执行的命令" {...field} />
<Textarea placeholder={t('access.form.ssh.command.not.empty')} {...field} />
</FormControl>

<FormMessage />
Expand All @@ -211,7 +213,7 @@ const AccessLocalForm = ({
<FormMessage />

<div className="flex justify-end">
<Button type="submit">保存</Button>
<Button type="submit">{t('save')}</Button>
</div>
</form>
</Form>
Expand Down
9 changes: 4 additions & 5 deletions ui/src/components/certimate/AccessSSHForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const AccessSSHForm = ({
password: z.string().min(0, 'password.not.empty').max(64, t('zod.rule.string.max', { max: 64 })),
key: z.string().min(0, 'access.form.ssh.key.not.empty').max(20480, t('zod.rule.string.max', { max: 20480 })),
keyFile: z.any().optional(),
preCommand: z.string().min(0).max(2048).optional(),

preCommand: z.string().min(0).max(2048, t('zod.rule.string.max', { max: 2048 })).optional(),
command: z.string().min(1, 'access.form.ssh.command.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
certPath: z.string().min(0, 'access.form.ssh.cert.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
keyPath: z.string().min(0, 'access.form.ssh.key.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
Expand Down Expand Up @@ -122,7 +122,6 @@ const AccessSSHForm = ({
});

const onSubmit = async (data: z.infer<typeof formSchema>) => {
console.log(data);
let group = data.group;
if (group == "emptyId") group = "";

Expand Down Expand Up @@ -480,9 +479,9 @@ const AccessSSHForm = ({
name="preCommand"
render={({ field }) => (
<FormItem>
<FormLabel>前置 Command</FormLabel>
<FormLabel>{t('access.form.ssh.pre.command')}</FormLabel>
<FormControl>
<Textarea placeholder="请输入要在部署证书前执行的前置命令" {...field} />
<Textarea placeholder={t('access.form.ssh.pre.command.not.empty')} {...field} />
</FormControl>

<FormMessage />
Expand Down
2 changes: 1 addition & 1 deletion ui/src/domain/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const accessTypeMap: Map<string, [string, string]> = new Map([
["qiniu", ["qiniu", "/imgs/providers/qiniu.svg"]],
["ssh", ["ssh", "/imgs/providers/ssh.svg"]],
["webhook", ["webhook", "/imgs/providers/webhook.svg"]],
["local", ["local", "/imgs/providers/local.svg"]],
["local", ["local.deployment", "/imgs/providers/local.svg"]],
]);

export const getProviderInfo = (t: string) => {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/domain/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const targetTypeMap: Map<string, [string, string]> = new Map([
["ssh", ["ssh", "/imgs/providers/ssh.svg"]],
["qiniu-cdn", ["qiniu.cdn", "/imgs/providers/qiniu.svg"]],
["webhook", ["webhook", "/imgs/providers/webhook.svg"]],
["local", ["local", "/imgs/providers/local.svg"]],
["local", ["local.deployment", "/imgs/providers/local.svg"]],
]);

export const targetTypeKeys = Array.from(targetTypeMap.keys());
2 changes: 1 addition & 1 deletion ui/src/domain/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "Certimate v0.1.12";
export const version = "Certimate v0.1.14";
12 changes: 7 additions & 5 deletions ui/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"ding.talk": "Ding Talk",
"telegram": "Telegram",
"webhook": "Webhook",
"local": "Local Deployment",
"local.deployment": "Local Deployment",
"tencent": "Tencent",
"tencent.cdn": "Tencent-CDN",
"aliyun": "Alibaba Cloud",
Expand Down Expand Up @@ -200,10 +200,12 @@
"access.form.ssh.key": "Key (Log in using certificate)",
"access.form.ssh.key.not.empty": "Please enter Key",
"access.form.ssh.key.file.not.empty": "Please select file",
"access.form.ssh.cert.path": "Certificate Upload Path",
"access.form.ssh.cert.path.not.empty": "Please enter certificate upload path",
"access.form.ssh.key.path": "Private Key Upload Path",
"access.form.ssh.key.path.not.empty": "Please enter private key upload path",
"access.form.ssh.cert.path": "Certificate Save Path",
"access.form.ssh.cert.path.not.empty": "Please enter certificate save path",
"access.form.ssh.key.path": "Private Key Save Path",
"access.form.ssh.key.path.not.empty": "Please enter private key save path",
"access.form.ssh.pre.command": "Pre-deployment Command",
"access.form.ssh.pre.command.not.empty": "Command to be executed before deploying the certificate",
"access.form.ssh.command": "Command",
"access.form.ssh.command.not.empty": "Please enter command",
"access.form.ding.access.token.placeholder": "Signature for signed addition"
Expand Down
12 changes: 7 additions & 5 deletions ui/src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"ding.talk": "钉钉",
"telegram": "Telegram",
"webhook": "Webhook",
"local": "本地部署",
"local.deployment": "本地部署",
"tencent": "腾讯云",
"tencent.cdn": "腾讯云-CDN",
"aliyun": "阿里云",
Expand Down Expand Up @@ -200,10 +200,12 @@
"access.form.ssh.key": "Key(使用证书登录)",
"access.form.ssh.key.not.empty": "请输入 Key",
"access.form.ssh.key.file.not.empty": "请选择文件",
"access.form.ssh.cert.path": "证书上传路径",
"access.form.ssh.cert.path.not.empty": "请输入证书上传路径",
"access.form.ssh.key.path": "私钥上传路径",
"access.form.ssh.key.path.not.empty": "请输入私钥上传路径",
"access.form.ssh.cert.path": "证书保存路径",
"access.form.ssh.cert.path.not.empty": "请输入证书保存路径",
"access.form.ssh.key.path": "私钥保存路径",
"access.form.ssh.key.path.not.empty": "请输入私钥保存路径",
"access.form.ssh.pre.command": "前置 Command",
"access.form.ssh.pre.command.not.empty": "在部署证书前执行的前置命令",
"access.form.ssh.command": "Command",
"access.form.ssh.command.not.empty": "请输入要执行的命令",
"access.form.ding.access.token.placeholder": "加签的签名"
Expand Down

0 comments on commit 3375839

Please sign in to comment.