mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 11:36:17 +00:00
Update network-traffic-chart.tsx
This commit is contained in:
@@ -54,6 +54,7 @@ export function NetworkTrafficChart({
|
|||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setIsInitialLoad(true)
|
||||||
fetchMetrics()
|
fetchMetrics()
|
||||||
}, [timeframe, interfaceName])
|
}, [timeframe, interfaceName])
|
||||||
|
|
||||||
@@ -68,7 +69,9 @@ export function NetworkTrafficChart({
|
|||||||
}, [timeframe, interfaceName, refreshInterval])
|
}, [timeframe, interfaceName, refreshInterval])
|
||||||
|
|
||||||
const fetchMetrics = async () => {
|
const fetchMetrics = async () => {
|
||||||
setLoading(true)
|
if (isInitialLoad) {
|
||||||
|
setLoading(true)
|
||||||
|
}
|
||||||
setError(null)
|
setError(null)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -202,7 +205,7 @@ export function NetworkTrafficChart({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loading) {
|
if (loading && isInitialLoad) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-[300px]">
|
<div className="flex items-center justify-center h-[300px]">
|
||||||
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
||||||
@@ -259,8 +262,9 @@ export function NetworkTrafficChart({
|
|||||||
fillOpacity={0.3}
|
fillOpacity={0.3}
|
||||||
name="Received"
|
name="Received"
|
||||||
hide={!visibleLines.netIn}
|
hide={!visibleLines.netIn}
|
||||||
isAnimationActive={isInitialLoad}
|
isAnimationActive={true}
|
||||||
animationDuration={800}
|
animationDuration={300}
|
||||||
|
animationEasing="ease-in-out"
|
||||||
/>
|
/>
|
||||||
<Area
|
<Area
|
||||||
type="monotone"
|
type="monotone"
|
||||||
@@ -271,8 +275,9 @@ export function NetworkTrafficChart({
|
|||||||
fillOpacity={0.3}
|
fillOpacity={0.3}
|
||||||
name="Sent"
|
name="Sent"
|
||||||
hide={!visibleLines.netOut}
|
hide={!visibleLines.netOut}
|
||||||
isAnimationActive={isInitialLoad}
|
isAnimationActive={true}
|
||||||
animationDuration={800}
|
animationDuration={300}
|
||||||
|
animationEasing="ease-in-out"
|
||||||
/>
|
/>
|
||||||
</AreaChart>
|
</AreaChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user