fix: machine build height

This commit is contained in:
bennykok 2024-01-31 21:27:31 +08:00
parent c4628f6e4c
commit 488d2aee8c
3 changed files with 12 additions and 4 deletions

View File

@ -35,7 +35,10 @@ export default async function Page({
/>
)}
{machine.status !== "building" && machine.build_log && (
<LogsViewer logs={JSON.parse(machine.build_log)} />
<LogsViewer
logs={JSON.parse(machine.build_log)}
className="h-full max-h-[600px]"
/>
)}
</CardContent>
</Card>

View File

@ -1,6 +1,7 @@
"use client";
import React, { useEffect, useRef } from "react";
import { cn } from "@/lib/utils";
import { toast } from "sonner";
export type LogsType = {
@ -12,7 +13,8 @@ export type LogsType = {
export function LogsViewer({
logs,
hideTimestamp,
}: { logs: LogsType; hideTimestamp?: boolean }) {
className,
}: { logs: LogsType; hideTimestamp?: boolean; className?: string }) {
const container = useRef<HTMLDivElement | null>(null);
useEffect(() => {
@ -40,7 +42,10 @@ export function LogsViewer({
}
container.current = ref;
}}
className="h-full w-full flex flex-col text-xs p-2 overflow-y-scroll whitespace-break-spaces"
className={cn(
"h-full w-full flex flex-col text-xs p-2 overflow-y-scroll whitespace-break-spaces",
className,
)}
>
{logs.map((x, i) => (
<div

View File

@ -66,7 +66,7 @@ export function MachineBuildLog({
return (
<div>
{connectionStatus}
<LogsViewer logs={logs} hideTimestamp />
<LogsViewer logs={logs} className="h-full max-h-[600px]" />
<AlertDialog open={finished}>
<AlertDialogContent>