fix log to bottom

This commit is contained in:
mbecker20
2024-05-12 01:54:31 -07:00
parent 85616d0669
commit 1304565e40
2 changed files with 10 additions and 6 deletions

View File

@@ -25,10 +25,9 @@ import { Card, CardHeader } from "@ui/card";
import { RunBuild } from "../build/actions";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@ui/tabs";
import { DeploymentConfig } from "./config";
import { atomWithStorage } from "jotai/utils";
import { useAtom } from "jotai";
import { useState } from "react";
const configOrLog = atomWithStorage("config-or-log-v1", "Config");
// const configOrLog = atomWithStorage("config-or-log-v1", "Config");
export const useDeployment = (id?: string) =>
useRead("ListDeployments", {}, { refetchInterval: 5000 }).data?.find(
@@ -36,7 +35,8 @@ export const useDeployment = (id?: string) =>
);
const ConfigOrLog = ({ id }: { id: string }) => {
const [view, setView] = useAtom(configOrLog);
// const [view, setView] = useAtom(configOrLog);
const [view, setView] = useState("Config");
const state = useDeployment(id)?.info.state;
const logsDisabled =
state === undefined ||

View File

@@ -130,7 +130,11 @@ const NoSearchLogs = (id: string, tail: string, stream: string) => {
{ refetchInterval: 30000 }
);
return {
Log: <Log log={log} stream={stream as "stdout" | "stderr"} />,
Log: (
<div className="relative">
<Log log={log} stream={stream as "stdout" | "stderr"} />
</div>
),
refetch,
stderr: !!log?.stderr,
};
@@ -178,7 +182,7 @@ const Log = ({
className="-scroll-mt-24"
/>
</div>
<Button className="absolute bottom-4 right-4" onClick={scroll}>
<Button variant="secondary" className="absolute top-4 right-4" onClick={scroll}>
<ChevronDown className="h-4 w-4" />
</Button>
</>