perf: 创建证书时支持选择通知时机

v2
xiaojunnuo 2025-09-06 00:12:16 +08:00
parent a24ef48ad1
commit 0e96bfdfa3
3 changed files with 23 additions and 2 deletions

View File

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

View File

@ -224,6 +224,7 @@ export default {
triggerCronTitle: "定时触发",
triggerCronHelper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次证书未到期之前任务会跳过不会重复执行",
notificationTitle: "失败通知",
notificationWhen: "通知时机",
notificationHelper: "任务执行失败实时提醒",
groupIdTitle: "流水线分组",
},

View File

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