diff --git a/beszel/site/bun.lockb b/beszel/site/bun.lockb index 92418a3..ee6192e 100755 Binary files a/beszel/site/bun.lockb and b/beszel/site/bun.lockb differ diff --git a/beszel/site/package.json b/beszel/site/package.json index 0c354ca..ac8711f 100644 --- a/beszel/site/package.json +++ b/beszel/site/package.json @@ -21,6 +21,7 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-toast": "^1.2.1", + "@radix-ui/react-toggle": "^1.1.0", "@radix-ui/react-tooltip": "^1.1.2", "@tanstack/react-table": "^8.20.1", "@vitejs/plugin-react": "^4.3.1", diff --git a/beszel/site/src/components/charts/chart-time-select.tsx b/beszel/site/src/components/charts/chart-time-select.tsx index 26a4018..ce7cc5f 100644 --- a/beszel/site/src/components/charts/chart-time-select.tsx +++ b/beszel/site/src/components/charts/chart-time-select.tsx @@ -21,7 +21,7 @@ export default function ChartTimeSelect({ className }: { className?: string }) { onValueChange={(value: ChartTimes) => $chartTime.set(value)} > - + diff --git a/beszel/site/src/components/routes/system.tsx b/beszel/site/src/components/routes/system.tsx index 234421a..9bfbd96 100644 --- a/beszel/site/src/components/routes/system.tsx +++ b/beszel/site/src/components/routes/system.tsx @@ -4,12 +4,20 @@ import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } fro import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '../ui/card' import { useStore } from '@nanostores/react' import Spinner from '../spinner' -import { ClockArrowUp, CpuIcon, GlobeIcon } from 'lucide-react' +import { ClockArrowUp, CpuIcon, GlobeIcon, LayoutGridIcon } from 'lucide-react' import ChartTimeSelect from '../charts/chart-time-select' -import { chartTimeData, cn, getPbTimestamp, useClampedIsInViewport } from '@/lib/utils' +import { + chartTimeData, + cn, + getPbTimestamp, + useClampedIsInViewport, + useLocalStorage, +} from '@/lib/utils' import { Separator } from '../ui/separator' import { scaleTime } from 'd3-scale' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip' +import { Toggle } from '../ui/toggle' +import { buttonVariants } from '../ui/button' const CpuChart = lazy(() => import('../charts/cpu-chart')) const ContainerCpuChart = lazy(() => import('../charts/container-cpu-chart')) @@ -25,6 +33,7 @@ const TemperatureChart = lazy(() => import('../charts/temperature-chart')) export default function SystemDetail({ name }: { name: string }) { const systems = useStore($systems) const chartTime = useStore($chartTime) + const [grid, setGrid] = useLocalStorage('grid', true) const [ticks, setTicks] = useState([] as number[]) const [system, setSystem] = useState({} as SystemRecord) const [systemStats, setSystemStats] = useState([] as SystemStatsRecord[]) @@ -244,57 +253,96 @@ export default function SystemDetail({ name }: { name: string }) { )} - +
+ + + + + + + + + + + Toggle grid + + +
- + {hasDockerStats && ( - + )} - + {hasDockerStats && ( - + )} {(systemStats.at(-1)?.stats.s ?? 0) > 0 && ( - + )} + + + + {systemStats.at(-1)?.stats.t && ( - + )} - - - - - + - + {hasDockerStats && dockerNetChartData.length > 0 && ( <> @@ -319,21 +367,23 @@ function ChartCard({ title, description, children, + grid, }: { title: string description: string children: React.ReactNode + grid: boolean }) { const target = useRef(null) const [isInViewport, wrappedTargetRef] = useClampedIsInViewport({ target: target }) return ( - + {title} {description} - {/*
- -
*/}
{} diff --git a/beszel/site/src/components/systems-table/systems-table.tsx b/beszel/site/src/components/systems-table/systems-table.tsx index 07a3267..6953473 100644 --- a/beszel/site/src/components/systems-table/systems-table.tsx +++ b/beszel/site/src/components/systems-table/systems-table.tsx @@ -135,7 +135,7 @@ export default function SystemsTable({ filter }: { filter?: string }) {