import { Heart, Power } from 'lucide-react'; import { Icon } from '@/react/components/Icon'; import { DockerContainer, ContainerStatus as Status, } from '../containers/types'; interface Props { containers: DockerContainer[]; } export function useContainerStatusComponent(containers: DockerContainer[]) { return ; } export function ContainerStatus({ containers }: Props) { return (
{runningContainersFilter(containers)} running
{stoppedContainersFilter(containers)} stopped
{healthyContainersFilter(containers)} healthy
{unhealthyContainersFilter(containers)} unhealthy
); } function runningContainersFilter(containers: DockerContainer[]) { return containers.filter( (container) => container.Status === Status.Running || container.Status === Status.Healthy ).length; } function stoppedContainersFilter(containers: DockerContainer[]) { return containers.filter( (container) => container.Status === Status.Exited || container.Status === Status.Stopped ).length; } function healthyContainersFilter(containers: DockerContainer[]) { return containers.filter((container) => container.Status === Status.Healthy) .length; } function unhealthyContainersFilter(containers: DockerContainer[]) { return containers.filter((container) => container.Status === Status.Unhealthy) .length; }