fix(frontend): recharts Legend export and implicit any in monitoring

This commit is contained in:
sagitchu
2026-03-20 12:36:48 +08:00
parent 3c57a5ac84
commit ce9abf457f
@@ -13,7 +13,6 @@ import {
CartesianGrid, CartesianGrid,
Tooltip, Tooltip,
ResponsiveContainer, ResponsiveContainer,
Legend,
} from "recharts"; } from "recharts";
import { import {
RefreshCw, RefreshCw,
@@ -488,7 +487,7 @@ export function TunnelMonitorView({ viewMode = "grid" }: TunnelMonitorViewProps)
<YAxis <YAxis
fontSize={11} fontSize={11}
tick={{ fill: "#888" }} tick={{ fill: "#888" }}
tickFormatter={(v) => `${Number(v).toFixed(0)}ms`} tickFormatter={(v: any) => `${Number(v).toFixed(0)}ms`}
label={{ value: "延迟 (ms)", angle: -90, position: "insideLeft", style: { fontSize: 11, fill: "#888" } }} label={{ value: "延迟 (ms)", angle: -90, position: "insideLeft", style: { fontSize: 11, fill: "#888" } }}
/> />
<Tooltip <Tooltip
@@ -501,13 +500,7 @@ export function TunnelMonitorView({ viewMode = "grid" }: TunnelMonitorViewProps)
return [`${n.toFixed(1)}ms`, label]; return [`${n.toFixed(1)}ms`, label];
}} }}
/> />
<Legend
formatter={(value: string) => {
if (value === "entryToExit") return "入口→出口";
if (value === "exitToBing") return "出口→Bing";
return value;
}}
/>
<Line <Line
connectNulls connectNulls
dataKey="entryToExit" dataKey="entryToExit"
@@ -569,7 +562,7 @@ export function TunnelMonitorView({ viewMode = "grid" }: TunnelMonitorViewProps)
labelStyle={{ color: "#fff" }} labelStyle={{ color: "#fff" }}
formatter={tunnelTooltipFormatter} formatter={tunnelTooltipFormatter}
/> />
<Legend />
<Line dataKey="bytesIn" dot={false} name="入站流量" stroke="#10b981" strokeWidth={2} type="monotone" /> <Line dataKey="bytesIn" dot={false} name="入站流量" stroke="#10b981" strokeWidth={2} type="monotone" />
<Line dataKey="bytesOut" dot={false} name="出站流量" stroke="#ef4444" strokeWidth={2} type="monotone" /> <Line dataKey="bytesOut" dot={false} name="出站流量" stroke="#ef4444" strokeWidth={2} type="monotone" />
</LineChart> </LineChart>