feat: add deployment endpoint

This commit is contained in:
BennyKok
2023-12-14 22:36:57 +08:00
parent 0835d966f1
commit 7e05fae7b3
29 changed files with 1776 additions and 190 deletions
+2 -46
View File
@@ -1,5 +1,6 @@
"use client";
import { RunOutputs } from "./RunOutputs";
import { useStore } from "@/components/MachinesWS";
import { StatusBadge } from "@/components/StatusBadge";
import {
@@ -10,18 +11,9 @@ import {
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { TableCell, TableRow } from "@/components/ui/table";
import { getRelativeTime } from "@/lib/getRelativeTime";
import { type findAllRuns } from "@/server/findAllRuns";
import { getRunsOutput } from "@/server/getRunsOutput";
import { useEffect, useState } from "react";
export function RunDisplay({
run,
@@ -73,42 +65,6 @@ export function RunDisplay({
);
}
export function RunOutputs({ run_id }: { run_id: string }) {
const [outputs, setOutputs] = useState<
Awaited<ReturnType<typeof getRunsOutput>>
>([]);
useEffect(() => {
getRunsOutput(run_id).then((x) => setOutputs(x));
}, [run_id]);
return (
<Table>
{/* <TableCaption>A list of your recent runs.</TableCaption> */}
<TableHeader className="bg-background top-0 sticky">
<TableRow>
<TableHead className="w-[100px]">File</TableHead>
<TableHead className="">Output</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{outputs?.map((run) => {
const fileName = run.data.images[0].filename;
// const filePath
return (
<TableRow key={run.id}>
<TableCell>{fileName}</TableCell>
<TableCell>
<OutputRender run_id={run_id} filename={fileName} />
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
);
}
export function OutputRender(props: { run_id: string; filename: string }) {
if (props.filename.endsWith(".png")) {
return (