mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-11 12:26:18 +00:00
Update AppImage
This commit is contained in:
@@ -4,7 +4,7 @@ import { useState } from "react"
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card"
|
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card"
|
||||||
import { Badge } from "./ui/badge"
|
import { Badge } from "./ui/badge"
|
||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog"
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog"
|
||||||
import { Wifi, Activity, Network, Router, AlertCircle, Zap, Shield } from "lucide-react"
|
import { Wifi, Activity, Network, Router, AlertCircle, Zap } from "lucide-react"
|
||||||
import useSWR from "swr"
|
import useSWR from "swr"
|
||||||
|
|
||||||
interface NetworkData {
|
interface NetworkData {
|
||||||
@@ -214,36 +214,6 @@ export function NetworkMetrics() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="bg-card border-border">
|
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
||||||
<CardTitle className="text-sm font-medium text-muted-foreground">Firewall Status</CardTitle>
|
|
||||||
<Shield className="h-4 w-4 text-muted-foreground" />
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent>
|
|
||||||
<div className="text-2xl font-bold text-foreground">Active</div>
|
|
||||||
<Badge variant="outline" className="bg-green-500/10 text-green-500 border-green-500/20 mt-2">
|
|
||||||
Protected
|
|
||||||
</Badge>
|
|
||||||
<p className="text-xs text-muted-foreground mt-2">System protected</p>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Card className="bg-card border-border">
|
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
|
||||||
<CardTitle className="text-sm font-medium text-muted-foreground">Packets</CardTitle>
|
|
||||||
<Activity className="h-4 w-4 text-muted-foreground" />
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent>
|
|
||||||
<div className="text-2xl font-bold text-foreground">{packetsRecvK}K</div>
|
|
||||||
<Badge variant="outline" className="bg-green-500/10 text-green-500 border-green-500/20 mt-2">
|
|
||||||
Received
|
|
||||||
</Badge>
|
|
||||||
<p className="text-xs text-muted-foreground mt-2">No packet loss</p>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{networkData.physical_interfaces && networkData.physical_interfaces.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">
|
||||||
@@ -268,7 +238,7 @@ export function NetworkMetrics() {
|
|||||||
{/* First row: Icon, Name, Type Badge, Status */}
|
{/* First row: Icon, Name, Type Badge, Status */}
|
||||||
<div className="flex items-center gap-3 flex-wrap">
|
<div className="flex items-center gap-3 flex-wrap">
|
||||||
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
|
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
|
||||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
<div className="flex items-center gap-2 min-w-0 flex-1 flex-wrap">
|
||||||
<div className="font-medium text-foreground">{interface_.name}</div>
|
<div className="font-medium text-foreground">{interface_.name}</div>
|
||||||
<Badge variant="outline" className={typeBadge.color}>
|
<Badge variant="outline" className={typeBadge.color}>
|
||||||
{typeBadge.label}
|
{typeBadge.label}
|
||||||
@@ -327,7 +297,6 @@ export function NetworkMetrics() {
|
|||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
|
||||||
|
|
||||||
{networkData.bridge_interfaces && networkData.bridge_interfaces.length > 0 && (
|
{networkData.bridge_interfaces && networkData.bridge_interfaces.length > 0 && (
|
||||||
<Card className="bg-card border-border">
|
<Card className="bg-card border-border">
|
||||||
@@ -354,7 +323,7 @@ export function NetworkMetrics() {
|
|||||||
{/* First row: Icon, Name, Type Badge, Physical Interface, Status */}
|
{/* First row: Icon, Name, Type Badge, Physical Interface, Status */}
|
||||||
<div className="flex items-center gap-3 flex-wrap">
|
<div className="flex items-center gap-3 flex-wrap">
|
||||||
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
|
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
|
||||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
<div className="flex items-center gap-2 min-w-0 flex-1 flex-wrap">
|
||||||
<div className="font-medium text-foreground">{interface_.name}</div>
|
<div className="font-medium text-foreground">{interface_.name}</div>
|
||||||
<Badge variant="outline" className={typeBadge.color}>
|
<Badge variant="outline" className={typeBadge.color}>
|
||||||
{typeBadge.label}
|
{typeBadge.label}
|
||||||
@@ -371,7 +340,7 @@ export function NetworkMetrics() {
|
|||||||
)
|
)
|
||||||
if (bondInterface?.bond_slaves && bondInterface.bond_slaves.length > 0) {
|
if (bondInterface?.bond_slaves && bondInterface.bond_slaves.length > 0) {
|
||||||
return (
|
return (
|
||||||
<span className="text-muted-foreground text-xs">
|
<span className="text-muted-foreground text-xs flex-wrap">
|
||||||
({bondInterface.bond_slaves.join(", ")})
|
({bondInterface.bond_slaves.join(", ")})
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
@@ -381,7 +350,7 @@ export function NetworkMetrics() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{interface_.bridge_bond_slaves && interface_.bridge_bond_slaves.length > 0 && (
|
{interface_.bridge_bond_slaves && interface_.bridge_bond_slaves.length > 0 && (
|
||||||
<span className="text-muted-foreground text-xs">
|
<span className="text-muted-foreground text-xs flex-wrap">
|
||||||
({interface_.bridge_bond_slaves.join(", ")})
|
({interface_.bridge_bond_slaves.join(", ")})
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -468,7 +437,7 @@ export function NetworkMetrics() {
|
|||||||
{/* First row: Icon, Name, VM/LXC Badge, VM Name, Status */}
|
{/* First row: Icon, Name, VM/LXC Badge, VM Name, Status */}
|
||||||
<div className="flex items-center gap-3 flex-wrap">
|
<div className="flex items-center gap-3 flex-wrap">
|
||||||
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
|
<Wifi className="h-5 w-5 text-muted-foreground flex-shrink-0" />
|
||||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
<div className="flex items-center gap-2 min-w-0 flex-1 flex-wrap">
|
||||||
<div className="font-medium text-foreground">{interface_.name}</div>
|
<div className="font-medium text-foreground">{interface_.name}</div>
|
||||||
<Badge variant="outline" className={vmTypeBadge.color}>
|
<Badge variant="outline" className={vmTypeBadge.color}>
|
||||||
{vmTypeBadge.label}
|
{vmTypeBadge.label}
|
||||||
@@ -529,6 +498,7 @@ export function NetworkMetrics() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Interface Details Modal */}
|
{/* Interface Details Modal */}
|
||||||
<Dialog open={!!selectedInterface} onOpenChange={() => setSelectedInterface(null)}>
|
<Dialog open={!!selectedInterface} onOpenChange={() => setSelectedInterface(null)}>
|
||||||
@@ -562,6 +532,51 @@ export function NetworkMetrics() {
|
|||||||
<div className="font-medium text-blue-500 text-lg">
|
<div className="font-medium text-blue-500 text-lg">
|
||||||
{selectedInterface.bridge_physical_interface}
|
{selectedInterface.bridge_physical_interface}
|
||||||
</div>
|
</div>
|
||||||
|
{selectedInterface.bridge_physical_interface.startsWith("bond") &&
|
||||||
|
networkData?.physical_interfaces && (
|
||||||
|
<>
|
||||||
|
{(() => {
|
||||||
|
const bondInterface = networkData.physical_interfaces.find(
|
||||||
|
(iface) => iface.name === selectedInterface.bridge_physical_interface,
|
||||||
|
)
|
||||||
|
if (bondInterface?.bond_slaves && bondInterface.bond_slaves.length > 0) {
|
||||||
|
return (
|
||||||
|
<div className="mt-2">
|
||||||
|
<div className="text-sm text-muted-foreground mb-2">Bond Slave Interfaces</div>
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{bondInterface.bond_slaves.map((slave, idx) => (
|
||||||
|
<Badge
|
||||||
|
key={idx}
|
||||||
|
variant="outline"
|
||||||
|
className="bg-purple-500/10 text-purple-500 border-purple-500/20"
|
||||||
|
>
|
||||||
|
{slave}
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})()}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{selectedInterface.bridge_bond_slaves && selectedInterface.bridge_bond_slaves.length > 0 && (
|
||||||
|
<div className="mt-2">
|
||||||
|
<div className="text-sm text-muted-foreground mb-2">Bond Slave Interfaces</div>
|
||||||
|
<div className="flex flex-wrap gap-2">
|
||||||
|
{selectedInterface.bridge_bond_slaves.map((slave, idx) => (
|
||||||
|
<Badge
|
||||||
|
key={idx}
|
||||||
|
variant="outline"
|
||||||
|
className="bg-purple-500/10 text-purple-500 border-purple-500/20"
|
||||||
|
>
|
||||||
|
{slave}
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{selectedInterface.type === "vm_lxc" && selectedInterface.vm_name && (
|
{selectedInterface.type === "vm_lxc" && selectedInterface.vm_name && (
|
||||||
|
@@ -19,6 +19,7 @@ import {
|
|||||||
RotateCcw,
|
RotateCcw,
|
||||||
StopCircle,
|
StopCircle,
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
|
CheckCircle,
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
import useSWR from "swr"
|
import useSWR from "swr"
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ interface VMData {
|
|||||||
netout?: number
|
netout?: number
|
||||||
diskread?: number
|
diskread?: number
|
||||||
diskwrite?: number
|
diskwrite?: number
|
||||||
|
ipaddress?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface VMConfig {
|
interface VMConfig {
|
||||||
@@ -251,6 +253,32 @@ export function VirtualMachines() {
|
|||||||
return false
|
return false
|
||||||
}, [totalAllocatedMemoryGB, physicalMemoryGB])
|
}, [totalAllocatedMemoryGB, physicalMemoryGB])
|
||||||
|
|
||||||
|
const getMemoryOvercommitBadge = () => {
|
||||||
|
if (!physicalMemoryGB) return null
|
||||||
|
|
||||||
|
const allocated = Number.parseFloat(totalAllocatedMemoryGB)
|
||||||
|
const physical = Number.parseFloat(physicalMemoryGB)
|
||||||
|
const overcommitPercent = ((allocated / physical) * 100).toFixed(0)
|
||||||
|
|
||||||
|
if (allocated > physical) {
|
||||||
|
return {
|
||||||
|
color: "bg-yellow-500/10 text-yellow-500 border-yellow-500/20",
|
||||||
|
icon: <AlertTriangle className="h-3 w-3" />,
|
||||||
|
label: "Overcommit",
|
||||||
|
message: `${overcommitPercent}% de memoria física`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
color: "bg-green-500/10 text-green-500 border-green-500/20",
|
||||||
|
icon: <CheckCircle className="h-3 w-3" />,
|
||||||
|
label: "Normal",
|
||||||
|
message: `${overcommitPercent}% de memoria física`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const memoryBadge = getMemoryOvercommitBadge()
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
@@ -306,22 +334,20 @@ export function VirtualMachines() {
|
|||||||
<Card className={`bg-card ${isMemoryOvercommit ? "border-yellow-500/50" : "border-border"}`}>
|
<Card className={`bg-card ${isMemoryOvercommit ? "border-yellow-500/50" : "border-border"}`}>
|
||||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||||
<CardTitle className="text-sm font-medium text-muted-foreground">Total Memory</CardTitle>
|
<CardTitle className="text-sm font-medium text-muted-foreground">Total Memory</CardTitle>
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{isMemoryOvercommit && <AlertTriangle className="h-4 w-4 text-yellow-500" />}
|
|
||||||
<MemoryStick className="h-4 w-4 text-muted-foreground" />
|
<MemoryStick className="h-4 w-4 text-muted-foreground" />
|
||||||
</div>
|
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className={`text-2xl font-bold ${isMemoryOvercommit ? "text-yellow-500" : "text-foreground"}`}>
|
<div className={`text-2xl font-bold ${isMemoryOvercommit ? "text-yellow-500" : "text-foreground"}`}>
|
||||||
{totalAllocatedMemoryGB} GB
|
{totalAllocatedMemoryGB} GB
|
||||||
</div>
|
</div>
|
||||||
{isMemoryOvercommit ? (
|
{memoryBadge && (
|
||||||
<p className="text-xs text-yellow-500 mt-2 flex items-center gap-1">
|
<div className="mt-2 space-y-1">
|
||||||
<AlertTriangle className="h-3 w-3" />
|
<Badge variant="outline" className={`${memoryBadge.color} text-xs`}>
|
||||||
Overcommit: Excede memoria física ({physicalMemoryGB} GB)
|
<span className="mr-1">{memoryBadge.icon}</span>
|
||||||
</p>
|
{memoryBadge.label}
|
||||||
) : (
|
</Badge>
|
||||||
<p className="text-xs text-muted-foreground mt-2">Allocated RAM</p>
|
<p className="text-xs text-muted-foreground">{memoryBadge.message}</p>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -396,6 +422,13 @@ export function VirtualMachines() {
|
|||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{vm.type === "lxc" && vm.ipaddress && (
|
||||||
|
<div className="mb-4 pb-4 border-b border-border">
|
||||||
|
<div className="text-sm text-muted-foreground mb-1">IP Address</div>
|
||||||
|
<div className="text-base font-semibold text-blue-500 font-mono">{vm.ipaddress}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
<div>
|
<div>
|
||||||
<div className="text-sm text-muted-foreground mb-2">CPU Usage</div>
|
<div className="text-sm text-muted-foreground mb-2">CPU Usage</div>
|
||||||
@@ -496,6 +529,12 @@ export function VirtualMachines() {
|
|||||||
<div className="text-xs text-muted-foreground mb-1">VMID</div>
|
<div className="text-xs text-muted-foreground mb-1">VMID</div>
|
||||||
<div className="font-semibold text-foreground">{selectedVM.vmid}</div>
|
<div className="font-semibold text-foreground">{selectedVM.vmid}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{selectedVM.type === "lxc" && selectedVM.ipaddress && (
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-muted-foreground mb-1">IP Address</div>
|
||||||
|
<div className="font-semibold text-blue-500 font-mono">{selectedVM.ipaddress}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-muted-foreground mb-1">CPU Usage</div>
|
<div className="text-xs text-muted-foreground mb-1">CPU Usage</div>
|
||||||
<div
|
<div
|
||||||
@@ -532,7 +571,7 @@ export function VirtualMachines() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-muted-foreground mb-1">Uptime</div>
|
<div className="text-xs text-muted-foreground mb-1">Uptime</div>
|
||||||
<div className="font-semibold text-foreground">{formatUptime(selectedVM.uptime)}</div>
|
<div className="text-lg font-semibold text-foreground">{formatUptime(selectedVM.uptime)}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className="text-xs text-muted-foreground mb-1">Disk I/O</div>
|
<div className="text-xs text-muted-foreground mb-1">Disk I/O</div>
|
||||||
|
Reference in New Issue
Block a user