mirror of https://github.com/certd/certd
perf: 创建证书任务增加定时任务和邮件通知输入
parent
a5a0c1f6e7
commit
427620d34f
|
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue