mirror of https://github.com/certd/certd
Partially translate user settings
parent
b50121ad0b
commit
0b3472d227
|
@ -300,4 +300,48 @@ export default {
|
|||
nickName: "Nickname",
|
||||
max50Chars: "Maximum 50 characters",
|
||||
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",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -306,4 +306,48 @@ export default {
|
|||
nickName: "昵称",
|
||||
max50Chars: "最大50个字符",
|
||||
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: "请求测试",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,37 +1,41 @@
|
|||
<template>
|
||||
<fs-page class="page-user-settings page-site-monitor-setting">
|
||||
<template #header>
|
||||
<div class="title">站点监控设置</div>
|
||||
<div class="title">{{ t("certd.siteMonitorSettings") }}</div>
|
||||
</template>
|
||||
<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-item label="通知渠道" :name="['notificationId']">
|
||||
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
|
||||
autocomplete="off">
|
||||
<a-form-item :label="t('certd.notificationChannel')" :name="['notificationId']">
|
||||
<div class="flex">
|
||||
<NotificationSelector v-model="formState.notificationId" />
|
||||
</div>
|
||||
<div class="helper">设置通知渠道</div>
|
||||
<div class="helper">{{ t('certd.setNotificationChannel') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="重试次数" :name="['retryTimes']">
|
||||
<a-form-item :label="t('certd.retryTimes')" :name="['retryTimes']">
|
||||
<div class="flex">
|
||||
<a-input-number v-model:value="formState.retryTimes" />
|
||||
</div>
|
||||
<div class="helper">监控请求重试次数</div>
|
||||
<div class="helper">{{ t('certd.monitorRetryTimes') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="监控定时设置" :name="['cron']">
|
||||
<a-form-item :label="t('certd.monitorCronSetting')" :name="['cron']">
|
||||
<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>
|
||||
</div>
|
||||
<div class="helper">定时触发监控</div>
|
||||
<div class="helper">{{ t('certd.cronTrigger') }}</div>
|
||||
</a-form-item>
|
||||
<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>
|
||||
</div>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { reactive } from "vue";
|
||||
import * as api from "./api";
|
||||
|
@ -41,6 +45,9 @@ import { merge } from "lodash-es";
|
|||
import { useSettingStore } from "/src/store/settings";
|
||||
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const settingsStore = useSettingStore();
|
||||
const userStore = useUserStore();
|
||||
|
@ -63,7 +70,7 @@ const doSave = async (form: any) => {
|
|||
...formState,
|
||||
});
|
||||
notification.success({
|
||||
message: "保存成功",
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -5,6 +5,7 @@ import { forEach, get, merge, set } from "lodash-es";
|
|||
import { Modal } from "ant-design-vue";
|
||||
import * as api from "/@/views/sys/cname/provider/api";
|
||||
import { mitter } from "/@/utils/util.mitt";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export function notificationProvide(api: any) {
|
||||
provide("notificationApi", api);
|
||||
|
@ -14,6 +15,8 @@ export function notificationProvide(api: any) {
|
|||
}
|
||||
|
||||
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
const { t } = useI18n();
|
||||
|
||||
const notificationTypeDictRef = dict({
|
||||
url: "/pi/notification/getTypeDict",
|
||||
});
|
||||
|
@ -48,7 +51,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
|||
if (!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: {
|
||||
title: "通知类型",
|
||||
title: t("certd.notificationType"),
|
||||
type: "dict-select",
|
||||
dict: notificationTypeDictRef,
|
||||
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: {
|
||||
immediate: true,
|
||||
async handle({ value, mode, form, immediate }) {
|
||||
|
@ -145,31 +148,31 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
|||
},
|
||||
} as ColumnCompositionProps,
|
||||
name: {
|
||||
title: "通知名称",
|
||||
title: t("certd.notificationName"),
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
type: ["text"],
|
||||
form: {
|
||||
rules: [{ required: true, message: "请填写名称" }],
|
||||
helper: "随便填,当多个相同类型的通知时,便于区分",
|
||||
rules: [{ required: true, message: t("certd.enterName") }],
|
||||
helper: t("certd.helperNotificationName"),
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
isDefault: {
|
||||
title: "是否默认",
|
||||
title: t("certd.isDefault"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "是", value: true, color: "success" },
|
||||
{ label: "否", value: false, color: "default" },
|
||||
{ label: t("certd.yes"), value: true, color: "success" },
|
||||
{ label: t("certd.no"), value: false, color: "default" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
rules: [{ required: true, message: "请选择是否默认" }],
|
||||
rules: [{ required: true, message: t("certd.selectIsDefault") }],
|
||||
order: 999,
|
||||
},
|
||||
column: {
|
||||
|
@ -184,8 +187,8 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
|||
on: {
|
||||
change({ row }) {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定设置为默认通知?",
|
||||
title: t("certd.prompt"),
|
||||
content: t("certd.confirmSetDefaultNotification"),
|
||||
onOk: async () => {
|
||||
await api.SetDefault(row.id);
|
||||
await crudExpose.doRefresh();
|
||||
|
@ -200,7 +203,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
|||
},
|
||||
} as ColumnCompositionProps,
|
||||
test: {
|
||||
title: "测试",
|
||||
title: t("certd.test"),
|
||||
form: {
|
||||
show: compute(({ form }) => {
|
||||
return !!form.type;
|
||||
|
|
|
@ -56,7 +56,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
actionbar: {
|
||||
buttons: {
|
||||
add: {
|
||||
text: "生成新的Key",
|
||||
text: t("certd.actionbar.add"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -69,7 +69,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
edit: { show: false },
|
||||
remove: { show: true },
|
||||
gen: {
|
||||
text: "接口测试",
|
||||
text: t("certd.gen.text"),
|
||||
size: "mini",
|
||||
icon: "devicon-plain:vitest",
|
||||
type: "primary",
|
||||
|
@ -77,19 +77,19 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
const apiToken = await api.GetApiToken(row.id);
|
||||
|
||||
model.success({
|
||||
title: "x-certd-token",
|
||||
title: t("certd.gen.title"),
|
||||
maskClosable: true,
|
||||
okText: "确定",
|
||||
okText: t("certd.gen.okText"),
|
||||
width: 600,
|
||||
content: () => {
|
||||
return (
|
||||
<div>
|
||||
<div class={"m-10 p-10"}>
|
||||
测试x-certd-token如下,您可以在3分钟内使用它进行
|
||||
{t("certd.gen.contentPart1")}
|
||||
<a href={OPEN_API_DOC} target={"_blank"}>
|
||||
开放接口
|
||||
{t("certd.gen.openApi")}
|
||||
</a>
|
||||
请求测试
|
||||
{t("certd.gen.contentPart2")}
|
||||
</div>
|
||||
<div class={"m-10 p-10"} style={{ border: "1px solid #333" }}>
|
||||
<fs-copyable model-value={apiToken}></fs-copyable>
|
||||
|
@ -146,19 +146,19 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
},
|
||||
scope: {
|
||||
title: "权限范围",
|
||||
title: t("certd.scope"),
|
||||
type: "dict-radio",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "仅开放接口", value: "open", color: "blue" },
|
||||
{ label: "账户所有权限", value: "user", color: "red" },
|
||||
{ label: t("certd.scopeOpenApiOnly"), value: "open", color: "blue" },
|
||||
{ label: t("certd.scopeFullAccount"), value: "user", color: "red" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: "open",
|
||||
show: true,
|
||||
rules: [{ required: true, message: "此项必填" }],
|
||||
helper: "仅开放接口只可以访问开放接口,账户所有权限可以访问所有接口",
|
||||
rules: [{ required: true, message: t("certd.required") }],
|
||||
helper: t("certd.scopeHelper"),
|
||||
component: {
|
||||
vModel: "value",
|
||||
},
|
||||
|
@ -170,7 +170,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
},
|
||||
createTime: {
|
||||
title: "创建时间",
|
||||
title: t("certd.fields.createTime"),
|
||||
type: "datetime",
|
||||
search: {
|
||||
show: false,
|
||||
|
@ -179,6 +179,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
show: false,
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
<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>
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
import * as api from "../api";
|
||||
import { useFormWrapper } from "@fast-crud/fast-crud";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
selectedRowKeys: any[];
|
||||
|
@ -21,19 +27,20 @@ async function batchUpdateRequest(form: any) {
|
|||
emit("change");
|
||||
}
|
||||
|
||||
|
||||
const { openCrudFormDialog } = useFormWrapper();
|
||||
|
||||
async function openFormDialog() {
|
||||
const crudOptions: any = {
|
||||
columns: {
|
||||
"props.cron": {
|
||||
title: "定时",
|
||||
title: t("certd.schedule"),
|
||||
form: {
|
||||
component: {
|
||||
name: "cron-editor",
|
||||
vModel: "modelValue",
|
||||
},
|
||||
rules: [{ required: true, message: "请选择定时Cron" }],
|
||||
rules: [{ required: true, message: t("certd.selectCron") }],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -52,10 +59,11 @@ async function openFormDialog() {
|
|||
},
|
||||
},
|
||||
wrapper: {
|
||||
title: "批量修改定时",
|
||||
title: t("certd.batchEditSchedule"),
|
||||
width: 600,
|
||||
},
|
||||
},
|
||||
|
||||
} as any;
|
||||
await openCrudFormDialog({ crudOptions });
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class="pi-trigger-form" @after-open-change="triggerDrawerOnAfterVisibleChange">
|
||||
<template #title>
|
||||
<div>
|
||||
编辑触发器
|
||||
{{ t("certd.editTrigger") }}
|
||||
<a-button v-if="mode === 'edit'" @click="triggerDelete()">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
|
@ -16,27 +16,28 @@
|
|||
<a-form ref="triggerFormRef" class="trigger-form" :model="currentTrigger" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<fs-form-item v-model="currentTrigger.title" :item="{
|
||||
title: '触发器名称',
|
||||
title: t('certd.triggerName'),
|
||||
key: 'title',
|
||||
component: {
|
||||
name: 'a-input',
|
||||
vModel: 'value',
|
||||
disabled: !editMode,
|
||||
},
|
||||
rules: [{ required: true, message: '此项必填' }],
|
||||
rules: [{ required: true, message: t('certd.requiredField') }],
|
||||
}" />
|
||||
|
||||
|
||||
<fs-form-item v-model="currentTrigger.type" :item="{
|
||||
title: '类型',
|
||||
title: t('certd.type'),
|
||||
key: 'type',
|
||||
value: 'timer',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
vModel: 'value',
|
||||
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="{
|
||||
|
@ -93,11 +94,12 @@ export default {
|
|||
{
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入名称",
|
||||
message: t("certd.enterName"),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
const triggerDrawerShow = () => {
|
||||
triggerDrawerVisible.value = true;
|
||||
};
|
||||
|
@ -118,10 +120,11 @@ export default {
|
|||
|
||||
const triggerAdd = emit => {
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
const triggerEdit = (trigger, emit) => {
|
||||
mode.value = "edit";
|
||||
triggerOpen(trigger, emit);
|
||||
|
@ -147,8 +150,8 @@ export default {
|
|||
|
||||
const triggerDelete = () => {
|
||||
Modal.confirm({
|
||||
title: "确认",
|
||||
content: `确定要删除此触发器吗?`,
|
||||
title: t("certd.confirm"),
|
||||
content: t("certd.confirmDeleteTrigger"),
|
||||
async onOk() {
|
||||
callback.value("delete");
|
||||
triggerDrawerClose();
|
||||
|
@ -156,6 +159,7 @@ export default {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
const blankFn = () => {
|
||||
return {};
|
||||
};
|
||||
|
|
|
@ -4,8 +4,11 @@ import { useUserStore } from "/@/store/user";
|
|||
import { Modal, notification } from "ant-design-vue";
|
||||
import dayjs from "dayjs";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
|
@ -124,11 +127,11 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
|
|||
},
|
||||
},
|
||||
nickName: {
|
||||
title: "昵称",
|
||||
title: t("certd.nickName"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: "最大50个字符" }],
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
|
|
Loading…
Reference in New Issue