From 731bdf39829885c223da34905a7488823da1cec2 Mon Sep 17 00:00:00 2001 From: bennykok Date: Fri, 26 Jan 2024 20:13:44 +0800 Subject: [PATCH] feat: update with error machine built dialog --- web/src/components/MachineBuildLog.tsx | 52 +++++++++++++++++++------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/web/src/components/MachineBuildLog.tsx b/web/src/components/MachineBuildLog.tsx index 05cb0a5..6a16ca7 100644 --- a/web/src/components/MachineBuildLog.tsx +++ b/web/src/components/MachineBuildLog.tsx @@ -30,6 +30,7 @@ export function MachineBuildLog({ }) { const [logs, setLogs] = useState([]); const [finished, setFinished] = useState(false); + const [status, setStatus] = useState<"failed" | "succuss">(); const wsEndpoint = endpoint.replace(/^http/, "ws"); const query = { fly_instance_id: instance_id }; @@ -56,6 +57,7 @@ export function MachineBuildLog({ setLogs((logs) => [...(logs ?? []), message.data]); } else if (message?.event === "FINISHED") { setFinished(true); + setStatus(message.status) } }, [lastMessage]); @@ -68,20 +70,42 @@ export function MachineBuildLog({ - - 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 - + { + 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. + + + + { + router.push("/machines") + }}>Back to machines + + ) + } + +