import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; import Box from "@mui/material/Box"; import { TableJobs, TableFailedJobs } from "./components/TableJobs"; import { useTheme } from "@mui/material"; import { useTranslation, Trans } from "react-i18next"; import { useGet, usePost } from "@/Hooks/UseApi"; import type { QueueData } from "@/Types/Queue"; import { Metrics } from "@/Pages/Logs/components/Metrics"; import { Button } from "@/Components/inputs"; import { EmptyState } from "@/Components/design-elements"; export const TabQueue = () => { const theme = useTheme(); const { t } = useTranslation(); const { data: queueData, isLoading, // error, refetch, } = useGet("/queue/all-metrics", {}, { refreshInterval: 5000 }); const { post, loading: isFlushing } = usePost(); const jobs = queueData?.jobs ?? []; const metrics = queueData?.metrics ?? null; const hasNeverRun = !isLoading && metrics !== null && (metrics.totalRuns ?? 0) === 0; const noQueueData = !isLoading && metrics === null && jobs.length === 0; if (hasNeverRun || noQueueData) { return ( ); } const handleFlushQueue = async () => { await post("/queue/flush", {}); refetch(); }; return ( {t("pages.logs.jobQueue")} ), }} /> {t("pages.logs.failedJobs")} {t("pages.logs.failedJobsExplainer")} ); };