feat: add run origin options, fix client code templates, buttons and badge styles

This commit is contained in:
BennyKok
2024-01-19 17:08:05 +08:00
parent 81cb44c5cf
commit e220921440
14 changed files with 1152 additions and 181 deletions
+8 -4
View File
@@ -2,7 +2,11 @@
import { withServerPromise } from "./withServerPromise";
import { db } from "@/db/db";
import type { MachineType, WorkflowVersionType } from "@/db/schema";
import type {
MachineType,
WorkflowRunOriginType,
WorkflowVersionType,
} from "@/db/schema";
import { machinesTable, workflowRunsTable } from "@/db/schema";
import type { APIKeyUserType } from "@/server/APIKeyBodyRequest";
import { getRunsData } from "@/server/getRunsData";
@@ -19,14 +23,14 @@ export const createRun = withServerPromise(
workflow_version_id,
machine_id,
inputs,
isManualRun,
runOrigin,
apiUser,
}: {
origin: string;
workflow_version_id: string | WorkflowVersionType;
machine_id: string | MachineType;
inputs?: Record<string, string | number>;
isManualRun?: boolean;
runOrigin?: WorkflowRunOriginType;
apiUser?: APIKeyUserType;
}) => {
const machine =
@@ -109,7 +113,7 @@ export const createRun = withServerPromise(
workflow_version_id: workflow_version_data.id,
workflow_inputs: inputs,
machine_id: machine.id,
origin: isManualRun ? "manual" : "api",
origin: runOrigin,
})
.returning();