mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
fix: 修复左侧菜单收起时无法展开子菜单的bug
This commit is contained in:
@@ -148,7 +148,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
return new PipelineDetail(pipeline);
|
||||
}
|
||||
|
||||
async update(bean: PipelineEntity) {
|
||||
async update(bean: Partial<PipelineEntity>) {
|
||||
//更新非trigger部分
|
||||
await super.update(bean);
|
||||
}
|
||||
@@ -304,13 +304,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
}
|
||||
|
||||
async trigger(id: any, stepId?: string) {
|
||||
const entity: PipelineEntity = await this.info(id);
|
||||
if (isComm()) {
|
||||
await this.checkHasDeployCount(id, entity.userId);
|
||||
}
|
||||
this.cron.register({
|
||||
name: `pipeline.${id}.trigger.once`,
|
||||
cron: null,
|
||||
job: async () => {
|
||||
logger.info('用户手动启动job');
|
||||
try {
|
||||
await this.run(id, null, stepId);
|
||||
await this.doRun(entity, null, stepId);
|
||||
} catch (e) {
|
||||
logger.error('手动job执行失败:', e);
|
||||
}
|
||||
@@ -318,6 +322,21 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
});
|
||||
}
|
||||
|
||||
async checkHasDeployCount(pipelineId: number, userId: number) {
|
||||
try {
|
||||
return await this.userSuiteService.checkHasDeployCount(userId);
|
||||
} catch (e) {
|
||||
if (e instanceof NeedSuiteException) {
|
||||
logger.error(e.message);
|
||||
await this.update({
|
||||
id: pipelineId,
|
||||
status: 'no_deploy_count',
|
||||
});
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async delete(id: any) {
|
||||
await this.clearTriggers(id);
|
||||
//TODO 删除storage
|
||||
@@ -390,10 +409,14 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
|
||||
async run(id: number, triggerId: string, stepId?: string) {
|
||||
const entity: PipelineEntity = await this.info(id);
|
||||
await this.doRun(entity, triggerId, stepId);
|
||||
}
|
||||
|
||||
async doRun(entity: PipelineEntity, triggerId: string, stepId?: string) {
|
||||
const id = entity.id;
|
||||
let suite: UserSuiteEntity = null;
|
||||
if (isComm()) {
|
||||
suite = await this.userSuiteService.checkHasDeployCount(entity.userId);
|
||||
suite = await this.checkHasDeployCount(id, entity.userId);
|
||||
}
|
||||
|
||||
const pipeline = JSON.parse(entity.content);
|
||||
|
||||
Reference in New Issue
Block a user