import CheckIcon from "@mui/icons-material/Check"; import CloseIcon from "@mui/icons-material/Close"; import EngineeringIcon from "@mui/icons-material/Engineering"; import { Alert, Box, Stack, Typography, Paper, Link, Chip, Divider, Tooltip, ChipProps } from "@mui/material"; import { useStore } from "ra-core"; import CurrentlyRunningCommand from "./CurrentlyRunningCommand"; import { ServerProcessResponse, ServerStatusComponent, ServerStatusResponse } from "../../synapse/dataProvider"; import { getTimeSince } from "../../utils/date"; const StatusChip = ({ isOkay, size = "medium", command, }: { isOkay: boolean; size?: "small" | "medium"; command?: string; }) => { let label = "OK"; let icon = ; let color: ChipProps["color"] = "success"; if (!isOkay) { label = "Error"; icon = ; color = "error"; } if (command) { label = command; color = "warning"; icon = ; } return ; }; const ServerComponentText = ({ text }: { text: string }) => { return ; }; const ServerStatusPage = () => { const [serverStatus, setServerStatus] = useStore("serverStatus", { ok: false, success: false, host: "", results: [], }); const [serverProcess, setServerProcess] = useStore("serverProcess", { command: "", locked_at: "", }); const { command, locked_at } = serverProcess; const successCheck = serverStatus.success; const isOkay = serverStatus.ok; const host = serverStatus.host; const results = serverStatus.results; const groupedResults: Record = {}; for (const result of results) { if (!groupedResults[result.category]) { groupedResults[result.category] = []; } groupedResults[result.category].push(result); } if (!successCheck) { return ( Fetching real-time server health... Just a moment! ); } return ( Status: {host} This is a{" "} monitoring report {" "} of the server. If any of the checks below concern you, please check the{" "} suggested actions . {Object.keys(groupedResults).map((category, idx) => ( {category} }> {groupedResults[category].map((result, idx) => ( {result.label.url ? ( ) : ( )} {result.reason && ( )} {!result.ok && result.help && ( Learn more )} ))} ))} ); }; export default ServerStatusPage;