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 && ( {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> </CardContent>
</Card> </Card>

View File

@ -1,6 +1,7 @@
"use client"; "use client";
import React, { useEffect, useRef } from "react"; import React, { useEffect, useRef } from "react";
import { cn } from "@/lib/utils";
import { toast } from "sonner"; import { toast } from "sonner";
export type LogsType = { export type LogsType = {
@ -12,7 +13,8 @@ export type LogsType = {
export function LogsViewer({ export function LogsViewer({
logs, logs,
hideTimestamp, hideTimestamp,
}: { logs: LogsType; hideTimestamp?: boolean }) { className,
}: { logs: LogsType; hideTimestamp?: boolean; className?: string }) {
const container = useRef<HTMLDivElement | null>(null); const container = useRef<HTMLDivElement | null>(null);
useEffect(() => { useEffect(() => {
@ -40,7 +42,10 @@ export function LogsViewer({
} }
container.current = ref; 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) => ( {logs.map((x, i) => (
<div <div

View File

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