/* * Copyright (c) 2021-2026 ahriman team. * * This file is part of ahriman * (see https://github.com/arcan1s/ahriman). * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import { Box, Dialog, DialogContent, Grid, Typography } from "@mui/material"; import { skipToken, useQuery } from "@tanstack/react-query"; import PackageCountBarChart from "components/charts/PackageCountBarChart"; import StatusPieChart from "components/charts/StatusPieChart"; import DialogHeader from "components/common/DialogHeader"; import { QueryKeys } from "hooks/QueryKeys"; import { useClient } from "hooks/useClient"; import { useRepository } from "hooks/useRepository"; import type { InternalStatus } from "models/InternalStatus"; import type React from "react"; import { StatusHeaderStyles } from "theme/StatusColors"; interface DashboardDialogProps { open: boolean; onClose: () => void; } export default function DashboardDialog({ open, onClose }: DashboardDialogProps): React.JSX.Element { const client = useClient(); const { current } = useRepository(); const { data: status } = useQuery({ queryKey: current ? QueryKeys.status(current) : ["status"], queryFn: current ? () => client.fetch.fetchServerStatus(current) : skipToken, enabled: open, }); const headerStyle = status ? StatusHeaderStyles[status.status.status] : {}; return System health {status && <> Repository name {status.repository} Repository architecture {status.architecture} Current status {status.status.status} Updated at {new Date(status.status.timestamp * 1000).toISOStringShort()} } ; }