import React from "react"; import { Trash2, Plus, Activity } from "lucide-react"; import { Button } from "@/components/ui"; import type { PortForwardResponse } from "@/lib/tauriCommands"; import { stopPortForwardCmd } from "@/lib/tauriCommands"; interface PortForwardListProps { portForwards: PortForwardResponse[]; onStart: () => void; onStop: (session_id: string) => Promise; } export function PortForwardList({ portForwards, onStart, onStop }: PortForwardListProps) { const handleStop = async (id: string) => { if (window.confirm("Are you sure you want to stop this port forward?")) { await onStop(id); } }; const getStatusColor = (status: string) => { switch (status.toLowerCase()) { case "active": return "bg-green-500/15 text-green-600 dark:text-green-400 border-green-500/20"; case "stopped": return "bg-gray-500/15 text-gray-600 dark:text-gray-400 border-gray-500/20"; case "error": return "bg-red-500/15 text-red-600 dark:text-red-400 border-red-500/20"; default: return "bg-muted text-muted-foreground"; } }; return (

Port Forwards

{portForwards.length === 0 ? (

No active port forwards

Start a port forward to expose a pod locally

) : (
{portForwards.map((pf) => (

Port Forward

{pf.status}

Cluster: {pf.cluster_id}

Namespace: {pf.namespace}

Pod: {pf.pod}

Container Port: {pf.container_port} | Local Port: {pf.local_port > 0 ? pf.local_port : "pending"}
{pf.status.toLowerCase() === "active" && ( )}
))}
)}
); }