Partially translate user settings

pull/436/head
Lorenzo 2025-06-26 00:56:43 +02:00
parent b50121ad0b
commit 0b3472d227
8 changed files with 881 additions and 767 deletions

View File

@ -300,4 +300,48 @@ export default {
nickName: "Nickname", nickName: "Nickname",
max50Chars: "Maximum 50 characters", max50Chars: "Maximum 50 characters",
myInfo: "My Information", myInfo: "My Information",
siteMonitorSettings: "Site Monitor Settings",
notificationChannel: "Notification Channel",
setNotificationChannel: "Set the notification channel",
retryTimes: "Retry Times",
monitorRetryTimes: "Number of retry attempts for monitoring requests",
monitorCronSetting: "Monitoring Schedule",
cronTrigger: "Scheduled trigger for monitoring",
save: "Save",
editSchedule: "Edit Schedule",
timerTrigger: "Timer Trigger",
schedule: "Schedule",
selectCron: "Please select a schedule Cron",
batchEditSchedule: "Batch Edit Schedule",
editTrigger: "Edit Trigger",
triggerName: "Trigger Name",
requiredField: "This field is required",
type: "Type",
enterName: "Please enter a name",
confirmDeleteTrigger: "Are you sure you want to delete this trigger?",
notificationType: "Notification Type",
selectNotificationType: "Please select a notification type",
notificationName: "Notification Name",
helperNotificationName: "Fill freely, helps to distinguish when multiple notifications of the same type exist",
isDefault: "Is Default",
yes: "Yes",
no: "No",
selectIsDefault: "Please select if default",
prompt: "Prompt",
confirmSetDefaultNotification: "Are you sure to set as default notification?",
test: "Test",
scope: "Scope",
scopeOpenApiOnly: "Open API Only",
scopeFullAccount: "Full Account Permissions",
required: "This field is required",
scopeHelper: "Open API only allows access to open APIs; full account permissions allow access to all APIs",
add: "Generate New Key",
gen: {
text: "API Test",
title: "x-certd-token",
okText: "Confirm",
contentPart1: "Test the x-certd-token below, you can use it within 3 minutes to test ",
openApi: "Open API",
contentPart2: " request testing",
},
}; };

View File

@ -306,4 +306,48 @@ export default {
nickName: "昵称", nickName: "昵称",
max50Chars: "最大50个字符", max50Chars: "最大50个字符",
myInfo: "我的信息", myInfo: "我的信息",
siteMonitorSettings: "站点监控设置",
notificationChannel: "通知渠道",
setNotificationChannel: "设置通知渠道",
retryTimes: "重试次数",
monitorRetryTimes: "监控请求重试次数",
monitorCronSetting: "监控定时设置",
cronTrigger: "定时触发监控",
save: "保存",
editSchedule: "修改定时",
timerTrigger: "定时触发",
schedule: "定时",
selectCron: "请选择定时Cron",
batchEditSchedule: "批量修改定时",
editTrigger: "编辑触发器",
triggerName: "触发器名称",
requiredField: "此项必填",
type: "类型",
enterName: "请输入名称",
confirmDeleteTrigger: "确定要删除此触发器吗?",
notificationType: "通知类型",
selectNotificationType: "请选择通知类型",
notificationName: "通知名称",
helperNotificationName: "随便填,当多个相同类型的通知时,便于区分",
isDefault: "是否默认",
yes: "是",
no: "否",
selectIsDefault: "请选择是否默认",
prompt: "提示",
confirmSetDefaultNotification: "确定设置为默认通知?",
test: "测试",
scope: "权限范围",
scopeOpenApiOnly: "仅开放接口",
scopeFullAccount: "账户所有权限",
required: "此项必填",
scopeHelper: "仅开放接口只可以访问开放接口,账户所有权限可以访问所有接口",
add: "生成新的Key",
gen: {
text: "接口测试",
title: "x-certd-token",
okText: "确定",
contentPart1: "测试x-certd-token如下您可以在3分钟内使用它进行",
openApi: "开放接口",
contentPart2: "请求测试",
},
}; };

