diff --git a/origin_ui/src/app/(dashboard)/page.tsx b/origin_ui/src/app/(dashboard)/page.tsx index 3e3c7e8a4..a777ce34d 100644 --- a/origin_ui/src/app/(dashboard)/page.tsx +++ b/origin_ui/src/app/(dashboard)/page.tsx @@ -19,6 +19,8 @@ "use client" import RateGraph from "@/components/graphs/RateGraph"; +import StatusBox from "@/components/StatusBox"; + import {TimeDuration} from "@/components/graphs/prometheus"; import {Box, Grid} from "@mui/material"; @@ -29,7 +31,10 @@ export default function Home() { return ( - + + + + + {`${component}: ${status}`} + + ) +} + + +export default function StatusBox() { + + const [status, setStatus] = useState(undefined) + const [updated, setUpdated] = useState(DateTime.now()) + + let getStatus = async () => { + let response = await fetch("/api/v1.0/health") + let data = await response.json() + setUpdated(DateTime.now()) + setStatus(data) + } + + useEffect(() => { + getStatus() + + const interval = setInterval(() => getStatus(), 60000); + return () => clearInterval(interval) + }, []) + + if(status === undefined){ + return ( + + Status + + + + + ) + } + + return ( + + + Status + + + + + + + + Last Updated: {updated.toLocaleString(DateTime.DATETIME_MED)} + + + ) +}