'use client' import type { DockerStats, ContainerInfo, ContainerFilter } from '../types' import { getStateColor } from './helpers' interface DeploymentsTabProps { dockerStats: DockerStats | null filteredContainers: ContainerInfo[] containerFilter: ContainerFilter setContainerFilter: (f: ContainerFilter) => void actionLoading: string | null containerAction: (containerId: string, action: 'start' | 'stop' | 'restart') => Promise loadContainerData: () => Promise } export function DeploymentsTab({ dockerStats, filteredContainers, containerFilter, setContainerFilter, actionLoading, containerAction, loadContainerData, }: DeploymentsTabProps) { return (
{/* Header */}

Docker Container

{dockerStats && (

{dockerStats.running_containers} laufend, {dockerStats.stopped_containers} gestoppt, {dockerStats.total_containers} gesamt

)}
{/* Container List */} {filteredContainers.length === 0 ? (
Keine Container gefunden
) : (
{filteredContainers.map((container) => ( ))}
)}
) } // ============================================================================ // Container Card Sub-component // ============================================================================ function ContainerCard({ container, actionLoading, containerAction, }: { container: ContainerInfo actionLoading: string | null containerAction: (containerId: string, action: 'start' | 'stop' | 'restart') => Promise }) { return (
{container.name} {container.state}
{container.image} {container.ports.length > 0 && ( | {container.ports.slice(0, 2).join(', ')} {container.ports.length > 2 && ` +${container.ports.length - 2}`} )}
{container.state === 'running' && (
CPU: 80 ? 'text-red-600' : 'text-slate-700'}`}> {container.cpu_percent.toFixed(1)}%
RAM: 80 ? 'text-red-600' : 'text-slate-700'}`}> {container.memory_usage} ({container.memory_percent.toFixed(1)}%)
Net: {container.network_rx} / {container.network_tx}
)}
{container.state === 'running' ? ( <> ) : ( )}
) }