diff --git a/src/components/instance-welcome-view.tsx b/src/components/instance-welcome-view.tsx index 13de505d..a2128a12 100644 --- a/src/components/instance-welcome-view.tsx +++ b/src/components/instance-welcome-view.tsx @@ -182,19 +182,23 @@ const InstanceWelcomeView: Component = (props) => { if (!status || typeof status !== "object") return [] try { - if (Array.isArray(status)) { - return status.map((s) => ({ - name: s.name || "Unknown", - status: s.status || "stopped", - })) - } + const obj = status as Record + return Object.entries(obj).map(([name, statusValue]) => { + let mappedStatus: "running" | "stopped" | "error" + + if (statusValue === "connected") { + mappedStatus = "running" + } else if (statusValue === "disabled") { + mappedStatus = "stopped" + } else if (statusValue === "failed") { + mappedStatus = "error" + } else { + mappedStatus = "stopped" + } - const obj = status as Record - return Object.entries(obj).map(([name, data]) => { - const serverData = data as { status?: string } return { name, - status: (serverData?.status as "running" | "stopped" | "error") || "stopped", + status: mappedStatus, } }) } catch {