perf: 创建证书任务增加定时任务和邮件通知输入

pull/101/head
xiaojunnuo 2024-07-21 02:59:02 +08:00
parent a5a0c1f6e7
commit 427620d34f
3 changed files with 54 additions and 7 deletions

View File

@ -31,14 +31,12 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
}
}
console.log(inputs);
debugger;
return {
crudOptions: {
form: {
wrapper: {
width: "1150px"
width: "1150px",
saveRemind: false
}
},
columns: {
@ -66,7 +64,40 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
}
}
},
...inputs
...inputs,
triggerCron: {
title: "定时触发",
type: "text",
form: {
component: {
placeholder: "0 0 4 * * *"
},
helper: "请输入cron表达式, 例如0 0 4 * * *每天凌晨4点触发",
order: 100
}
},
emailNotify: {
title: "失败邮件通知",
type: "dict-switch",
dict: dict({
data: [
{ value: true, label: "启用" },
{ value: false, label: "不启用" }
]
}),
form: {
order: 101,
helper: {
render: () => {
return (
<div>
<router-link to={{ path: "/certd/settings/email" }}></router-link>
</div>
);
}
}
}
}
}
}
};

View File

@ -37,6 +37,21 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
function addCertdPipeline() {
certdFormRef.value.open(async ({ form }: any) => {
// 添加certd pipeline
const triggers = [];
if (form.triggerCron) {
triggers.push({ id: nanoid(), title: "定时触发", type: "timer", props: { cron: form.triggerCron } });
}
const notifications = [];
if (form.emailNotify) {
notifications.push({
id: nanoid(),
type: "email",
when: ["error", "turnToSuccess"],
options: {
receivers: [form.email]
}
});
}
const pipeline = {
title: form.domains[0] + "证书自动化",
stages: [
@ -62,7 +77,9 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
}
]
}
]
],
triggers,
notifications
}
]
};

View File

@ -208,7 +208,6 @@ export default {
const changeCurrentPlugin = (step: any) => {
const stepType = step.type;
const pluginDefine = pluginGroups.get(stepType);
debugger;
if (pluginDefine) {
step.type = stepType;
step._isAdd = false;