mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-10 20:06:18 +00:00
Update AppImage
This commit is contained in:
@@ -368,8 +368,26 @@ export function NetworkMetrics() {
|
||||
{typeBadge.label}
|
||||
</Badge>
|
||||
{interface_.bridge_physical_interface && (
|
||||
<div className="text-sm text-blue-500 font-medium">
|
||||
<div className="text-sm text-blue-500 font-medium flex items-center gap-1">
|
||||
→ {interface_.bridge_physical_interface}
|
||||
{interface_.bridge_physical_interface.startsWith("bond") &&
|
||||
networkData.physical_interfaces && (
|
||||
<>
|
||||
{(() => {
|
||||
const bondInterface = networkData.physical_interfaces.find(
|
||||
(iface) => iface.name === interface_.bridge_physical_interface,
|
||||
)
|
||||
if (bondInterface?.bond_slaves && bondInterface.bond_slaves.length > 0) {
|
||||
return (
|
||||
<span className="text-muted-foreground text-xs">
|
||||
({bondInterface.bond_slaves.join(", ")})
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return null
|
||||
})()}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -477,12 +495,12 @@ export function NetworkMetrics() {
|
||||
{/* Second row: Details - Responsive layout */}
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
|
||||
<div>
|
||||
<div className="text-muted-foreground text-xs">VMID</div>
|
||||
<div className="text-sm text-muted-foreground">VMID</div>
|
||||
<div className="font-medium">{interface_.vmid ?? "N/A"}</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div className="text-muted-foreground text-xs">Speed</div>
|
||||
<div className="text-sm text-muted-foreground">Speed</div>
|
||||
<div className="font-medium text-foreground flex items-center gap-1">
|
||||
<Zap className="h-3 w-3" />
|
||||
{formatSpeed(interface_.speed)}
|
||||
@@ -490,7 +508,7 @@ export function NetworkMetrics() {
|
||||
</div>
|
||||
|
||||
<div className="col-span-2 md:col-span-1">
|
||||
<div className="text-muted-foreground text-xs">Traffic</div>
|
||||
<div className="text-sm text-muted-foreground">Traffic</div>
|
||||
<div className="font-medium text-foreground text-xs">
|
||||
<span className="text-green-500">↓ {formatBytes(interface_.bytes_recv)}</span>
|
||||
{" / "}
|
||||
@@ -500,7 +518,7 @@ export function NetworkMetrics() {
|
||||
|
||||
{interface_.mac_address && (
|
||||
<div className="col-span-2 md:col-span-1">
|
||||
<div className="text-muted-foreground text-xs">MAC</div>
|
||||
<div className="text-sm text-muted-foreground">MAC</div>
|
||||
<div className="font-medium text-foreground font-mono text-xs truncate">
|
||||
{interface_.mac_address}
|
||||
</div>
|
||||
|
@@ -6,7 +6,6 @@ import { Badge } from "./ui/badge"
|
||||
import { Progress } from "./ui/progress"
|
||||
import { Button } from "./ui/button"
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog"
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs"
|
||||
import {
|
||||
Server,
|
||||
Play,
|
||||
@@ -427,48 +426,35 @@ export function VirtualMachines() {
|
||||
setVMDetails(null)
|
||||
}}
|
||||
>
|
||||
<DialogContent className="max-w-3xl max-h-[85vh] overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogContent className="max-w-3xl max-h-[90vh] overflow-hidden flex flex-col">
|
||||
<DialogHeader className="flex-shrink-0 pb-4 border-b border-border">
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Server className="h-5 w-5" />
|
||||
{selectedVM?.name} - Details
|
||||
{selectedVM?.name}
|
||||
{selectedVM && (
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<Badge variant="outline" className={getTypeBadge(selectedVM.type).color}>
|
||||
{getTypeBadge(selectedVM.type).label}
|
||||
</Badge>
|
||||
<Badge variant="outline" className={getStatusColor(selectedVM.status)}>
|
||||
{selectedVM.status.toUpperCase()}
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{selectedVM && (
|
||||
<Tabs defaultValue="basic" className="w-full">
|
||||
<TabsList className="grid w-full grid-cols-4">
|
||||
<TabsTrigger value="basic">Basic</TabsTrigger>
|
||||
<TabsTrigger value="resources">Resources</TabsTrigger>
|
||||
<TabsTrigger value="network">Network</TabsTrigger>
|
||||
<TabsTrigger value="options">Options</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
{/* Basic Information Tab */}
|
||||
<TabsContent value="basic" className="space-y-6">
|
||||
<div className="flex-1 overflow-y-auto space-y-6 py-4">
|
||||
{selectedVM && (
|
||||
<>
|
||||
{/* Basic Information */}
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Basic Information</h3>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Name</div>
|
||||
<div className="font-medium text-foreground">{selectedVM.name}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Type</div>
|
||||
<Badge variant="outline" className={getTypeBadge(selectedVM.type).color}>
|
||||
{getTypeBadge(selectedVM.type).label}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">VMID</div>
|
||||
<div className="font-medium text-foreground">{selectedVM.vmid}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Status</div>
|
||||
<Badge variant="outline" className={getStatusColor(selectedVM.status)}>
|
||||
{selectedVM.status.toUpperCase()}
|
||||
</Badge>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">CPU Usage</div>
|
||||
<div className="font-medium text-foreground">{(selectedVM.cpu * 100).toFixed(1)}%</div>
|
||||
@@ -492,6 +478,169 @@ export function VirtualMachines() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Resources Configuration */}
|
||||
{detailsLoading ? (
|
||||
<div className="text-center py-8 text-muted-foreground">Loading configuration...</div>
|
||||
) : vmDetails?.config ? (
|
||||
<>
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Resources</h3>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{vmDetails.config.cores && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">CPU Cores</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.cores}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.sockets && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">CPU Sockets</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.sockets}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.memory && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Memory</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.memory} MB</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.swap && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Swap</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.swap} MB</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.rootfs && (
|
||||
<div className="col-span-1 sm:col-span-2">
|
||||
<div className="text-sm text-muted-foreground">Root Filesystem</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">
|
||||
{vmDetails.config.rootfs}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.scsi0 && (
|
||||
<div className="col-span-1 sm:col-span-2">
|
||||
<div className="text-sm text-muted-foreground">SCSI Disk 0</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">
|
||||
{vmDetails.config.scsi0}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.ide0 && (
|
||||
<div className="col-span-1 sm:col-span-2">
|
||||
<div className="text-sm text-muted-foreground">IDE Disk 0</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.ide0}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Network Configuration */}
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Network</h3>
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
{vmDetails.config.net0 && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Network Interface 0</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.net0}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.net1 && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Network Interface 1</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.net1}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.net2 && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Network Interface 2</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.net2}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.nameserver && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">DNS Nameserver</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.nameserver}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.searchdomain && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Search Domain</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.searchdomain}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.hostname && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Hostname</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.hostname}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Options */}
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Options</h3>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{vmDetails.config.onboot !== undefined && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Start on Boot</div>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={
|
||||
vmDetails.config.onboot
|
||||
? "bg-green-500/10 text-green-500"
|
||||
: "bg-red-500/10 text-red-500"
|
||||
}
|
||||
>
|
||||
{vmDetails.config.onboot ? "Yes" : "No"}
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.unprivileged !== undefined && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Unprivileged</div>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={
|
||||
vmDetails.config.unprivileged
|
||||
? "bg-green-500/10 text-green-500"
|
||||
: "bg-yellow-500/10 text-yellow-500"
|
||||
}
|
||||
>
|
||||
{vmDetails.config.unprivileged ? "Yes" : "No"}
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.ostype && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">OS Type</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.ostype}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.arch && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Architecture</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.arch}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.boot && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Boot Order</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.boot}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.features && (
|
||||
<div className="col-span-1 sm:col-span-2">
|
||||
<div className="text-sm text-muted-foreground">Features</div>
|
||||
<div className="font-medium text-foreground text-sm">{vmDetails.config.features}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{/* Control Actions */}
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-muted-foreground mb-3">Control Actions</h3>
|
||||
@@ -546,181 +695,9 @@ export function VirtualMachines() {
|
||||
Download Logs
|
||||
</Button>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
{/* Resources Tab */}
|
||||
<TabsContent value="resources" className="space-y-4">
|
||||
{detailsLoading ? (
|
||||
<div className="text-center py-8 text-muted-foreground">Loading configuration...</div>
|
||||
) : vmDetails?.config ? (
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{vmDetails.config.cores && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">CPU Cores</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.cores}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.sockets && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">CPU Sockets</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.sockets}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.memory && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Memory</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.memory} MB</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.swap && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Swap</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.swap} MB</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.rootfs && (
|
||||
<div className="col-span-2">
|
||||
<div className="text-sm text-muted-foreground">Root Filesystem</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.rootfs}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.scsi0 && (
|
||||
<div className="col-span-2">
|
||||
<div className="text-sm text-muted-foreground">SCSI Disk 0</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.scsi0}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.ide0 && (
|
||||
<div className="col-span-2">
|
||||
<div className="text-sm text-muted-foreground">IDE Disk 0</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.ide0}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-8 text-muted-foreground">No configuration data available</div>
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
{/* Network Tab */}
|
||||
<TabsContent value="network" className="space-y-4">
|
||||
{detailsLoading ? (
|
||||
<div className="text-center py-8 text-muted-foreground">Loading configuration...</div>
|
||||
) : vmDetails?.config ? (
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
{vmDetails.config.net0 && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Network Interface 0</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.net0}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.net1 && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Network Interface 1</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.net1}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.net2 && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Network Interface 2</div>
|
||||
<div className="font-medium text-foreground text-sm break-all">{vmDetails.config.net2}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.nameserver && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">DNS Nameserver</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.nameserver}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.searchdomain && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Search Domain</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.searchdomain}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.hostname && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Hostname</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.hostname}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-8 text-muted-foreground">No network configuration available</div>
|
||||
)}
|
||||
</TabsContent>
|
||||
|
||||
{/* Options Tab */}
|
||||
<TabsContent value="options" className="space-y-4">
|
||||
{detailsLoading ? (
|
||||
<div className="text-center py-8 text-muted-foreground">Loading configuration...</div>
|
||||
) : vmDetails?.config ? (
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{vmDetails.config.onboot !== undefined && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Start on Boot</div>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={
|
||||
vmDetails.config.onboot ? "bg-green-500/10 text-green-500" : "bg-red-500/10 text-red-500"
|
||||
}
|
||||
>
|
||||
{vmDetails.config.onboot ? "Yes" : "No"}
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.unprivileged !== undefined && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Unprivileged</div>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={
|
||||
vmDetails.config.unprivileged
|
||||
? "bg-green-500/10 text-green-500"
|
||||
: "bg-yellow-500/10 text-yellow-500"
|
||||
}
|
||||
>
|
||||
{vmDetails.config.unprivileged ? "Yes" : "No"}
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.ostype && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">OS Type</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.ostype}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.arch && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Architecture</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.arch}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.boot && (
|
||||
<div>
|
||||
<div className="text-sm text-muted-foreground">Boot Order</div>
|
||||
<div className="font-medium text-foreground">{vmDetails.config.boot}</div>
|
||||
</div>
|
||||
)}
|
||||
{vmDetails.config.features && (
|
||||
<div className="col-span-2">
|
||||
<div className="text-sm text-muted-foreground">Features</div>
|
||||
<div className="font-medium text-foreground text-sm">{vmDetails.config.features}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-8 text-muted-foreground">No options available</div>
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
|
@@ -1489,23 +1489,16 @@ def api_vm_logs(vmid):
|
||||
|
||||
# Get real logs from the container/VM (last 1000 lines)
|
||||
log_result = subprocess.run(
|
||||
['pvesh', 'get', f'/nodes/{node}/{vm_type}/{vmid}/log', '--limit', '1000', '--output-format', 'json'],
|
||||
['pvesh', 'get', f'/nodes/{node}/{vm_type}/{vmid}/log', '--start', '0', '--limit', '1000'],
|
||||
capture_output=True, text=True, timeout=10
|
||||
)
|
||||
|
||||
logs = []
|
||||
if log_result.returncode == 0:
|
||||
try:
|
||||
log_data = json.loads(log_result.stdout)
|
||||
# The API returns an array of log line objects
|
||||
if isinstance(log_data, list):
|
||||
logs = log_data
|
||||
else:
|
||||
# Fallback: parse as text
|
||||
logs = [{'n': i, 't': line} for i, line in enumerate(log_result.stdout.split('\n')) if line]
|
||||
except json.JSONDecodeError:
|
||||
# Parse as plain text if JSON fails
|
||||
logs = [{'n': i, 't': line} for i, line in enumerate(log_result.stdout.split('\n')) if line]
|
||||
# Parse as plain text (each line is a log entry)
|
||||
for i, line in enumerate(log_result.stdout.split('\n')):
|
||||
if line.strip():
|
||||
logs.append({'n': i, 't': line})
|
||||
|
||||
return jsonify({
|
||||
'vmid': vmid,
|
||||
|
Reference in New Issue
Block a user