feat(ui): workflow logs
This commit is contained in:
@@ -14,3 +14,4 @@ export const COLLECTION_NAME_SETTINGS = "settings";
|
||||
export const COLLECTION_NAME_WORKFLOW = "workflow";
|
||||
export const COLLECTION_NAME_WORKFLOW_RUN = "workflow_run";
|
||||
export const COLLECTION_NAME_WORKFLOW_OUTPUT = "workflow_output";
|
||||
export const COLLECTION_NAME_WORKFLOW_LOG = "workflow_logs";
|
||||
|
||||
@@ -3,14 +3,14 @@ import dayjs from "dayjs";
|
||||
import { type CertificateModel } from "@/domain/certificate";
|
||||
import { COLLECTION_NAME_CERTIFICATE, getPocketBase } from "./_pocketbase";
|
||||
|
||||
export type ListCertificateRequest = {
|
||||
export type ListRequest = {
|
||||
keyword?: string;
|
||||
state?: "expireSoon" | "expired";
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
};
|
||||
|
||||
export const list = async (request: ListCertificateRequest) => {
|
||||
export const list = async (request: ListRequest) => {
|
||||
const pb = getPocketBase();
|
||||
|
||||
const filters: string[] = ["deleted=null"];
|
||||
@@ -39,7 +39,7 @@ export const listByWorkflowRunId = async (workflowRunId: string) => {
|
||||
const list = await pb.collection(COLLECTION_NAME_CERTIFICATE).getFullList<CertificateModel>({
|
||||
batch: 65535,
|
||||
filter: pb.filter("workflowRunId={:workflowRunId}", { workflowRunId: workflowRunId }),
|
||||
sort: "-created",
|
||||
// sort: "created",
|
||||
requestKey: null,
|
||||
});
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ import { type RecordSubscription } from "pocketbase";
|
||||
import { type WorkflowModel } from "@/domain/workflow";
|
||||
import { COLLECTION_NAME_WORKFLOW, getPocketBase } from "./_pocketbase";
|
||||
|
||||
export type ListWorkflowRequest = {
|
||||
export type ListRequest = {
|
||||
keyword?: string;
|
||||
enabled?: boolean;
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
};
|
||||
|
||||
export const list = async (request: ListWorkflowRequest) => {
|
||||
export const list = async (request: ListRequest) => {
|
||||
const pb = getPocketBase();
|
||||
|
||||
const filters: string[] = [];
|
||||
|
||||
19
ui/src/repository/workflowLog.ts
Normal file
19
ui/src/repository/workflowLog.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { type WorkflowLogModel } from "@/domain/workflowLog";
|
||||
|
||||
import { COLLECTION_NAME_WORKFLOW_LOG, getPocketBase } from "./_pocketbase";
|
||||
|
||||
export const listByWorkflowRunId = async (workflowRunId: string) => {
|
||||
const pb = getPocketBase();
|
||||
|
||||
const list = await pb.collection(COLLECTION_NAME_WORKFLOW_LOG).getFullList<WorkflowLogModel>({
|
||||
batch: 65535,
|
||||
filter: pb.filter("runId={:runId}", { runId: workflowRunId }),
|
||||
// sort: "created",
|
||||
requestKey: null,
|
||||
});
|
||||
|
||||
return {
|
||||
totalItems: list.length,
|
||||
items: list,
|
||||
};
|
||||
};
|
||||
@@ -4,14 +4,14 @@ import { type WorkflowRunModel } from "@/domain/workflowRun";
|
||||
|
||||
import { COLLECTION_NAME_WORKFLOW_RUN, getPocketBase } from "./_pocketbase";
|
||||
|
||||
export type ListWorkflowRunsRequest = {
|
||||
export type ListRequest = {
|
||||
workflowId?: string;
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
expand?: boolean;
|
||||
};
|
||||
|
||||
export const list = async (request: ListWorkflowRunsRequest) => {
|
||||
export const list = async (request: ListRequest) => {
|
||||
const pb = getPocketBase();
|
||||
|
||||
const filters: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user