perf: 优化证书申请跳过的状态显示,成功通知现在在跳过时不会发送

v2
xiaojunnuo 2024-12-23 00:49:56 +08:00
parent faa28f88f9
commit 67d762b6a5
6 changed files with 51 additions and 38 deletions

View File

@ -92,13 +92,16 @@ export class Executor {
await this.onChanged(this.runtime);
}, 5000);
await this.runWithHistory(this.pipeline, "pipeline", async () => {
const result = await this.runWithHistory(this.pipeline, "pipeline", async () => {
return await this.runStages(this.pipeline);
});
if (this.lastRuntime && this.lastRuntime.pipeline.status?.status === ResultType.error) {
await this.notification("turnToSuccess");
if (result === ResultType.success) {
if (this.lastRuntime && this.lastRuntime.pipeline.status?.status === ResultType.error) {
await this.notification("turnToSuccess");
} else {
await this.notification("success");
}
}
await this.notification("success");
} catch (e: any) {
await this.notification("error", e);
this.logger.error("pipeline 执行失败", e);
@ -336,7 +339,7 @@ export class Executor {
instance.setCtx(taskCtx);
await instance.onInstance();
await instance.execute();
const result = await instance.execute();
//执行结果处理
if (instance._result.clearLastStatus) {
//是否需要清除所有状态
@ -364,6 +367,8 @@ export class Executor {
merge(vars, instance._result.pipelinePrivateVars);
await this.pipelineContext.setObj("privateVars", vars);
}
return result;
}
async notification(when: NotificationWhen, error?: any) {

View File

@ -59,7 +59,7 @@ export type PluginDefine = Registrable & {
export type ITaskPlugin = {
onInstance(): Promise<void>;
execute(): Promise<void>;
execute(): Promise<void | string>;
onRequest(req: PluginRequestHandleReq<any>): Promise<any>;
[key: string]: any;
};

View File

@ -120,10 +120,11 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
abstract doCertApply(): Promise<any>;
async execute(): Promise<void> {
async execute(): Promise<string | void> {
const oldCert = await this.condition();
if (oldCert != null) {
return await this.output(oldCert, false);
await this.output(oldCert, false);
return "skip";
}
const cert = await this.doCertApply();
if (cert != null) {
@ -258,6 +259,8 @@ cert.jksjks格式证书文件java服务器使用
inputChanged = oldInput !== thisInput;
if (inputChanged) {
this.logger.info(`旧参数:${oldInput}`);
this.logger.info(`新参数:${thisInput}`);
this.logger.info("输入参数变更,准备申请新证书");
return null;
}

View File

@ -1,3 +1,5 @@
import { useSettingStore } from "/@/store/modules/settings";
export const certdResources = [
{
title: "证书自动化",
@ -44,6 +46,10 @@ export const certdResources = [
path: "/certd/monitor/site",
component: "/certd/monitor/site/index.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isPlus;
},
icon: "ion:videocam-outline",
auth: true
}
@ -84,6 +90,10 @@ export const certdResources = [
path: "/certd/monitor/cert",
component: "/certd/monitor/cert/index.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isPlus;
},
icon: "ion:shield-checkmark-outline",
auth: true,
isMenu: false
@ -130,6 +140,10 @@ export const certdResources = [
name: "SuiteProduct",
path: "/certd/suite",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:cart-outline",
auth: true
},
@ -140,6 +154,10 @@ export const certdResources = [
path: "/certd/suite/mine",
component: "/certd/suite/mine/index.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:gift-outline",
auth: true
}
@ -150,6 +168,10 @@ export const certdResources = [
path: "/certd/suite/buy",
component: "/certd/suite/buy.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:cart-outline",
auth: true
}
@ -160,11 +182,14 @@ export const certdResources = [
path: "/certd/trade",
component: "/certd/trade/index.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:bag-check-outline",
auth: true
}
},
{
title: "支付返回",
name: "PaymentReturn",

View File

@ -176,6 +176,10 @@ export const sysResources = [
path: "/sys/suite/setting",
component: "/sys/suite/setting/index.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:cart",
permission: "sys:settings:edit"
}
@ -186,38 +190,14 @@ export const sysResources = [
path: "/sys/suite/trade",
component: "/sys/suite/trade/index.vue",
meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:bag-check",
permission: "sys:settings:edit"
}
}
// {
// title: "商业版设置",
// name: "SysCommercial",
// meta: {
// icon: "ion:document-text-outline",
// permission: "sys:settings:view",
// show: () => {
// const settingStore = useSettingStore();
// return settingStore.isComm;
// }
// },
// children: [
// {
// title: "套餐设置",
// name: "suite",
// path: "/sys/commercial/suite",
// meta: {
// icon: "ion:document-text-outline",
// permission: "sys:settings:view",
// show: () => {
// const settingStore = useSettingStore();
// return settingStore.isComm;
// }
// }
// }
// ]
// }
]
}
];

View File

@ -3,7 +3,7 @@
<template #header>
<div class="title">
站点证书监控
<span class="sub">监控网站证书的过期时间并发出提醒</span>
<span class="sub">监控网站证书的过期时间并发出提醒未完成开发中</span>
</div>
</template>
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>