diff --git a/src/hooks/useLoadCharts.ts b/src/hooks/useLoadCharts.ts index be30529..55c9da5 100644 --- a/src/hooks/useLoadCharts.ts +++ b/src/hooks/useLoadCharts.ts @@ -118,7 +118,7 @@ export const useLoadCharts = (node: NodeData | null, hours: number) => { })); let filledData; - if (hours === 1) { + if (hours <= 4) { filledData = fillMissingTimePoints( stringifiedData, minute, diff --git a/src/pages/instance/PingChart.tsx b/src/pages/instance/PingChart.tsx index 7ca7d8f..6b3a3be 100644 --- a/src/pages/instance/PingChart.tsx +++ b/src/pages/instance/PingChart.tsx @@ -1,4 +1,7 @@ import { memo, useState, useMemo, useCallback, useEffect } from "react"; +import { Button } from "@/components/ui/button"; +import { useIsMobile } from "@/hooks/useMobile"; +import { Eye, EyeOff } from "lucide-react"; import { LineChart, Line, @@ -35,6 +38,7 @@ const PingChart = memo(({ node, hours }: PingChartProps) => { useConfigItem("enableConnectBreaks") ); const maxPointsToRender = useConfigItem("pingChartMaxPoints") || 0; // 0表示不限制 + const isMobile = useIsMobile(); useEffect(() => { if (pingHistory?.tasks) { @@ -143,6 +147,15 @@ const PingChart = memo(({ node, hours }: PingChartProps) => { ); }; + const handleToggleAll = () => { + if (!pingHistory?.tasks) return; + if (visiblePingTasks.length === pingHistory.tasks.length) { + setVisiblePingTasks([]); + } else { + setVisiblePingTasks(pingHistory.tasks.map((t) => t.id)); + } + }; + const sortedTasks = useMemo(() => { if (!pingHistory?.tasks) return []; return [...pingHistory.tasks].sort((a, b) => a.name.localeCompare(b.name)); @@ -259,8 +272,8 @@ const PingChart = memo(({ node, hours }: PingChartProps) => { -
-
+
+
{
+
+ +
diff --git a/src/pages/instance/index.tsx b/src/pages/instance/index.tsx index b59d124..214a5a6 100644 --- a/src/pages/instance/index.tsx +++ b/src/pages/instance/index.tsx @@ -39,7 +39,7 @@ const InstancePage = () => { return [ { label: "实时", hours: 0 }, { label: "1小时", hours: 1 }, - { label: "6小时", hours: 6 }, + { label: "4小时", hours: 4 }, { label: "1天", hours: 24 }, { label: "7天", hours: 168 }, { label: "30天", hours: 720 },