import("@/components/routes/settings/general")}>
+
+
+
{
+ const { t } = useLingui()
+
+ useEffect(() => {
+ document.title = `${t`All Containers`} / Beszel`
+ }, [t])
+
+ return useMemo(
+ () => (
+ <>
+
+
+ >
+ ),
+ []
+ )
+})
diff --git a/internal/site/src/components/routes/home.tsx b/internal/site/src/components/routes/home.tsx
index 098ab85f..b0072488 100644
--- a/internal/site/src/components/routes/home.tsx
+++ b/internal/site/src/components/routes/home.tsx
@@ -1,128 +1,28 @@
-import { Plural, Trans, useLingui } from "@lingui/react/macro"
-import { useStore } from "@nanostores/react"
-import { getPagePath } from "@nanostores/router"
-import { GithubIcon } from "lucide-react"
+import { useLingui } from "@lingui/react/macro"
import { memo, Suspense, useEffect, useMemo } from "react"
-import { $router, Link } from "@/components/router"
import SystemsTable from "@/components/systems-table/systems-table"
-import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
-import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
-import { Separator } from "@/components/ui/separator"
-import { alertInfo } from "@/lib/alerts"
-import { $alerts, $allSystemsById } from "@/lib/stores"
-import type { AlertRecord } from "@/types"
+import { ActiveAlerts } from "@/components/active-alerts"
+import { FooterRepoLink } from "@/components/footer-repo-link"
export default memo(() => {
const { t } = useLingui()
useEffect(() => {
- document.title = `${t`Dashboard`} / Beszel`
+ document.title = `${t`All Systems`} / Beszel`
}, [t])
return useMemo(
() => (
<>
-
-
-
-
-
-
-
- GitHub
-
-
-
- Beszel {globalThis.BESZEL.HUB_VERSION}
-
+
+
>
),
[]
)
})
-
-const ActiveAlerts = () => {
- const alerts = useStore($alerts)
- const systems = useStore($allSystemsById)
-
- const { activeAlerts, alertsKey } = useMemo(() => {
- const activeAlerts: AlertRecord[] = []
- // key to prevent re-rendering if alerts change but active alerts didn't
- const alertsKey: string[] = []
-
- for (const systemId of Object.keys(alerts)) {
- for (const alert of alerts[systemId].values()) {
- if (alert.triggered && alert.name in alertInfo) {
- activeAlerts.push(alert)
- alertsKey.push(`${alert.system}${alert.value}${alert.min}`)
- }
- }
- }
-
- return { activeAlerts, alertsKey }
- }, [alerts])
-
- // biome-ignore lint/correctness/useExhaustiveDependencies: alertsKey is inclusive
- return useMemo(() => {
- if (activeAlerts.length === 0) {
- return null
- }
- return (
-
-
-
-
- Active Alerts
-
-
-
-
- {activeAlerts.length > 0 && (
-
- {activeAlerts.map((alert) => {
- const info = alertInfo[alert.name as keyof typeof alertInfo]
- return (
-
-
-
- {systems[alert.system]?.name} {info.name().toLowerCase().replace("cpu", "CPU")}
-
-
- {alert.name === "Status" ? (
- Connection is down
- ) : (
-
- Exceeds {alert.value}
- {info.unit} in last
-
- )}
-
-
-
- )
- })}
-
- )}
-
-
- )
- }, [alertsKey.join("")])
-}
diff --git a/internal/site/src/components/routes/system.tsx b/internal/site/src/components/routes/system.tsx
index 61db64e3..c21d03b1 100644
--- a/internal/site/src/components/routes/system.tsx
+++ b/internal/site/src/components/routes/system.tsx
@@ -13,7 +13,7 @@ import {
XIcon,
} from "lucide-react"
import { subscribeKeys } from "nanostores"
-import React, { type JSX, memo, useCallback, useEffect, useMemo, useRef, useState } from "react"
+import React, { type JSX, lazy, memo, useCallback, useEffect, useMemo, useRef, useState } from "react"
import AreaChartDefault, { type DataPoint } from "@/components/charts/area-chart"
import ContainerChart from "@/components/charts/container-chart"
import DiskChart from "@/components/charts/disk-chart"
@@ -73,6 +73,8 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/
import NetworkSheet from "./system/network-sheet"
import LineChartDefault from "../charts/line-chart"
+
+
type ChartTimeData = {
time: number
data: {
@@ -214,7 +216,7 @@ export default memo(function SystemDetail({ id }: { id: string }) {
// subscribe to realtime metrics if chart time is 1m
// biome-ignore lint/correctness/useExhaustiveDependencies: not necessary
useEffect(() => {
- let unsub = () => {}
+ let unsub = () => { }
if (!system.id || chartTime !== "1m") {
return
}
@@ -987,6 +989,9 @@ export default memo(function SystemDetail({ id }: { id: string }) {
})}
)}
+ {id && containerData.length > 0 && (
+
+ )}
{/* add space for tooltip if more than 12 containers */}
@@ -1116,3 +1121,14 @@ export function ChartCard({
)
}
+
+const ContainersTable = lazy(() => import("../containers-table/containers-table"))
+
+function LazyContainersTable({ systemId }: { systemId: string }) {
+ const { isIntersecting, ref } = useIntersectionObserver()
+ return (
+