Update AppImage

This commit is contained in:
MacRimi
2025-10-04 19:45:37 +02:00
parent c437753d64
commit c14ea7afdf
2 changed files with 227 additions and 104 deletions

View File

@@ -8,7 +8,9 @@ import { Wifi, Globe, Shield, Activity, Network, Router, AlertCircle, Zap } from
import useSWR from "swr" import useSWR from "swr"
interface NetworkData { interface NetworkData {
interfaces: NetworkInterface[] physical_interfaces?: NetworkInterface[] // Separated physical interfaces
bridge_interfaces?: NetworkInterface[] // Separated bridge interfaces
interfaces?: NetworkInterface[] // Keep for backward compatibility
vm_lxc_interfaces?: NetworkInterface[] vm_lxc_interfaces?: NetworkInterface[]
traffic: { traffic: {
bytes_sent: number bytes_sent: number
@@ -20,8 +22,12 @@ interface NetworkData {
dropin?: number dropin?: number
dropout?: number dropout?: number
} }
active_count?: number physical_active_count?: number // Physical interfaces active count
total_count?: number physical_total_count?: number // Physical interfaces total count
bridge_active_count?: number // Bridge interfaces active count
bridge_total_count?: number // Bridge interfaces total count
active_count?: number // Keep for backward compatibility
total_count?: number // Keep for backward compatibility
vm_lxc_active_count?: number vm_lxc_active_count?: number
vm_lxc_total_count?: number vm_lxc_total_count?: number
} }
@@ -164,6 +170,10 @@ export function NetworkMetrics() {
const trafficOutGB = (networkData.traffic.bytes_sent / 1024 ** 3).toFixed(2) const trafficOutGB = (networkData.traffic.bytes_sent / 1024 ** 3).toFixed(2)
const packetsRecvK = networkData.traffic.packets_recv ? (networkData.traffic.packets_recv / 1000).toFixed(0) : "0" const packetsRecvK = networkData.traffic.packets_recv ? (networkData.traffic.packets_recv / 1000).toFixed(0) : "0"
const physicalInterfaces = networkData.physical_interfaces || []
const bridgeInterfaces = networkData.bridge_interfaces || []
const vmLxcInterfaces = networkData.vm_lxc_interfaces || []
return ( return (
<div className="space-y-6"> <div className="space-y-6">
{/* Network Overview Cards */} {/* Network Overview Cards */}
@@ -189,13 +199,23 @@ export function NetworkMetrics() {
<Network className="h-4 w-4 text-muted-foreground" /> <Network className="h-4 w-4 text-muted-foreground" />
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<div className="text-2xl font-bold text-foreground">{networkData.active_count ?? 0}</div> <div className="text-2xl font-bold text-foreground">
<div className="flex items-center mt-2"> {(networkData.physical_active_count ?? 0) + (networkData.bridge_active_count ?? 0)}
<Badge variant="outline" className="bg-green-500/10 text-green-500 border-green-500/20"> </div>
Online <div className="flex flex-col gap-1 mt-2">
<div className="flex items-center justify-between text-xs">
<span className="text-muted-foreground">Physical:</span>
<Badge variant="outline" className="bg-blue-500/10 text-blue-500 border-blue-500/20">
{networkData.physical_active_count ?? 0}/{networkData.physical_total_count ?? 0}
</Badge> </Badge>
</div> </div>
<p className="text-xs text-muted-foreground mt-2">{networkData.total_count ?? 0} total interfaces</p> <div className="flex items-center justify-between text-xs">
<span className="text-muted-foreground">Bridges:</span>
<Badge variant="outline" className="bg-green-500/10 text-green-500 border-green-500/20">
{networkData.bridge_active_count ?? 0}/{networkData.bridge_total_count ?? 0}
</Badge>
</div>
</div>
</CardContent> </CardContent>
</Card> </Card>
@@ -237,17 +257,20 @@ export function NetworkMetrics() {
</Card> </Card>
</div> </div>
{/* Network Interfaces */} {physicalInterfaces.length > 0 && (
<Card className="bg-card border-border"> <Card className="bg-card border-border">
<CardHeader> <CardHeader>
<CardTitle className="text-foreground flex items-center"> <CardTitle className="text-foreground flex items-center">
<Router className="h-5 w-5 mr-2" /> <Router className="h-5 w-5 mr-2" />
Network Interfaces Physical Interfaces
<Badge variant="outline" className="ml-3 bg-blue-500/10 text-blue-500 border-blue-500/20">
{networkData.physical_active_count ?? 0} / {networkData.physical_total_count ?? 0} Active
</Badge>
</CardTitle> </CardTitle>
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<div className="space-y-4"> <div className="space-y-4">
{networkData.interfaces.map((interface_, index) => { {physicalInterfaces.map((interface_, index) => {
const typeBadge = getInterfaceTypeBadge(interface_.type) const typeBadge = getInterfaceTypeBadge(interface_.type)
return ( return (
@@ -318,8 +341,94 @@ export function NetworkMetrics() {
</div> </div>
</CardContent> </CardContent>
</Card> </Card>
)}
{networkData.vm_lxc_interfaces && networkData.vm_lxc_interfaces.length > 0 && ( {bridgeInterfaces.length > 0 && (
<Card className="bg-card border-border">
<CardHeader>
<CardTitle className="text-foreground flex items-center">
<Network className="h-5 w-5 mr-2" />
Bridge Interfaces
<Badge variant="outline" className="ml-3 bg-green-500/10 text-green-500 border-green-500/20">
{networkData.bridge_active_count ?? 0} / {networkData.bridge_total_count ?? 0} Active
</Badge>
</CardTitle>
</CardHeader>
<CardContent>
<div className="space-y-4">
{bridgeInterfaces.map((interface_, index) => {
const typeBadge = getInterfaceTypeBadge(interface_.type)
return (
<div
key={index}
className="flex flex-col gap-3 p-4 rounded-lg border border-border bg-card/50 hover:bg-card/80 transition-colors cursor-pointer"
onClick={() => setSelectedInterface(interface_)}
>
<div className="flex items-center gap-3 flex-wrap">
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
<div className="flex items-center gap-2 min-w-0">
<div className="font-medium text-foreground">{interface_.name}</div>
<Badge variant="outline" className={typeBadge.color}>
{typeBadge.label}
</Badge>
</div>
<Badge
variant="outline"
className={
interface_.status === "up"
? "bg-green-500/10 text-green-500 border-green-500/20 ml-auto"
: "bg-red-500/10 text-red-500 border-red-500/20 ml-auto"
}
>
{interface_.status.toUpperCase()}
</Badge>
</div>
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
<div>
<div className="text-muted-foreground text-xs">IP Address</div>
<div className="font-medium text-foreground font-mono text-sm truncate">
{interface_.addresses.length > 0 ? interface_.addresses[0].ip : "N/A"}
</div>
</div>
<div>
<div className="text-muted-foreground text-xs">Speed</div>
<div className="font-medium text-foreground flex items-center gap-1">
<Zap className="h-3 w-3" />
{formatSpeed(interface_.speed)}
</div>
</div>
<div className="col-span-2 md:col-span-1">
<div className="text-muted-foreground text-xs">Traffic</div>
<div className="font-medium text-foreground text-xs">
<span className="text-green-500"> {formatBytes(interface_.bytes_recv)}</span>
{" / "}
<span className="text-blue-500"> {formatBytes(interface_.bytes_sent)}</span>
</div>
</div>
{interface_.mac_address && (
<div className="col-span-2 md:col-span-1">
<div className="text-muted-foreground text-xs">MAC</div>
<div className="font-medium text-foreground font-mono text-xs truncate">
{interface_.mac_address}
</div>
</div>
)}
</div>
</div>
)
})}
</div>
</CardContent>
</Card>
)}
{/* VM & LXC Network Interfaces */}
{vmLxcInterfaces.length > 0 && (
<Card className="bg-card border-border"> <Card className="bg-card border-border">
<CardHeader> <CardHeader>
<CardTitle className="text-foreground flex items-center"> <CardTitle className="text-foreground flex items-center">
@@ -332,7 +441,7 @@ export function NetworkMetrics() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<div className="space-y-4"> <div className="space-y-4">
{networkData.vm_lxc_interfaces.map((interface_, index) => { {vmLxcInterfaces.map((interface_, index) => {
const vmTypeBadge = getVMTypeBadge(interface_.vm_type) const vmTypeBadge = getVMTypeBadge(interface_.vm_type)
return ( return (
@@ -406,7 +515,6 @@ export function NetworkMetrics() {
</Card> </Card>
)} )}
{/* Interface Details Modal */}
<Dialog open={!!selectedInterface} onOpenChange={() => setSelectedInterface(null)}> <Dialog open={!!selectedInterface} onOpenChange={() => setSelectedInterface(null)}>
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto"> <DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
<DialogHeader> <DialogHeader>

View File

@@ -857,7 +857,7 @@ def get_proxmox_storage():
print(f"[v0] pvesm status failed with return code {result.returncode}") print(f"[v0] pvesm status failed with return code {result.returncode}")
print(f"[v0] stderr: {result.stderr}") print(f"[v0] stderr: {result.stderr}")
return { return {
'error': 'pvesm command not available or failed', 'error': 'pvesh command not available or failed',
'storage': [] 'storage': []
} }
@@ -1001,11 +1001,12 @@ def get_bridge_info(bridge_name):
return bridge_info return bridge_info
def get_network_info(): def get_network_info():
"""Get network interface information - Enhanced with VM/LXC interface separation""" """Get network interface information - Enhanced with separation of physical and bridge interfaces"""
try: try:
network_data = { network_data = {
'interfaces': [], 'physical_interfaces': [], # Separated physical interfaces
'vm_lxc_interfaces': [], # Added separate list for VM/LXC interfaces 'bridge_interfaces': [], # Separated bridge interfaces
'vm_lxc_interfaces': [],
'traffic': {'bytes_sent': 0, 'bytes_recv': 0, 'packets_sent': 0, 'packets_recv': 0} 'traffic': {'bytes_sent': 0, 'bytes_recv': 0, 'packets_sent': 0, 'packets_recv': 0}
} }
@@ -1021,8 +1022,10 @@ def get_network_info():
print(f"[v0] Error getting per-NIC stats: {e}") print(f"[v0] Error getting per-NIC stats: {e}")
net_io_per_nic = {} net_io_per_nic = {}
active_count = 0 physical_active_count = 0
total_count = 0 physical_total_count = 0
bridge_active_count = 0
bridge_total_count = 0
vm_lxc_active_count = 0 vm_lxc_active_count = 0
vm_lxc_total_count = 0 vm_lxc_total_count = 0
@@ -1041,10 +1044,14 @@ def get_network_info():
vm_lxc_total_count += 1 vm_lxc_total_count += 1
if stats.isup: if stats.isup:
vm_lxc_active_count += 1 vm_lxc_active_count += 1
else: elif interface_type == 'physical':
total_count += 1 physical_total_count += 1
if stats.isup: if stats.isup:
active_count += 1 physical_active_count += 1
elif interface_type == 'bridge':
bridge_total_count += 1
if stats.isup:
bridge_active_count += 1
interface_info = { interface_info = {
'name': interface_name, 'name': interface_name,
@@ -1115,15 +1122,20 @@ def get_network_info():
if interface_type == 'vm_lxc': if interface_type == 'vm_lxc':
network_data['vm_lxc_interfaces'].append(interface_info) network_data['vm_lxc_interfaces'].append(interface_info)
else: elif interface_type == 'physical':
network_data['interfaces'].append(interface_info) network_data['physical_interfaces'].append(interface_info)
elif interface_type == 'bridge':
network_data['bridge_interfaces'].append(interface_info)
network_data['active_count'] = active_count network_data['physical_active_count'] = physical_active_count
network_data['total_count'] = total_count network_data['physical_total_count'] = physical_total_count
network_data['bridge_active_count'] = bridge_active_count
network_data['bridge_total_count'] = bridge_total_count
network_data['vm_lxc_active_count'] = vm_lxc_active_count network_data['vm_lxc_active_count'] = vm_lxc_active_count
network_data['vm_lxc_total_count'] = vm_lxc_total_count network_data['vm_lxc_total_count'] = vm_lxc_total_count
print(f"[v0] Physical interfaces: {active_count} active out of {total_count} total") print(f"[v0] Physical interfaces: {physical_active_count} active out of {physical_total_count} total")
print(f"[v0] Bridge interfaces: {bridge_active_count} active out of {bridge_total_count} total")
print(f"[v0] VM/LXC interfaces: {vm_lxc_active_count} active out of {vm_lxc_total_count} total") print(f"[v0] VM/LXC interfaces: {vm_lxc_active_count} active out of {vm_lxc_total_count} total")
# Get network I/O statistics (global) # Get network I/O statistics (global)
@@ -1159,11 +1171,14 @@ def get_network_info():
traceback.print_exc() traceback.print_exc()
return { return {
'error': f'Unable to access network information: {str(e)}', 'error': f'Unable to access network information: {str(e)}',
'interfaces': [], 'physical_interfaces': [],
'bridge_interfaces': [],
'vm_lxc_interfaces': [], 'vm_lxc_interfaces': [],
'traffic': {'bytes_sent': 0, 'bytes_recv': 0, 'packets_sent': 0, 'packets_recv': 0}, 'traffic': {'bytes_sent': 0, 'bytes_recv': 0, 'packets_sent': 0, 'packets_recv': 0},
'active_count': 0, 'physical_active_count': 0,
'total_count': 0, 'physical_total_count': 0,
'bridge_active_count': 0,
'bridge_total_count': 0,
'vm_lxc_active_count': 0, 'vm_lxc_active_count': 0,
'vm_lxc_total_count': 0 'vm_lxc_total_count': 0
} }