import React from "react"; import Terminal from "./terminal"; import { BASE_WS_URL } from "@/lib/api"; import VNCViewer from "./vncviewer"; type SSHSessionProps = { type: "ssh"; params: { serverId: string; }; }; type PVESessionProps = { type: "pve"; params: { client: "vnc" | "xtermjs"; serverId: string; }; }; type IncusSessionProps = { type: "incus"; params: { client: "vnc" | "xtermjs"; serverId: string; shell?: string; }; }; export type InteractiveSessionProps = | SSHSessionProps | PVESessionProps | IncusSessionProps; const InteractiveSession = ({ type, params }: InteractiveSessionProps) => { let url = ""; const query = new URLSearchParams({ ...params, }); switch (type) { case "ssh": return ; case "pve": url = `${BASE_WS_URL}/ws/pve?${query}`; return params.client === "vnc" ? ( ) : ( ); case "incus": url = `${BASE_WS_URL}/ws/incus?${query}`; return params.client === "vnc" ? ( ) : ( ); default: throw new Error("Unknown interactive session type"); } }; export default InteractiveSession;