mirror of https://github.com/certd/certd
perf: 流水线支持有效期设置
parent
77b4a1eaf6
commit
911e69e3bc
|
|
@ -57,6 +57,7 @@ export default {
|
||||||
suiteBuy: "Suite Purchase",
|
suiteBuy: "Suite Purchase",
|
||||||
myTrade: "My Orders",
|
myTrade: "My Orders",
|
||||||
paymentReturn: "Payment Return",
|
paymentReturn: "Payment Return",
|
||||||
|
hasExpired: "Expired",
|
||||||
user: {
|
user: {
|
||||||
greeting: "Hello",
|
greeting: "Hello",
|
||||||
profile: "Account Info",
|
profile: "Account Info",
|
||||||
|
|
@ -136,6 +137,10 @@ export default {
|
||||||
triggerType: "Trigger Type",
|
triggerType: "Trigger Type",
|
||||||
pipelineId: "Pipeline Id",
|
pipelineId: "Pipeline Id",
|
||||||
},
|
},
|
||||||
|
pi: {
|
||||||
|
validTime: "Piepline Valid Time",
|
||||||
|
validTimeHelper: "Not filled in means permanent validity",
|
||||||
|
},
|
||||||
types: {
|
types: {
|
||||||
certApply: "Certificate Application",
|
certApply: "Certificate Application",
|
||||||
certUpload: "Certificate Upload",
|
certUpload: "Certificate Upload",
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ export default {
|
||||||
suiteBuy: "套餐购买",
|
suiteBuy: "套餐购买",
|
||||||
myTrade: "我的订单",
|
myTrade: "我的订单",
|
||||||
paymentReturn: "支付返回",
|
paymentReturn: "支付返回",
|
||||||
|
hasExpired: "已过期",
|
||||||
|
|
||||||
user: {
|
user: {
|
||||||
greeting: "您好",
|
greeting: "您好",
|
||||||
|
|
@ -142,6 +143,10 @@ export default {
|
||||||
triggerType: "触发类型",
|
triggerType: "触发类型",
|
||||||
pipelineId: "流水线Id",
|
pipelineId: "流水线Id",
|
||||||
},
|
},
|
||||||
|
pi: {
|
||||||
|
validTime: "流水线有效期",
|
||||||
|
validTimeHelper: "不填则为永久有效",
|
||||||
|
},
|
||||||
types: {
|
types: {
|
||||||
certApply: "证书申请",
|
certApply: "证书申请",
|
||||||
certUpload: "证书上传",
|
certUpload: "证书上传",
|
||||||
|
|
|
||||||
|
|
@ -555,16 +555,36 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
createTime: {
|
validTime: {
|
||||||
title: t("certd.fields.createTime"),
|
title: t("certd.pi.validTime"),
|
||||||
type: "datetime",
|
type: "date",
|
||||||
form: {
|
form: {
|
||||||
show: false,
|
show: true,
|
||||||
|
helper: t("certd.pi.validTimeHelper"),
|
||||||
|
valueResolve({ form, key, value }) {
|
||||||
|
if (value) {
|
||||||
|
form[key] = value.valueOf();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
valueBuilder({ form, key, value }) {
|
||||||
|
if (value) {
|
||||||
|
form[key] = dayjs(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
column: {
|
column: {
|
||||||
sorter: true,
|
sorter: true,
|
||||||
width: 155,
|
width: 155,
|
||||||
align: "center",
|
align: "center",
|
||||||
|
cellRender({ value }) {
|
||||||
|
if (!value || value <= 0) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
if (value < Date.now()) {
|
||||||
|
return t("certd.hasExpired");
|
||||||
|
}
|
||||||
|
return dayjs(value).format("YYYY-MM-DD");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
updateTime: {
|
updateTime: {
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,6 @@ CREATE TABLE "cd_group"
|
||||||
--分组字段
|
--分组字段
|
||||||
ALTER TABLE cd_site_info ADD COLUMN "group_id" integer;
|
ALTER TABLE cd_site_info ADD COLUMN "group_id" integer;
|
||||||
|
|
||||||
|
|
||||||
|
--流水线有效期
|
||||||
|
ALTER TABLE pi_pipeline ADD COLUMN "valid_time" integer;
|
||||||
|
|
|
||||||
|
|
@ -43,28 +43,19 @@ export class PipelineEntity {
|
||||||
@Column({ name:"is_template", comment: '是否模版', nullable: true, default: false })
|
@Column({ name:"is_template", comment: '是否模版', nullable: true, default: false })
|
||||||
isTemplate: boolean;
|
isTemplate: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({name: 'last_history_time',comment: '最后一次执行时间',nullable: true,})
|
||||||
name: 'last_history_time',
|
|
||||||
comment: '最后一次执行时间',
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
lastHistoryTime: number;
|
lastHistoryTime: number;
|
||||||
|
|
||||||
|
@Column({name: 'valid_time',comment: '到期时间',nullable: true,default: 0})
|
||||||
|
validTime: number;
|
||||||
|
|
||||||
// 变量
|
// 变量
|
||||||
lastVars: any;
|
lastVars: any;
|
||||||
|
|
||||||
@Column({
|
@Column({name: 'order', comment: '排序', nullable: true,})
|
||||||
name: 'order',
|
|
||||||
comment: '排序',
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
order: number;
|
order: number;
|
||||||
|
|
||||||
@Column({
|
@Column({name: 'create_time',comment: '创建时间', default: () => 'CURRENT_TIMESTAMP',})
|
||||||
name: 'create_time',
|
|
||||||
comment: '创建时间',
|
|
||||||
default: () => 'CURRENT_TIMESTAMP',
|
|
||||||
})
|
|
||||||
createTime: Date;
|
createTime: Date;
|
||||||
@Column({
|
@Column({
|
||||||
name: 'update_time',
|
name: 'update_time',
|
||||||
|
|
|
||||||
|
|
@ -457,11 +457,11 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cron = cron.trim();
|
cron = cron.trim();
|
||||||
if (cron.startsWith("* *")) {
|
if (cron.startsWith("* * ")) {
|
||||||
cron = cron.replace("\* \*", "0 0");
|
cron = "0 0 " + cron.substring(5);
|
||||||
}
|
}
|
||||||
if (cron.startsWith("*")) {
|
if (cron.startsWith("* ")) {
|
||||||
cron = cron.replace("\*", "0");
|
cron = "0 " + cron.substring(2);
|
||||||
}
|
}
|
||||||
const triggerId = trigger.id;
|
const triggerId = trigger.id;
|
||||||
const name = this.buildCronKey(pipelineId, triggerId);
|
const name = this.buildCronKey(pipelineId, triggerId);
|
||||||
|
|
@ -493,6 +493,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||||
*/
|
*/
|
||||||
async run(id: number, triggerId: string, stepId?: string) {
|
async run(id: number, triggerId: string, stepId?: string) {
|
||||||
const entity: PipelineEntity = await this.info(id);
|
const entity: PipelineEntity = await this.info(id);
|
||||||
|
if (entity.validTime > 0 && entity.validTime < Date.now()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
await this.doRun(entity, triggerId, stepId);
|
await this.doRun(entity, triggerId, stepId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue