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",