chore: tweak ui
This commit is contained in:
parent
23db3c1a45
commit
e77da089d9
@ -182,9 +182,11 @@ export async function callServerPromise<T>(result: Promise<T>) {
|
|||||||
if ((x as { message: string })?.message !== undefined) {
|
if ((x as { message: string })?.message !== undefined) {
|
||||||
toast.success((x as { message: string }).message);
|
toast.success((x as { message: string }).message);
|
||||||
}
|
}
|
||||||
|
return x;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
toast.error(error.message);
|
toast.error(error.message);
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { LiveStatus } from "./LiveStatus";
|
import { LiveStatus } from "./LiveStatus";
|
||||||
|
import { callServerPromise } from "@/components/MachineList";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@ -28,7 +29,7 @@ export function RunDisplay({
|
|||||||
className="appearance-none hover:cursor-pointer"
|
className="appearance-none hover:cursor-pointer"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (view) return;
|
if (view) return;
|
||||||
const _view = await getRunsOutputDisplay(run.id);
|
const _view = await callServerPromise(getRunsOutputDisplay(run.id));
|
||||||
setView(_view);
|
setView(_view);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -49,7 +50,7 @@ export function RunDisplay({
|
|||||||
{/* <Suspense>
|
{/* <Suspense>
|
||||||
<RunOutputs run_id={run.id} />
|
<RunOutputs run_id={run.id} />
|
||||||
</Suspense> */}
|
</Suspense> */}
|
||||||
{view}
|
<div className="max-h-96 overflow-y-scroll">{view}</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
@ -59,6 +60,7 @@ export function OutputRender(props: { run_id: string; filename: string }) {
|
|||||||
if (props.filename.endsWith(".png")) {
|
if (props.filename.endsWith(".png")) {
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
|
className="max-w-[200px]"
|
||||||
alt={props.filename}
|
alt={props.filename}
|
||||||
src={`/api/view?file=${encodeURIComponent(
|
src={`/api/view?file=${encodeURIComponent(
|
||||||
`outputs/runs/${props.run_id}/${props.filename}`
|
`outputs/runs/${props.run_id}/${props.filename}`
|
||||||
|
@ -30,7 +30,7 @@ export async function RunOutputs({ run_id }: { run_id: string }) {
|
|||||||
{/* <TableCaption>A list of your recent runs.</TableCaption> */}
|
{/* <TableCaption>A list of your recent runs.</TableCaption> */}
|
||||||
<TableHeader className="bg-background top-0 sticky">
|
<TableHeader className="bg-background top-0 sticky">
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableHead className="w-[100px]">File</TableHead>
|
<TableHead className="w-[200px]">File</TableHead>
|
||||||
<TableHead className="">Output</TableHead>
|
<TableHead className="">Output</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
@ -42,7 +42,7 @@ export async function RunOutputs({ run_id }: { run_id: string }) {
|
|||||||
return (
|
return (
|
||||||
<TableRow key={run.id}>
|
<TableRow key={run.id}>
|
||||||
<TableCell>Output</TableCell>
|
<TableCell>Output</TableCell>
|
||||||
<TableCell className="max-h-44">
|
<TableCell className="">
|
||||||
<CodeBlock
|
<CodeBlock
|
||||||
code={JSON.stringify(run.data, null, 2)}
|
code={JSON.stringify(run.data, null, 2)}
|
||||||
lang="json"
|
lang="json"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user