import { Heart, Power } from 'lucide-react';
import { Icon } from '@/react/components/Icon';
import { DockerContainer } 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 === 'running')
.length;
}
function stoppedContainersFilter(containers: DockerContainer[]) {
return containers.filter(
(container) =>
container.Status === 'exited' || container.Status === 'stopped'
).length;
}
function healthyContainersFilter(containers: DockerContainer[]) {
return containers.filter((container) => container.Status === 'healthy')
.length;
}
function unhealthyContainersFilter(containers: DockerContainer[]) {
return containers.filter((container) => container.Status === 'unhealthy')
.length;
}