diff --git a/web/src/components/LogsViewer.tsx b/web/src/components/LogsViewer.tsx index 0ece1f8..f9e64c1 100644 --- a/web/src/components/LogsViewer.tsx +++ b/web/src/components/LogsViewer.tsx @@ -9,7 +9,10 @@ export type LogsType = { timestamp: number; }[]; -export function LogsViewer({ logs }: { logs: LogsType }) { +export function LogsViewer({ + logs, + hideTimestamp, +}: { logs: LogsType; hideTimestamp?: boolean }) { const container = useRef(null); useEffect(() => { @@ -37,7 +40,7 @@ export function LogsViewer({ logs }: { logs: LogsType }) { } container.current = ref; }} - className="flex flex-col text-xs p-2 overflow-y-scroll whitespace-break-spaces" + className="h-full w-full flex flex-col text-xs p-2 overflow-y-scroll whitespace-break-spaces" > {logs.map((x, i) => (
- - {new Date(x.timestamp).toLocaleString()} - -
+ {!hideTimestamp && ( + <> + + {new Date(x.timestamp * 1000).toLocaleString()} + +
+ + )} {/* Display timestamp */}
{x.logs}
diff --git a/web/src/components/MachineBuildLog.tsx b/web/src/components/MachineBuildLog.tsx index 2983aa6..c9a4e80 100644 --- a/web/src/components/MachineBuildLog.tsx +++ b/web/src/components/MachineBuildLog.tsx @@ -16,7 +16,7 @@ import { AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, -} from "@/components/ui/alert-dialog" +} from "@/components/ui/alert-dialog"; import { useRouter } from "next/navigation"; export function MachineBuildLog({ @@ -41,7 +41,7 @@ export function MachineBuildLog({ reconnectAttempts: 20, reconnectInterval: 1000, queryParams: query, - } + }, ); const connectionStatus = getConnectionStatus(readyState); @@ -57,59 +57,70 @@ export function MachineBuildLog({ setLogs((logs) => [...(logs ?? []), message.data]); } else if (message?.event === "FINISHED") { setFinished(true); - setStatus(message.data.status) + setStatus(message.data.status); } }, [lastMessage]); - const router = useRouter() + const router = useRouter(); return (
{connectionStatus} - + - { - status == "succuss" ? ( - <> - - Machine Built - - Your machine is built, you can now integrate your API, or directly run to check this machines. - - - - { - router.push("/workflows") - }}>See Workflows - { - router.push("/machines") - }}>See All Machines - - ) : ( - <> - - Machine Failed - - Something went wrong with the machine build, please check the log. - Possible cause could be conflits with custom nodes, build got stuck, timeout, or too many custom nodes installed. - Please attempt a rebuild or remove some of the custom nodes. - - - - See logs - { - router.push("/machines") - }}>Back to machines - - ) - } - - + {status == "succuss" ? ( + <> + + Machine Built + + Your machine is built, you can now integrate your API, or + directly run to check this machines. + + + + { + router.push("/workflows"); + }} + > + See Workflows + + { + router.push("/machines"); + }} + > + See All Machines + + + + ) : ( + <> + + Machine Failed + + Something went wrong with the machine build, please check the + log. Possible cause could be conflits with custom nodes, build + got stuck, timeout, or too many custom nodes installed. Please + attempt a rebuild or remove some of the custom nodes. + + + + See logs + { + router.push("/machines"); + }} + > + Back to machines + + + + )} -
); } diff --git a/web/src/components/MachinesWS.tsx b/web/src/components/MachinesWS.tsx index 6f543c6..e870a7f 100644 --- a/web/src/components/MachinesWS.tsx +++ b/web/src/components/MachinesWS.tsx @@ -36,7 +36,7 @@ type State = { json: { event: string; data: any; - } + }, ) => void; }; @@ -82,7 +82,7 @@ function MachineWS({ const logs = useStore((x) => x.logs .filter((p) => p.machine_id === machine.id) - .sort((a, b) => a.timestamp - b.timestamp) + .sort((a, b) => a.timestamp - b.timestamp), ); const [sid, setSid] = useState(""); @@ -96,7 +96,7 @@ function MachineWS({ // queryParams: { // clientId: sid, // }, - } + }, ); const connectionStatus = getConnectionStatus(readyState); @@ -135,7 +135,9 @@ function MachineWS({ You can view your run's outputs here - +
+ +
);