fix: limit run and fallback to Suspend output display
This commit is contained in:
		
							parent
							
								
									e8451c3749
								
							
						
					
					
						commit
						64db3b326e
					
				@ -1,7 +1,5 @@
 | 
				
			|||||||
"use client";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import { LiveStatus } from "./LiveStatus";
 | 
					import { LiveStatus } from "./LiveStatus";
 | 
				
			||||||
import { callServerPromise } from "./callServerPromise";
 | 
					import { RunOutputs } from "@/components/RunOutputs";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  Dialog,
 | 
					  Dialog,
 | 
				
			||||||
  DialogContent,
 | 
					  DialogContent,
 | 
				
			||||||
@ -13,25 +11,24 @@ import {
 | 
				
			|||||||
import { TableCell, TableRow } from "@/components/ui/table";
 | 
					import { TableCell, TableRow } from "@/components/ui/table";
 | 
				
			||||||
import { getRelativeTime } from "@/lib/getRelativeTime";
 | 
					import { getRelativeTime } from "@/lib/getRelativeTime";
 | 
				
			||||||
import { type findAllRuns } from "@/server/findAllRuns";
 | 
					import { type findAllRuns } from "@/server/findAllRuns";
 | 
				
			||||||
import { getRunsOutputDisplay } from "@/server/getRunsOutput";
 | 
					import { Suspense } from "react";
 | 
				
			||||||
import { useState } from "react";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function RunDisplay({
 | 
					export async function RunDisplay({
 | 
				
			||||||
  run,
 | 
					  run,
 | 
				
			||||||
}: {
 | 
					}: {
 | 
				
			||||||
  run: Awaited<ReturnType<typeof findAllRuns>>[0];
 | 
					  run: Awaited<ReturnType<typeof findAllRuns>>[0];
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
  const [view, setView] = useState<any>();
 | 
					  // const [view, setView] = useState<any>();
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <Dialog>
 | 
					    <Dialog>
 | 
				
			||||||
      <DialogTrigger
 | 
					      <DialogTrigger
 | 
				
			||||||
        asChild
 | 
					        asChild
 | 
				
			||||||
        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 callServerPromise(getRunsOutputDisplay(run.id));
 | 
					        //   const _view = await callServerPromise(getRunsOutputDisplay(run.id));
 | 
				
			||||||
          setView(_view);
 | 
					        //   setView(_view);
 | 
				
			||||||
        }}
 | 
					        // }}
 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
        <TableRow>
 | 
					        <TableRow>
 | 
				
			||||||
          <TableCell>{run.version?.version}</TableCell>
 | 
					          <TableCell>{run.version?.version}</TableCell>
 | 
				
			||||||
@ -47,10 +44,12 @@ export function RunDisplay({
 | 
				
			|||||||
            You can view your run's outputs here
 | 
					            You can view your run's outputs here
 | 
				
			||||||
          </DialogDescription>
 | 
					          </DialogDescription>
 | 
				
			||||||
        </DialogHeader>
 | 
					        </DialogHeader>
 | 
				
			||||||
        {/* <Suspense>
 | 
					        <div className="max-h-96 overflow-y-scroll">
 | 
				
			||||||
 | 
					          <Suspense>
 | 
				
			||||||
            <RunOutputs run_id={run.id} />
 | 
					            <RunOutputs run_id={run.id} />
 | 
				
			||||||
        </Suspense> */}
 | 
					          </Suspense>
 | 
				
			||||||
        <div className="max-h-96 overflow-y-scroll">{view}</div>
 | 
					        </div>
 | 
				
			||||||
 | 
					        {/* <div className="max-h-96 overflow-y-scroll">{view}</div> */}
 | 
				
			||||||
      </DialogContent>
 | 
					      </DialogContent>
 | 
				
			||||||
    </Dialog>
 | 
					    </Dialog>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ import { getRunsOutput } from "@/server/getRunsOutput";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export async function RunOutputs({ run_id }: { run_id: string }) {
 | 
					export async function RunOutputs({ run_id }: { run_id: string }) {
 | 
				
			||||||
  const outputs = await getRunsOutput(run_id);
 | 
					  const outputs = await getRunsOutput(run_id);
 | 
				
			||||||
  console.log("Getting runs out put");
 | 
					  // console.log("Getting runs out put");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // const [outputs, setOutputs] =
 | 
					  // const [outputs, setOutputs] =
 | 
				
			||||||
  //   useState<Awaited<ReturnType<typeof getRunsOutput>>>();
 | 
					  //   useState<Awaited<ReturnType<typeof getRunsOutput>>>();
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,7 @@ export async function findAllRuns(workflow_id: string) {
 | 
				
			|||||||
  return await db.query.workflowRunsTable.findMany({
 | 
					  return await db.query.workflowRunsTable.findMany({
 | 
				
			||||||
    where: eq(workflowRunsTable.workflow_id, workflow_id),
 | 
					    where: eq(workflowRunsTable.workflow_id, workflow_id),
 | 
				
			||||||
    orderBy: desc(workflowRunsTable.created_at),
 | 
					    orderBy: desc(workflowRunsTable.created_at),
 | 
				
			||||||
 | 
					    limit: 10,
 | 
				
			||||||
    with: {
 | 
					    with: {
 | 
				
			||||||
      machine: {
 | 
					      machine: {
 | 
				
			||||||
        columns: {
 | 
					        columns: {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user