diff --git a/beszel/site/src/components/charts/area-chart.tsx b/beszel/site/src/components/charts/area-chart.tsx index 28ab3b5..1efa143 100644 --- a/beszel/site/src/components/charts/area-chart.tsx +++ b/beszel/site/src/components/charts/area-chart.tsx @@ -68,6 +68,10 @@ export default memo(function AreaChartDefault({ // console.log('Rendered at', new Date()) + if (chartData.systemStats.length === 0) { + return null + } + return (
{/* {!yAxisSet && } */} diff --git a/beszel/site/src/components/charts/swap-chart.tsx b/beszel/site/src/components/charts/swap-chart.tsx index 251a05d..745cb45 100644 --- a/beszel/site/src/components/charts/swap-chart.tsx +++ b/beszel/site/src/components/charts/swap-chart.tsx @@ -15,6 +15,10 @@ import { memo } from "react" export default memo(function SwapChart({ chartData }: { chartData: ChartData }) { const { yAxisWidth, updateYAxisWidth } = useYAxisWidth() + if (chartData.systemStats.length === 0) { + return null + } + return (
{ const newChartData = { data: [], colors: {} } as { diff --git a/beszel/site/src/components/routes/system.tsx b/beszel/site/src/components/routes/system.tsx index 23818da..fe95d32 100644 --- a/beszel/site/src/components/routes/system.tsx +++ b/beszel/site/src/components/routes/system.tsx @@ -100,7 +100,7 @@ export default function SystemDetail({ name }: { name: string }) { const netCardRef = useRef(null) const [containerFilterBar, setContainerFilterBar] = useState(null as null | JSX.Element) const [bottomSpacing, setBottomSpacing] = useState(0) - const [chartLoading, setChartLoading] = useState(false) + const [chartLoading, setChartLoading] = useState(true) const isLongerChart = chartTime !== "1h" useEffect(() => { @@ -281,7 +281,7 @@ export default function SystemDetail({ name }: { name: string }) { return null } - // if no data, show empty state + // if no data, show empty message const dataEmpty = !chartLoading && chartData.systemStats.length === 0 return ( @@ -594,6 +594,7 @@ function ChartCard({ cornerEl?: JSX.Element | null }) { const { isIntersecting, ref } = useIntersectionObserver() + const { t } = useTranslation() return ( @@ -603,7 +604,7 @@ function ChartCard({ {cornerEl &&
{cornerEl}
}
- {} + {} {isIntersecting && children}
diff --git a/beszel/site/src/components/spinner.tsx b/beszel/site/src/components/spinner.tsx index 8c677a9..81b3c3b 100644 --- a/beszel/site/src/components/spinner.tsx +++ b/beszel/site/src/components/spinner.tsx @@ -1,12 +1,13 @@ import { LoaderCircleIcon } from "lucide-react" -import { useTranslation } from "react-i18next" -export default function (props: { empty?: boolean }) { - const { t } = useTranslation() +export default function ({ msg }: { msg?: string }) { return (
- - {props.empty &&

{t("monitor.waiting_for")}

} + {msg ? ( +

{msg}

+ ) : ( + + )}
) }