diff --git a/ui/src/locales/zh_cn.yaml b/ui/src/locales/zh_cn.yaml index 570a222a..469cf98f 100644 --- a/ui/src/locales/zh_cn.yaml +++ b/ui/src/locales/zh_cn.yaml @@ -186,44 +186,65 @@ myProfileView: profileIsDefaultImagePrivateTrue: "是" profileIsDefaultImagePrivateFalse: "否" myPatView: - myPATCreateButton: "创建令牌" - myPATTablePATId: "令牌ID" - myPATTablePATName: "令牌名" - myPATTableCreateTime: "创建时间" - myPATTableExpireTime: "过期时间" - myPATTableOpsTitle: "操作" - myPATTableOpsEdit: "编辑" - myPATTableOpsDelete: "删除" - myPATCreateDialogTitle: "创建令牌" - myPATCreateDialogPATName: "令牌名" - myPATCreateDialogPATNameRequirements: "令牌名不能为空" - myPATCreateDialogPATDesc: "令牌描述" - myPATCreateDialogPATExpireTime: "过期时间" - myPATCreateDialogPATExpireTimeRequirements: "过期时间不能为空" - myPATCreateDialogCancelButton: "取消" - myPATCreateDialogSubmitButton: "创建" - myPATCreateDialogSuccessTitle: "创建成功" - myPATCreateDialogFailedTitle: "创建失败" - myPATTokenDisplayDialogTitle: "令牌信息" - myPATTokenDisplayDialogToken: "令牌值" - myPATTokenDisplayDialogCopyButton: "复制" - myPATTokenDisplayDialogCopySuccessTitle: "复制成功" - myPATTokenDisplayDialogCopySuccessContent: "令牌已复制到剪贴板" - myPATDeleteConfirmDialogTitle: "确认删除" - myPATDeleteConfirmDialogWarningTitle: "你确定要删除这个令牌吗?" - myPATDeleteConfirmDialogWarningContent: "真的会删除,对应令牌会立刻失效" - myPATDeleteConfirmDialogCancelButton: "取消" - myPATDeleteConfirmDialogSubmitButton: "确认删除" - myPATDeleteConfirmDialogSuccessTitle: "删除成功" - myPATDeleteConfirmDialogFailedTitle: "删除失败" - myPATEditDialogTitle: "修改令牌" - myPATEditDialogPATName: "令牌名" - myPATEditDialogPATDesc: "令牌描述" - myPATEditDialogCancelButton: "取消" - myPATEditDialogSubmitButton: "修改" - myPATEditDialogSuccessTitle: "修改成功" - myPATEditDialogFailedTitle: "修改失败" - myPATEditDialogValidationFailedMessage: "令牌名和描述不能同时为空" + toolbar: + createButton: "创建令牌" + table: + patId: "令牌ID" + patName: "令牌名" + createTime: "创建时间" + expireTime: "过期时间" + ops: + title: "操作" + edit: "编辑" + delete: "删除" + create: + dialog: + title: "创建令牌" + form: + patName: "令牌名" + description: "令牌描述" + expireTime: "过期时间" + cancelButton: "取消" + submitButton: "创建" + verify: + patName: + required: "令牌名不能为空" + expireTime: + required: "过期时间不能为空" + toast: + successTitle: "创建成功" + failedTitle: "创建失败" + createdDetail: + dialog: + title: "令牌信息" + token: "令牌值" + copyButton: "复制" + toast: + copySuccessTitle: "复制成功" + copySuccessContent: "令牌已复制到剪贴板" + delete: + dialog: + title: "确认删除" + warningTitle: "你确定要删除这个令牌吗?" + warningContent: "真的会删除,对应令牌会立刻失效" + cancelButton: "取消" + submitButton: "确认删除" + toast: + successTitle: "删除成功" + failedTitle: "删除失败" + edit: + dialog: + title: "修改令牌" + form: + patName: "令牌名" + patDescription: "令牌描述" + cancelButton: "取消" + submitButton: "修改" + verify: + atLeastOneField: "令牌名和描述不能同时为空" + toast: + successTitle: "修改成功" + failedTitle: "修改失败" adminField: menu: overview: "概览" diff --git a/ui/src/views/userField/pat/MyPersonalAccessTokenView.vue b/ui/src/views/userField/pat/MyPersonalAccessTokenView.vue index aef12833..546dc938 100644 --- a/ui/src/views/userField/pat/MyPersonalAccessTokenView.vue +++ b/ui/src/views/userField/pat/MyPersonalAccessTokenView.vue @@ -11,6 +11,7 @@ import { type PersonalAccessTokenInsertRequest, type PersonalAccessTokenPatchRequest } from "api-client"; +import Toolbar from "primevue/toolbar"; import Button from "primevue/button"; import InputText from "primevue/inputtext"; import FloatLabel from "primevue/floatlabel"; @@ -92,9 +93,9 @@ const createFormInitialValues = reactive({ const createFormResolver = yupResolver( yup.object({ - name: yup.string().trim().required(t("myPatView.myPATCreateDialogPATNameRequirements")), + name: yup.string().trim().required(t("myPatView.create.dialog.form.verify.patName.required")), description: yup.string().trim(), - expireTime: yup.date().required(t("myPatView.myPATCreateDialogPATExpireTimeRequirements")), + expireTime: yup.date().required(t("myPatView.create.dialog.form.verify.expireTime.required")), permissions: yup.array().of(yup.string()) }) ); @@ -109,14 +110,14 @@ const editFormResolver = yupResolver( name: yup .string() .trim() - .test("not-both-empty", t("myPatView.myPATEditDialogValidationFailedMessage"), function (value) { + .test("not-both-empty", t("myPatView.edit.dialog.form.verify.atLeastOneField"), function (value) { const { description } = this.parent; return !isEmpty(value) || !isEmpty(description); }), description: yup .string() .trim() - .test("not-both-empty", t("myPatView.myPATEditDialogValidationFailedMessage"), function (value) { + .test("not-both-empty", t("myPatView.edit.dialog.form.verify.atLeastOneField"), function (value) { const { name } = this.parent; return !isEmpty(value) || !isEmpty(name); }) @@ -157,8 +158,8 @@ function copyAndCloseTokenDisplayDialog() { navigator.clipboard.writeText(curCreatedToken.value).then(() => { toast.add({ severity: "success", - summary: t("myPatView.myPATTokenDisplayDialogCopySuccessTitle"), - detail: t("myPatView.myPATTokenDisplayDialogCopySuccessContent"), + summary: t("myPatView.createdDetail.dialog.toast.copySuccessTitle"), + detail: t("myPatView.createdDetail.dialog.toast.copySuccessContent"), life: 3000 }); closeTokenDisplayDialog(); @@ -198,7 +199,7 @@ async function createPAT(insertRequest: PersonalAccessTokenInsertRequest): Promi if (resp.isSuccessful) { toast.add({ severity: "success", - summary: t("myPatView.myPATCreateDialogSuccessTitle"), + summary: t("myPatView.create.toast.successTitle"), detail: resp.message, life: 3000 }); @@ -208,7 +209,7 @@ async function createPAT(insertRequest: PersonalAccessTokenInsertRequest): Promi } toast.add({ severity: "warn", - summary: t("myPatView.myPATCreateDialogFailedTitle"), + summary: t("myPatView.create.toast.failedTitle"), detail: resp.message, life: 3000 }); @@ -218,7 +219,7 @@ async function createPAT(insertRequest: PersonalAccessTokenInsertRequest): Promi console.error(error); toast.add({ severity: "error", - summary: t("myPatView.myPATCreateDialogFailedTitle"), + summary: "Error", detail: error.message, life: 3000 }); @@ -234,7 +235,7 @@ function deletePAT(patId: number) { if (resp.isSuccessful) { toast.add({ severity: "success", - summary: t("myPatView.myPATDeleteConfirmDialogSuccessTitle"), + summary: t("myPatView.delete.toast.successTitle"), detail: resp.message, life: 3000 }); @@ -242,7 +243,7 @@ function deletePAT(patId: number) { } else { toast.add({ severity: "warn", - summary: t("myPatView.myPATDeleteConfirmDialogFailedTitle"), + summary: t("myPatView.delete.toast.failedTitle"), detail: resp.message, life: 3000 }); @@ -252,7 +253,7 @@ function deletePAT(patId: number) { console.error(error); toast.add({ severity: "error", - summary: t("myPatView.myPATDeleteConfirmDialogFailedTitle"), + summary: "Error", detail: error.message, life: 3000 }); @@ -271,7 +272,7 @@ async function patchPAT(patId: number, patchRequest: PersonalAccessTokenPatchReq if (resp.isSuccessful) { toast.add({ severity: "success", - summary: t("myPatView.myPATEditDialogSuccessTitle"), + summary: t("myPatView.edit.toast.successTitle"), detail: resp.message, life: 3000 }); @@ -279,7 +280,7 @@ async function patchPAT(patId: number, patchRequest: PersonalAccessTokenPatchReq } else { toast.add({ severity: "warn", - summary: t("myPatView.myPATEditDialogFailedTitle"), + summary: t("myPatView.edit.toast.failedTitle"), detail: resp.message, life: 3000 }); @@ -333,17 +334,17 @@ async function fetchSelfRoles(): Promise {