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

View File

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

View File

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

View File

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

View File

@ -176,6 +176,10 @@ export const sysResources = [
path: "/sys/suite/setting", path: "/sys/suite/setting",
component: "/sys/suite/setting/index.vue", component: "/sys/suite/setting/index.vue",
meta: { meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:cart", icon: "ion:cart",
permission: "sys:settings:edit" permission: "sys:settings:edit"
} }
@ -186,38 +190,14 @@ export const sysResources = [
path: "/sys/suite/trade", path: "/sys/suite/trade",
component: "/sys/suite/trade/index.vue", component: "/sys/suite/trade/index.vue",
meta: { meta: {
show: () => {
const settingStore = useSettingStore();
return settingStore.isComm;
},
icon: "ion:bag-check", icon: "ion:bag-check",
permission: "sys:settings:edit" 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> <template #header>
<div class="title"> <div class="title">
站点证书监控 站点证书监控
<span class="sub">监控网站证书的过期时间并发出提醒</span> <span class="sub">监控网站证书的过期时间并发出提醒未完成开发中</span>
</div> </div>
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud> <fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>