Save and display execution records
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Workflow, WorkflowNode } from "@/domain/workflow";
|
||||
import { Workflow, WorkflowNode, WorkflowRunLog } from "@/domain/workflow";
|
||||
import { getPb } from "./api";
|
||||
|
||||
export const get = async (id: string) => {
|
||||
@@ -39,3 +39,30 @@ export const list = async (req: WorkflowListReq) => {
|
||||
export const remove = async (id: string) => {
|
||||
return await getPb().collection("workflow").delete(id);
|
||||
};
|
||||
|
||||
type WorkflowLogsReq = {
|
||||
id: string;
|
||||
page: number;
|
||||
perPage?: number;
|
||||
};
|
||||
|
||||
export const logs = async (req: WorkflowLogsReq) => {
|
||||
let page = 1;
|
||||
if (req.page) {
|
||||
page = req.page;
|
||||
}
|
||||
let perPage = 10;
|
||||
if (req.perPage) {
|
||||
perPage = req.perPage;
|
||||
}
|
||||
|
||||
const response = await getPb()
|
||||
.collection("workflow_run_log")
|
||||
.getList<WorkflowRunLog>(page, perPage, {
|
||||
sort: "-created",
|
||||
filter: getPb().filter("workflow={:workflowId}", { workflowId: req.id }),
|
||||
});
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user