diff --git a/packages/core/pipeline/src/core/executor.ts b/packages/core/pipeline/src/core/executor.ts index 619c6933..cabb9c2a 100644 --- a/packages/core/pipeline/src/core/executor.ts +++ b/packages/core/pipeline/src/core/executor.ts @@ -104,11 +104,18 @@ export class Executor { async runWithHistory(runnable: Runnable, runnableType: string, run: () => Promise) { runnable.runnableType = runnableType; + this.runtime.start(runnable); - // const timeout = runnable.timeout ?? 20 * 60 * 1000; - await this.onChanged(this.runtime); try { + if (runnable.disabled) { + //该任务被禁用 + this.runtime.disabled(runnable); + return ResultType.disabled; + } + + await this.onChanged(this.runtime); + if (this.abort.signal.aborted) { this.runtime.cancel(runnable); return ResultType.canceled; diff --git a/packages/core/pipeline/src/core/run-history.ts b/packages/core/pipeline/src/core/run-history.ts index 641b1871..e6ee250a 100644 --- a/packages/core/pipeline/src/core/run-history.ts +++ b/packages/core/pipeline/src/core/run-history.ts @@ -74,6 +74,17 @@ export class RunHistory { this.log(runnable, `跳过`); } + disabled(runnable: Runnable) { + const now = new Date().getTime(); + const status = runnable.status; + _.merge(status, { + status: "canceled", + endTime: now, + result: "disabled", + }); + this.log(runnable, `禁用`); + } + error(runnable: Runnable, e: Error) { const now = new Date().getTime(); const status = runnable.status; diff --git a/packages/core/pipeline/src/dt/pipeline.ts b/packages/core/pipeline/src/dt/pipeline.ts index 90b74649..c9532327 100644 --- a/packages/core/pipeline/src/dt/pipeline.ts +++ b/packages/core/pipeline/src/dt/pipeline.ts @@ -70,6 +70,7 @@ export type Runnable = { default?: { [key: string]: any; }; + disabled?: boolean; }; export type EmailOptions = { @@ -108,6 +109,7 @@ export enum ResultType { error = "error", canceled = "canceled", skip = "skip", + disabled = "disabled", none = "none", } diff --git a/packages/ui/certd-client/src/style/common.less b/packages/ui/certd-client/src/style/common.less index b93c3540..edf517d6 100644 --- a/packages/ui/certd-client/src/style/common.less +++ b/packages/ui/certd-client/src/style/common.less @@ -184,3 +184,12 @@ h1, h2, h3, h4, h5, h6 { .need-plus { color: #c5913f !important; } + + +.disabled{ + color: #c7c7c7; +} +.deleted{ + //删除线 + text-decoration: line-through; +} \ No newline at end of file diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue index 352cebe4..4d20cf0e 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue @@ -48,9 +48,10 @@
-

{{ element.title }}

+

{{ element.title }}

+ {{ element.disabled ? "启用" : "禁用" }} 编辑 复制 删除 diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue index 072396f8..c523ebcd 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue @@ -94,7 +94,9 @@