From 0e96bfdfa377824d204e72923d1176408ae6b300 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 6 Sep 2025 00:12:16 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=88=9B=E5=BB=BA=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E6=97=B6=E6=94=AF=E6=8C=81=E9=80=89=E6=8B=A9=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/locales/langs/en-US/certd.ts | 1 + .../src/locales/langs/zh-CN/certd.ts | 1 + .../views/certd/pipeline/certd-form/use.tsx | 23 +++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts index 63390d5f..19e35501 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts @@ -219,6 +219,7 @@ export default { triggerCronHelper: "Click the button above to choose a daily execution time.\nIt is recommended to trigger once per day. The task will be skipped if the certificate has not expired and will not be executed repeatedly.", notificationTitle: "Failure Notification", + notificationWhen: "Notification Timing", notificationHelper: "Get real-time alerts when the task fails", groupIdTitle: "Pipeline Group", }, diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts index 4b667d64..a2966391 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts @@ -224,6 +224,7 @@ export default { triggerCronTitle: "定时触发", triggerCronHelper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行", notificationTitle: "失败通知", + notificationWhen: "通知时机", notificationHelper: "任务执行失败实时提醒", groupIdTitle: "流水线分组", }, diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx index dd6ff4d5..5b10b8ca 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx @@ -22,7 +22,7 @@ export function fillPipelineByDefaultForm(pipeline: any, form: any) { if (form.notification != null) { notifications.push({ type: "custom", - when: ["error", "turnToSuccess", "success"], + when: form.notificationWhen || ["error", "turnToSuccess"], notificationId: form.notification, title: form.notificationTarget?.name || "自定义通知", }); @@ -223,6 +223,25 @@ export function useCertPipelineCreator() { helper: t("certd.pipelineForm.notificationHelper"), }, }, + notificationWhen: { + title: t("certd.pipelineForm.notificationWhen"), + type: "text", + form: { + value: ["error", "turnToSuccess"], + component: { + name: "a-select", + vModel: "value", + mode: "multiple", + options: [ + { value: "start", label: t("certd.start_time") }, + { value: "success", label: t("certd.success_time") }, + { value: "turnToSuccess", label: t("certd.fail_to_success_time") }, + { value: "error", label: t("certd.fail_time") }, + ], + }, + order: 102, + }, + }, groupId: { title: t("certd.pipelineForm.groupIdTitle"), type: "dict-select", @@ -268,7 +287,7 @@ export function useCertPipelineCreator() { async function doSubmit({ form }: any) { // const certDetail = readCertDetail(form.cert.crt); // 添加certd pipeline - const pluginInput = omit(form, ["triggerCron", "notification", "notificationTarget", "certApplyPlugin", "groupId"]); + const pluginInput = omit(form, ["triggerCron", "notification", "notificationTarget", "notificationWhen", "certApplyPlugin", "groupId"]); let pipeline: any = { title: form.domains[0] + "证书自动化", runnableType: "pipeline",