View File

@ -1,37 +1,41 @@
<template> <template>
<fs-page class="page-user-settings page-site-monitor-setting"> <fs-page class="page-user-settings page-site-monitor-setting">
<template #header> <template #header>
<div class="title">站点监控设置</div> <div class="title">{{ t("certd.siteMonitorSettings") }}</div>
</template> </template>
<div class="user-settings-form settings-form"> <div class="user-settings-form settings-form">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off"> <a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
<a-form-item label="通知渠道" :name="['notificationId']"> autocomplete="off">
<a-form-item :label="t('certd.notificationChannel')" :name="['notificationId']">
<div class="flex"> <div class="flex">
<NotificationSelector v-model="formState.notificationId" /> <NotificationSelector v-model="formState.notificationId" />
</div> </div>
<div class="helper">设置通知渠道</div> <div class="helper">{{ t('certd.setNotificationChannel') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="重试次数" :name="['retryTimes']"> <a-form-item :label="t('certd.retryTimes')" :name="['retryTimes']">
<div class="flex"> <div class="flex">
<a-input-number v-model:value="formState.retryTimes" /> <a-input-number v-model:value="formState.retryTimes" />
</div> </div>
<div class="helper">监控请求重试次数</div> <div class="helper">{{ t('certd.monitorRetryTimes') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="监控定时设置" :name="['cron']"> <a-form-item :label="t('certd.monitorCronSetting')" :name="['cron']">
<div class="flex flex-baseline"> <div class="flex flex-baseline">
<cron-editor v-model="formState.cron" :disabled="!settingsStore.isPlus" :allow-every-min="userStore.isAdmin" /> <cron-editor v-model="formState.cron" :disabled="!settingsStore.isPlus"
:allow-every-min="userStore.isAdmin" />
<vip-button class="ml-5" mode="button"></vip-button> <vip-button class="ml-5" mode="button"></vip-button>
</div> </div>
<div class="helper">定时触发监控</div> <div class="helper">{{ t('certd.cronTrigger') }}</div>
</a-form-item> </a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
<loading-button type="primary" html-type="button" :click="doSave">保存</loading-button> <loading-button type="primary" html-type="button" :click="doSave">{{ t('certd.save')
}}</loading-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
</fs-page> </fs-page>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { reactive } from "vue"; import { reactive } from "vue";
import * as api from "./api"; import * as api from "./api";
@ -41,6 +45,9 @@ import { merge } from "lodash-es";
import { useSettingStore } from "/src/store/settings"; import { useSettingStore } from "/src/store/settings";
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue"; import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const settingsStore = useSettingStore(); const settingsStore = useSettingStore();
const userStore = useUserStore(); const userStore = useUserStore();
@ -63,7 +70,7 @@ const doSave = async (form: any) => {
...formState, ...formState,
}); });
notification.success({ notification.success({
message: "保存成功", message: t("certd.saveSuccess"),
}); });
}; };
</script> </script>

View File

