Update network-metrics.tsx

This commit is contained in:
MacRimi
2025-10-25 21:36:46 +02:00
parent 042e6584eb
commit 35c50a7c60

View File

@@ -789,23 +789,55 @@ export function NetworkMetrics() {
</div> </div>
)} )}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
{/* Traffic Statistics - Left Column */}
<div> <div>
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Traffic since last boot</h3> <h3 className="text-sm font-semibold text-muted-foreground mb-4">
Network Traffic Statistics (
{modalTimeframe === "hour"
? "Last Hour"
: modalTimeframe === "day"
? "Last 24 Hours"
: modalTimeframe === "week"
? "Last 7 Days"
: modalTimeframe === "month"
? "Last 30 Days"
: "Last Year"}
)
</h3>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
{/* Traffic Data - Left Column */}
<div className="space-y-4">
<div className="grid grid-cols-2 gap-4"> <div className="grid grid-cols-2 gap-4">
<div> <div>
<div className="text-sm text-muted-foreground">Bytes Received</div> <div className="text-sm text-muted-foreground">Bytes Received</div>
<div className="font-medium text-green-500"> <div className="font-medium text-green-500 text-lg">
{formatStorage(interfaceTotals.received * 1024 * 1024 * 1024)} {formatStorage(interfaceTotals.received * 1024 * 1024 * 1024)}
</div> </div>
</div> </div>
<div> <div>
<div className="text-sm text-muted-foreground">Bytes Sent</div> <div className="text-sm text-muted-foreground">Bytes Sent</div>
<div className="font-medium text-blue-500"> <div className="font-medium text-blue-500 text-lg">
{formatStorage(interfaceTotals.sent * 1024 * 1024 * 1024)} {formatStorage(interfaceTotals.sent * 1024 * 1024 * 1024)}
</div> </div>
</div> </div>
</div>
</div>
{/* Network Traffic Chart - Right Column */}
<div className="bg-muted/30 rounded-lg p-4">
<NetworkTrafficChart
timeframe={modalTimeframe}
interfaceName={selectedInterface.name}
onTotalsCalculated={setInterfaceTotals}
/>
</div>
</div>
</div>
<div>
<h3 className="text-sm font-semibold text-muted-foreground mb-4">
Cumulative Statistics (Since Last Boot)
</h3>
<div className="grid grid-cols-2 gap-4">
<div> <div>
<div className="text-sm text-muted-foreground">Packets Received</div> <div className="text-sm text-muted-foreground">Packets Received</div>
<div className="font-medium">{selectedInterface.packets_recv?.toLocaleString() || "N/A"}</div> <div className="font-medium">{selectedInterface.packets_recv?.toLocaleString() || "N/A"}</div>
@@ -853,19 +885,6 @@ export function NetworkMetrics() {
</div> </div>
</div> </div>
{/* Network Traffic Chart - Right Column */}
<div>
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Network Traffic History</h3>
<div className="bg-muted/30 rounded-lg p-4">
<NetworkTrafficChart
timeframe={modalTimeframe}
interfaceName={selectedInterface.name}
onTotalsCalculated={setInterfaceTotals}
/>
</div>
</div>
</div>
{/* Bond Information */} {/* Bond Information */}
{selectedInterface.type === "bond" && selectedInterface.bond_slaves && ( {selectedInterface.type === "bond" && selectedInterface.bond_slaves && (
<div> <div>