feat: add workflow lifecycle controls and monitoring
This commit is contained in:
1 parent
9f9f3abe22
commit
0cdd62161f
16 files changed
+778
-20
No files matched your search
@@ -6,6 +6,8 @@ import {
|
||||
WorkflowStatsSchema,
|
||||
WorkflowChargeSchema,
|
||||
WorkflowDetailSchema,
|
||||
WorkflowSnapshotPageSchema,
|
||||
WorkflowLogPageSchema,
|
||||
WorkflowJobSchema,
|
||||
WorkflowDslSchema,
|
||||
StaffSchema,
|
||||
@@ -84,6 +86,53 @@ export async function getWorkflowDetail(
|
||||
return unwrap(response, WorkflowDetailSchema);
|
||||
}
|
||||
|
||||
// ── 工作流草稿保存(Piper)───────────────────────────────────────────────────
|
||||
// Web 端“保存更新”会把完整 pipeline 原样 PUT 回服务端;节点不是独立资源。
|
||||
export async function updateWorkflow(
|
||||
client: KyInstance,
|
||||
workflow: import("./types.js").WorkflowDetail
|
||||
): Promise<import("./types.js").WorkflowDetail> {
|
||||
const response = await client.put(`api/easo/pipelines/${workflow.id}`, {
|
||||
json: workflow,
|
||||
});
|
||||
return unwrap(response, WorkflowDetailSchema);
|
||||
}
|
||||
|
||||
export async function listWorkflowSnapshots(
|
||||
client: KyInstance,
|
||||
pipelineId: string,
|
||||
page: number = 1,
|
||||
pageSize: number = 10
|
||||
): Promise<import("./types.js").WorkflowSnapshotPage> {
|
||||
const response = await client.get(`api/easo/pipelines/${pipelineId}/snapshots`, {
|
||||
searchParams: { number: String(page), pageSize: String(pageSize) },
|
||||
});
|
||||
return unwrap(response, WorkflowSnapshotPageSchema);
|
||||
}
|
||||
|
||||
export async function listWorkflowLogs(
|
||||
client: KyInstance,
|
||||
pipelineId: string,
|
||||
options: {
|
||||
state?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
} = {},
|
||||
): Promise<import("./types.js").WorkflowLogPage> {
|
||||
const response = await client.get(`api/easo/pipelines/${pipelineId}/log`, {
|
||||
searchParams: {
|
||||
state: options.state ?? "",
|
||||
number: String(options.page ?? 1),
|
||||
pageSize: String(options.pageSize ?? 10),
|
||||
...(options.startTime ? { startTime: options.startTime } : {}),
|
||||
...(options.endTime ? { endTime: options.endTime } : {}),
|
||||
},
|
||||
});
|
||||
return unwrap(response, WorkflowLogPageSchema);
|
||||
}
|
||||
|
||||
// ── 工作流启停(Piper)────────────────────────────────────────────────────────
|
||||
|
||||
export async function toggleWorkflow(
|
||||
|
||||
Reference in new issue
Block a user