@ -5,6 +5,7 @@ import { forEach, get, merge, set } from "lodash-es";
import { Modal } from "ant-design-vue"; import { Modal } from "ant-design-vue";
import * as api from "/@/views/sys/cname/provider/api"; import * as api from "/@/views/sys/cname/provider/api";
import { mitter } from "/@/utils/util.mitt"; import { mitter } from "/@/utils/util.mitt";
import { useI18n } from "vue-i18n";
export function notificationProvide(api: any) { export function notificationProvide(api: any) {
provide("notificationApi", api); provide("notificationApi", api);
@ -14,6 +15,8 @@ export function notificationProvide(api: any) {
} }
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) { export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
const { t } = useI18n();
const notificationTypeDictRef = dict({ const notificationTypeDictRef = dict({
url: "/pi/notification/getTypeDict", url: "/pi/notification/getTypeDict",
}); });
@ -48,7 +51,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
if (!column.rules) { if (!column.rules) {
column.rules = []; column.rules = [];
} }
column.rules.push({ required: true, message: "此项必填" }); column.rules.push({ required: true, message: t("certd.requiredField") });
} }
//设置默认值 //设置默认值
@ -76,7 +79,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
}, },
}, },
type: { type: {
title: "通知类型", title: t("certd.notificationType"),
type: "dict-select", type: "dict-select",
dict: notificationTypeDictRef, dict: notificationTypeDictRef,
search: { search: {
@ -110,7 +113,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
); );
}, },
}, },
rules: [{ required: true, message: "请选择通知类型" }], rules: [{ required: true, message: t("certd.selectNotificationType") }],
valueChange: { valueChange: {
immediate: true, immediate: true,
async handle({ value, mode, form, immediate }) { async handle({ value, mode, form, immediate }) {
@ -145,31 +148,31 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
}, },
} as ColumnCompositionProps, } as ColumnCompositionProps,
name: { name: {
title: "通知名称", title: t("certd.notificationName"),
search: { search: {
show: true, show: true,
}, },
type: ["text"], type: ["text"],
form: { form: {
rules: [{ required: true, message: "请填写名称" }], rules: [{ required: true, message: t("certd.enterName") }],
helper: "随便填,当多个相同类型的通知时,便于区分", helper: t("certd.helperNotificationName"),
}, },
column: { column: {
width: 200, width: 200,
}, },
}, },
isDefault: { isDefault: {
title: "是否默认", title: t("certd.isDefault"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "是", value: true, color: "success" }, { label: t("certd.yes"), value: true, color: "success" },
{ label: "否", value: false, color: "default" }, { label: t("certd.no"), value: false, color: "default" },
], ],
}), }),
form: { form: {
value: false, value: false,
rules: [{ required: true, message: "请选择是否默认" }], rules: [{ required: true, message: t("certd.selectIsDefault") }],
order: 999, order: 999,
}, },
column: { column: {
@ -184,8 +187,8 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
on: { on: {
change({ row }) { change({ row }) {
Modal.confirm({ Modal.confirm({
title: "提示", title: t("certd.prompt"),
content: "确定设置为默认通知?", content: t("certd.confirmSetDefaultNotification"),
onOk: async () => { onOk: async () => {
await api.SetDefault(row.id); await api.SetDefault(row.id);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
@ -200,7 +203,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
}, },
} as ColumnCompositionProps, } as ColumnCompositionProps,
test: { test: {
title: "测试", title: t("certd.test"),
form: { form: {
show: compute(({ form }) => { show: compute(({ form }) => {
return !!form.type; return !!form.type;

View File

@ -56,7 +56,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
actionbar: { actionbar: {
buttons: { buttons: {
add: { add: {
text: "生成新的Key", text: t("certd.actionbar.add"),
}, },
}, },
}, },
@ -69,7 +69,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
edit: { show: false }, edit: { show: false },
remove: { show: true }, remove: { show: true },
gen: { gen: {
text: "接口测试", text: t("certd.gen.text"),
size: "mini", size: "mini",
icon: "devicon-plain:vitest", icon: "devicon-plain:vitest",
type: "primary", type: "primary",
@ -77,19 +77,19 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const apiToken = await api.GetApiToken(row.id); const apiToken = await api.GetApiToken(row.id);
model.success({ model.success({
title: "x-certd-token", title: t("certd.gen.title"),
maskClosable: true, maskClosable: true,
okText: "确定", okText: t("certd.gen.okText"),
width: 600, width: 600,
content: () => { content: () => {
return ( return (
<div> <div>
<div class={"m-10 p-10"}> <div class={"m-10 p-10"}>
x-certd-token3使 {t("certd.gen.contentPart1")}
<a href={OPEN_API_DOC} target={"_blank"}> <a href={OPEN_API_DOC} target={"_blank"}>
{t("certd.gen.openApi")}
</a> </a>
{t("certd.gen.contentPart2")}
</div> </div>
<div class={"m-10 p-10"} style={{ border: "1px solid #333" }}> <div class={"m-10 p-10"} style={{ border: "1px solid #333" }}>
<fs-copyable model-value={apiToken}></fs-copyable> <fs-copyable model-value={apiToken}></fs-copyable>
@ -146,19 +146,19 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
scope: { scope: {
title: "权限范围", title: t("certd.scope"),
type: "dict-radio", type: "dict-radio",
dict: dict({ dict: dict({
data: [ data: [
{ label: "仅开放接口", value: "open", color: "blue" }, { label: t("certd.scopeOpenApiOnly"), value: "open", color: "blue" },
{ label: "账户所有权限", value: "user", color: "red" }, { label: t("certd.scopeFullAccount"), value: "user", color: "red" },
], ],
}), }),
form: { form: {
value: "open", value: "open",
show: true, show: true,
rules: [{ required: true, message: "此项必填" }], rules: [{ required: true, message: t("certd.required") }],
helper: "仅开放接口只可以访问开放接口,账户所有权限可以访问所有接口", helper: t("certd.scopeHelper"),
component: { component: {
vModel: "value", vModel: "value",
}, },
@ -170,7 +170,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
createTime: { createTime: {
title: "创建时间", title: t("certd.fields.createTime"),
type: "datetime", type: "datetime",
search: { search: {
show: false, show: false,
@ -179,6 +179,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: false, show: false,
}, },
}, },
}, },
}, },
}; };

View File

@ -1,9 +1,15 @@
<template> <template>
<fs-button icon="mdi:format-list-group" type="link" text="修改定时" @click="openFormDialog"></fs-button> <fs-button icon="mdi:format-list-group" type="link" :text="t('certd.editSchedule')"
@click="openFormDialog"></fs-button>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as api from "../api"; import * as api from "../api";
import { useFormWrapper } from "@fast-crud/fast-crud"; import { useFormWrapper } from "@fast-crud/fast-crud";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
selectedRowKeys: any[]; selectedRowKeys: any[];
@ -21,19 +27,20 @@ async function batchUpdateRequest(form: any) {
emit("change"); emit("change");
} }
const { openCrudFormDialog } = useFormWrapper(); const { openCrudFormDialog } = useFormWrapper();
async function openFormDialog() { async function openFormDialog() {
const crudOptions: any = { const crudOptions: any = {
columns: { columns: {
"props.cron": { "props.cron": {
title: "定时", title: t("certd.schedule"),
form: { form: {
component: { component: {
name: "cron-editor", name: "cron-editor",
vModel: "modelValue", vModel: "modelValue",
}, },
rules: [{ required: true, message: "请选择定时Cron" }], rules: [{ required: true, message: t("certd.selectCron") }],
}, },
}, },
}, },
@ -52,10 +59,11 @@ async function openFormDialog() {
}, },
}, },
wrapper: { wrapper: {
title: "批量修改定时", title: t("certd.batchEditSchedule"),
width: 600, width: 600,
}, },
}, },
} as any; } as any;
await openCrudFormDialog({ crudOptions }); await openCrudFormDialog({ crudOptions });
} }

View File

@ -3,7 +3,7 @@
class="pi-trigger-form" @after-open-change="triggerDrawerOnAfterVisibleChange"> class="pi-trigger-form" @after-open-change="triggerDrawerOnAfterVisibleChange">
<template #title> <template #title>
<div> <div>
编辑触发器 {{ t("certd.editTrigger") }}
<a-button v-if="mode === 'edit'" @click="triggerDelete()"> <a-button v-if="mode === 'edit'" @click="triggerDelete()">
<template #icon> <template #icon>
<DeleteOutlined /> <DeleteOutlined />
@ -16,27 +16,28 @@
<a-form ref="triggerFormRef" class="trigger-form" :model="currentTrigger" :label-col="labelCol" <a-form ref="triggerFormRef" class="trigger-form" :model="currentTrigger" :label-col="labelCol"
:wrapper-col="wrapperCol"> :wrapper-col="wrapperCol">
<fs-form-item v-model="currentTrigger.title" :item="{ <fs-form-item v-model="currentTrigger.title" :item="{
title: '触发器名称', title: t('certd.triggerName'),
key: 'title', key: 'title',
component: { component: {
name: 'a-input', name: 'a-input',
vModel: 'value', vModel: 'value',
disabled: !editMode, disabled: !editMode,
}, },
rules: [{ required: true, message: '此项必填' }], rules: [{ required: true, message: t('certd.requiredField') }],
}" /> }" />
<fs-form-item v-model="currentTrigger.type" :item="{ <fs-form-item v-model="currentTrigger.type" :item="{
title: '类型', title: t('certd.type'),
key: 'type', key: 'type',
value: 'timer', value: 'timer',
component: { component: {
name: 'a-select', name: 'a-select',
vModel: 'value', vModel: 'value',
disabled: !editMode, disabled: !editMode,
options: [{ value: 'timer', label: '定时' }], options: [{ value: 'timer', label: t('certd.schedule') }],
}, },
rules: [{ required: true, message: '此项必填' }], rules: [{ required: true, message: t('certd.requiredField') }],
}" /> }" />
<fs-form-item v-model="currentTrigger.props.cron" :item="{ <fs-form-item v-model="currentTrigger.props.cron" :item="{
@ -93,11 +94,12 @@ export default {
{ {
type: "string", type: "string",
required: true, required: true,
message: "请输入名称", message: t("certd.enterName"),
}, },
], ],
}); });
const triggerDrawerShow = () => { const triggerDrawerShow = () => {
triggerDrawerVisible.value = true; triggerDrawerVisible.value = true;
}; };
@ -118,10 +120,11 @@ export default {
const triggerAdd = emit => { const triggerAdd = emit => {
mode.value = "add"; mode.value = "add";
const trigger = { id: nanoid(), title: "定时触发", type: "timer", props: {} }; const trigger = { id: nanoid(), title: t("certd.timerTrigger"), type: "timer", props: {} };
triggerOpen(trigger, emit); triggerOpen(trigger, emit);
}; };
const triggerEdit = (trigger, emit) => { const triggerEdit = (trigger, emit) => {
mode.value = "edit"; mode.value = "edit";
triggerOpen(trigger, emit); triggerOpen(trigger, emit);
@ -147,8 +150,8 @@ export default {
const triggerDelete = () => { const triggerDelete = () => {
Modal.confirm({ Modal.confirm({
title: "确认", title: t("certd.confirm"),
content: `确定要删除此触发器吗?`, content: t("certd.confirmDeleteTrigger"),
async onOk() { async onOk() {
callback.value("delete"); callback.value("delete");
triggerDrawerClose(); triggerDrawerClose();
@ -156,6 +159,7 @@ export default {
}); });
}; };
const blankFn = () => { const blankFn = () => {
return {}; return {};
}; };

View File

@ -4,8 +4,11 @@ import { useUserStore } from "/@/store/user";
import { Modal, notification } from "ant-design-vue"; import { Modal, notification } from "ant-design-vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { useI18n } from "vue-i18n";
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query); return await api.GetList(query);
}; };
@ -124,11 +127,11 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
nickName: { nickName: {
title: "昵称", title: t("certd.nickName"),
type: "text", type: "text",
search: { show: true }, // 开启查询 search: { show: true }, // 开启查询
form: { form: {
rules: [{ max: 50, message: "最大50个字符" }], rules: [{ max: 50, message: t("certd.max50Chars") }],
}, },
column: { column: {
sorter: true, sorter: true,