import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import { DockerStateLabel, Table } from "@/Components/design-elements"; // Hooks import { useTranslation } from "react-i18next"; import useMediaQuery from "@mui/material/useMediaQuery"; import { useTheme } from "@mui/material/styles"; import { useNavigate } from "react-router-dom"; // Types import type { Header } from "@/Components/design-elements/Table"; import type { DockerContainerInfo } from "@/Types/Check"; // Utils import { formatPercentage } from "@/Utils/FormatUtils"; interface DockerContainersTableProps { monitorId: string | undefined; containers: DockerContainerInfo[]; onRowClick?: (container: DockerContainerInfo) => void; } export const DockerContainersTable = ({ monitorId, containers, }: DockerContainersTableProps) => { const { t } = useTranslation(); const theme = useTheme(); const isSmall = useMediaQuery(theme.breakpoints.down("md")); const navigate = useNavigate(); const getHeaders = () => { // const renderSortIcon = (isActive: boolean) => ( // // {isActive ? ( // sortOrder === "asc" ? ( // // ) : ( // // ) // ) : null} // // ); const headers: Header[] = [ { id: "container", content: t("pages.docker.host.table.headers.container"), render: (row) => { return ( ); }, }, { id: "status", content: t("common.table.headers.status"), render: (row) => { return {row.state}; }, }, { id: "health", content: t("common.labels.health"), render: (row) => { return {row.health}; }, }, { id: "cpu", content: t("pages.docker.host.table.headers.cpu"), render: (row) => { return {formatPercentage(row.cpuPct ?? 0)}; }, }, { id: "memory", content: t("pages.docker.host.table.headers.memory"), render: (row) => { return {formatPercentage(row.memoryPct ?? 0)}; }, }, { id: "restarts", content: t("common.labels.restarts"), render: (row) => { return {row.restartCount}; }, }, ]; return headers; }; let headers = getHeaders(); if (isSmall) { headers = headers.filter((h) => h.id !== "histogram"); } return ( { navigate(`/docker/host/${monitorId}/container/${row.name}`); }} // getRowSx={(row) => ({ // backgroundColor: isRowSelected(row.id) // ? theme.palette.action.selected // : "inherit", // })} /> ); };