mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-17 19:16:25 +00:00
Update AppImage
This commit is contained in:
@@ -13,7 +13,6 @@ interface NetworkMetricsData {
|
||||
|
||||
interface NetworkTrafficChartProps {
|
||||
timeframe: string
|
||||
interfaceName?: string // Added optional interfaceName prop for specific interface data
|
||||
onTotalsCalculated?: (totals: { received: number; sent: number }) => void
|
||||
}
|
||||
|
||||
@@ -37,7 +36,7 @@ const CustomNetworkTooltip = ({ active, payload, label }: any) => {
|
||||
return null
|
||||
}
|
||||
|
||||
export function NetworkTrafficChart({ timeframe, interfaceName, onTotalsCalculated }: NetworkTrafficChartProps) {
|
||||
export function NetworkTrafficChart({ timeframe, onTotalsCalculated }: NetworkTrafficChartProps) {
|
||||
const [data, setData] = useState<NetworkMetricsData[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
@@ -48,7 +47,7 @@ export function NetworkTrafficChart({ timeframe, interfaceName, onTotalsCalculat
|
||||
|
||||
useEffect(() => {
|
||||
fetchMetrics()
|
||||
}, [timeframe, interfaceName])
|
||||
}, [timeframe])
|
||||
|
||||
const fetchMetrics = async () => {
|
||||
setLoading(true)
|
||||
@@ -57,15 +56,12 @@ export function NetworkTrafficChart({ timeframe, interfaceName, onTotalsCalculat
|
||||
try {
|
||||
const baseUrl =
|
||||
typeof window !== "undefined" ? `${window.location.protocol}//${window.location.hostname}:8008` : ""
|
||||
|
||||
const apiUrl = interfaceName
|
||||
? `${baseUrl}/api/network/${interfaceName}/history?timeframe=${timeframe}`
|
||||
: `${baseUrl}/api/node/metrics?timeframe=${timeframe}`
|
||||
const apiUrl = `${baseUrl}/api/node/metrics?timeframe=${timeframe}`
|
||||
|
||||
const response = await fetch(apiUrl)
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch network metrics: ${response.status}`)
|
||||
throw new Error(`Failed to fetch node metrics: ${response.status}`)
|
||||
}
|
||||
|
||||
const result = await response.json()
|
||||
|
||||
Reference in New Issue
Block a user