diff --git a/packages/libs/lib-server/src/system/settings/service/models.ts b/packages/libs/lib-server/src/system/settings/service/models.ts index 58a14106..4cde10c2 100644 --- a/packages/libs/lib-server/src/system/settings/service/models.ts +++ b/packages/libs/lib-server/src/system/settings/service/models.ts @@ -18,6 +18,8 @@ export class SysPublicSettings extends BaseSettings { limitUserPipelineCount = 0; managerOtherUserPipeline = false; icpNo?: string; + defaultCron?: string; + defaultNotification?: number; // triggerOnStartup = false; } diff --git a/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts b/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts index 0c4fad28..7b15ddd3 100644 --- a/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts +++ b/packages/plugins/plugin-cert/src/plugin/cert-plugin/index.ts @@ -58,7 +58,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin { }, required: true, helper: - "DNS直接验证:域名是在阿里云、腾讯云、华为云、Cloudflare、西数注册的,选它。\nCNAME代理验证:支持任何注册商注册的域名,但第一次需要手动添加CNAME记录", + "DNS直接验证:域名是在阿里云、腾讯云、华为云、Cloudflare、NameSilo、西数注册的,选它。\nCNAME代理验证:支持任何注册商注册的域名,但第一次需要手动添加CNAME记录", }) challengeType!: string; diff --git a/packages/ui/certd-client/src/api/modules/api.basic.ts b/packages/ui/certd-client/src/api/modules/api.basic.ts index 16c7892e..523abb33 100644 --- a/packages/ui/certd-client/src/api/modules/api.basic.ts +++ b/packages/ui/certd-client/src/api/modules/api.basic.ts @@ -24,11 +24,18 @@ export type PlusInfo = { isComm?: boolean; }; export type SysPublicSetting = { - registerEnabled: boolean; - managerOtherUserPipeline: boolean; + registerEnabled?: boolean; + limitUserPipelineCount?: number; + managerOtherUserPipeline?: boolean; icpNo?: string; }; +export type SysPrivateSetting = { + httpProxy?: string; + httpsProxy?: string; + dnsResultOrder?: string; + commonCnameEnabled?: boolean; +}; export type SysInstallInfo = { siteId: string; }; diff --git a/packages/ui/certd-client/src/components/cron-editor/index.vue b/packages/ui/certd-client/src/components/cron-editor/index.vue index 9b502a61..d11d8074 100644 --- a/packages/ui/certd-client/src/components/cron-editor/index.vue +++ b/packages/ui/certd-client/src/components/cron-editor/index.vue @@ -13,8 +13,9 @@ @error="onError" /> -
+
+
下次触发时间:{{ nextTime }}
{{ errorMessage }}
@@ -35,8 +36,12 @@ const props = defineProps<{ }>(); const period = ref(""); -if (props.modelValue == null) { +if (props.modelValue == null || props.modelValue.endsWith("* * *")) { period.value = "day"; +} else if (props.modelValue.endsWith("* *")) { + period.value = "month"; +} else if (props.modelValue.endsWith("*")) { + period.value = "year"; } const emit = defineEmits<{ "update:modelValue": any; @@ -74,6 +79,13 @@ const onError = (error: any) => { errorMessage.value = error; }; +const onClear = () => { + if (props.disabled) { + return; + } + onUpdate(""); +}; + const nextTime = computed(() => { if (props.modelValue == null) { return "请先设置正确的cron表达式"; diff --git a/packages/ui/certd-client/src/style/common.less b/packages/ui/certd-client/src/style/common.less index d87c50ed..3420cedf 100644 --- a/packages/ui/certd-client/src/style/common.less +++ b/packages/ui/certd-client/src/style/common.less @@ -198,6 +198,9 @@ h1, h2, h3, h4, h5, h6 { .color-green { color: green; } +.color-gray { + color: gray; +} .iconify{ //font-size: 16px; diff --git a/packages/ui/certd-client/src/views/certd/notification/common.tsx b/packages/ui/certd-client/src/views/certd/notification/common.tsx index 5ba29e8f..b33710c3 100644 --- a/packages/ui/certd-client/src/views/certd/notification/common.tsx +++ b/packages/ui/certd-client/src/views/certd/notification/common.tsx @@ -110,7 +110,6 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) { const define = await api.GetProviderDefine(value); currentDefine.value = define; console.log("define", define); - debugger; if (!immediate) { form.body = {}; } diff --git a/packages/ui/certd-client/src/views/certd/notification/crud.tsx b/packages/ui/certd-client/src/views/certd/notification/crud.tsx index a252a769..f3ca01a1 100644 --- a/packages/ui/certd-client/src/views/certd/notification/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/notification/crud.tsx @@ -23,7 +23,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat const addRequest = async (req: AddReq) => { const { form } = req; - debugger; const res = await api.AddObj(form); return res; }; diff --git a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue index 5a0f720c..b9252db0 100644 --- a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue +++ b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue @@ -7,7 +7,7 @@ {{ placeholder }} 选择 - +
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx index ca78cf67..8c0d4c2b 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx @@ -5,6 +5,7 @@ import _, { merge } from "lodash-es"; import { useUserStore } from "/@/store/modules/user"; import { useSettingStore } from "/@/store/modules/settings"; import * as api from "../api.plugin"; +import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue"; export default function (certPluginGroup: PluginGroup, formWrapperRef: any): CreateCrudOptionsRet { const inputs: any = {}; const userStore = useUserStore(); @@ -102,30 +103,16 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre order: 100 } }, - emailNotify: { - title: "失败邮件通知", - type: "dict-switch", - dict: dict({ - data: [ - { value: true, label: "启用" }, - { value: false, label: "不启用" } - ] - }), + notification: { + title: "失败通知", + type: "text", form: { + component: { + name: NotificationSelector, + vModel: "modelValue" + }, order: 101, - value: true, - helper: { - render: () => { - if (settingStore.isPlus) { - return "建议启用"; - } - return ( -
- 建议启用,需要配置邮件服务器才能发送邮件 -
- ); - } - } + helper: "建议设置,任务执行失败实时提醒" } } } diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx index 33952bde..e357e6a7 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx @@ -14,7 +14,7 @@ import * as _ from "lodash-es"; import { useModal } from "/@/use/use-modal"; import CertView from "./cert-view.vue"; import { eachStages } from "./utils"; - +import { createApi as createNotificationApi } from "../notification/api"; export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOptionsProps): CreateCrudOptionsRet { const router = useRouter(); const { t } = useI18n(); @@ -102,13 +102,13 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } }); } const notifications = []; - if (form.emailNotify) { + if (form.notification) { + const notify = await createNotificationApi().GetSimpleInfo(form.notification); notifications.push({ - type: "email", + type: "custom", when: ["error", "turnToSuccess"], - options: { - receivers: [form.email] - } + notificationId: form.notification, + title: notify.name }); } let pipeline = { diff --git a/packages/ui/certd-client/src/views/sys/plugin/api.ts b/packages/ui/certd-client/src/views/sys/plugin/api.ts index 05916dd0..2f481ee1 100644 --- a/packages/ui/certd-client/src/views/sys/plugin/api.ts +++ b/packages/ui/certd-client/src/views/sys/plugin/api.ts @@ -75,7 +75,8 @@ export type PluginConfigBean = { }; export type CertApplyPluginSysInput = { - googleCommonEabAccessId: number; + googleCommonEabAccessId?: number; + zerosslCommonEabAccessId?: number; }; export type PluginSysSetting = { sysSetting: { diff --git a/packages/ui/certd-client/src/views/sys/settings/api.ts b/packages/ui/certd-client/src/views/sys/settings/api.ts index f9b91230..21c5cec5 100644 --- a/packages/ui/certd-client/src/views/sys/settings/api.ts +++ b/packages/ui/certd-client/src/views/sys/settings/api.ts @@ -1,22 +1,9 @@ // @ts-ignore import { request } from "/@/api/service"; +import { SysPrivateSetting, SysPublicSetting } from "/@/api/modules/api.basic"; const apiPrefix = "/sys/settings"; export type SysSettings = { public: SysPublicSetting; private: SysPrivateSetting }; -export type SysPublicSetting = { - registerEnabled?: boolean; - limitUserPipelineCount?: number; - managerOtherUserPipeline?: boolean; - icpNo?: string; -}; - -export type SysPrivateSetting = { - httpProxy?: string; - httpsProxy?: string; - dnsResultOrder?: string; - commonCnameEnabled?: boolean; -}; - export const SettingKeys = { SysPublic: "sys.public", SysPrivate: "sys.private", diff --git a/packages/ui/certd-client/src/views/sys/settings/index.vue b/packages/ui/certd-client/src/views/sys/settings/index.vue index 8e7b389c..4b300fa6 100644 --- a/packages/ui/certd-client/src/views/sys/settings/index.vue +++ b/packages/ui/certd-client/src/views/sys/settings/index.vue @@ -73,7 +73,7 @@ import { notification } from "ant-design-vue"; import { useSettingStore } from "/@/store/modules/settings"; import { merge } from "lodash-es"; import { util } from "/@/utils"; - +import NotificationSelector from "/src/views/certd/notification/notification-selector/index.vue"; defineOptions({ name: "SysSettings" });