import React from "react"; import {Status, StatusIndicator} from "@/components/ui/shadcn-io/status"; import {Button} from "@/components/ui/button.tsx"; import {ButtonGroup} from "@/components/ui/button-group.tsx"; import {Server, Terminal} from "lucide-react"; import {useTabs} from "@/contexts/TabContext"; interface SSHHost { id: number; name: string; ip: string; port: number; username: string; folder: string; tags: string[]; pin: boolean; authType: string; password?: string; key?: string; keyPassword?: string; keyType?: string; enableTerminal: boolean; enableTunnel: boolean; enableConfigEditor: boolean; defaultPath: string; tunnelConnections: any[]; createdAt: string; updatedAt: string; } interface HostProps { host: SSHHost; } export function Host({ host }: HostProps): React.ReactElement { const { addTab } = useTabs(); const tags = Array.isArray(host.tags) ? host.tags : []; const hasTags = tags.length > 0; const handleTerminalClick = () => { console.log('Terminal button clicked for host:', host); const title = host.name?.trim() ? host.name : `${host.username}@${host.ip}:${host.port}`; console.log('Creating terminal tab with title:', title); const tabId = addTab({ type: 'terminal', title, hostConfig: host, }); console.log('Created terminal tab with ID:', tabId); }; return (
{host.name || host.ip}
{tag}