mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 11:36:17 +00:00
Update virtual-machines.tsx
This commit is contained in:
@@ -397,7 +397,7 @@ export function VirtualMachines() {
|
|||||||
<Server className="h-4 w-4 text-muted-foreground" />
|
<Server className="h-4 w-4 text-muted-foreground" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold text-foreground">{safeVMData.length}</div>
|
<div className="text-xl lg:text-2xl font-bold text-foreground">{safeVMData.length}</div>
|
||||||
<div className="vm-badges mt-2">
|
<div className="vm-badges mt-2">
|
||||||
<Badge variant="outline" className="vm-badge bg-green-500/10 text-green-500 border-green-500/20">
|
<Badge variant="outline" className="vm-badge bg-green-500/10 text-green-500 border-green-500/20">
|
||||||
{safeVMData.filter((vm) => vm.status === "running").length} Running
|
{safeVMData.filter((vm) => vm.status === "running").length} Running
|
||||||
@@ -416,7 +416,7 @@ export function VirtualMachines() {
|
|||||||
<Cpu className="h-4 w-4 text-muted-foreground" />
|
<Cpu className="h-4 w-4 text-muted-foreground" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold text-foreground">
|
<div className="text-xl lg:text-2xl font-bold text-foreground">
|
||||||
{(safeVMData.reduce((sum, vm) => sum + (vm.cpu || 0), 0) * 100).toFixed(0)}%
|
{(safeVMData.reduce((sum, vm) => sum + (vm.cpu || 0), 0) * 100).toFixed(0)}%
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground mt-2">Allocated CPU usage</p>
|
<p className="text-xs text-muted-foreground mt-2">Allocated CPU usage</p>
|
||||||
@@ -432,7 +432,7 @@ export function VirtualMachines() {
|
|||||||
{/* Memory Usage (current) */}
|
{/* Memory Usage (current) */}
|
||||||
{physicalMemoryGB !== null && usedMemoryGB !== null && memoryUsagePercent !== null ? (
|
{physicalMemoryGB !== null && usedMemoryGB !== null && memoryUsagePercent !== null ? (
|
||||||
<div>
|
<div>
|
||||||
<div className="text-2xl font-bold text-foreground">{usedMemoryGB.toFixed(1)} GB</div>
|
<div className="text-xl lg:text-2xl font-bold text-foreground">{usedMemoryGB.toFixed(1)} GB</div>
|
||||||
<div className="text-xs text-muted-foreground mt-1">
|
<div className="text-xs text-muted-foreground mt-1">
|
||||||
<span className={getMemoryPercentTextColor(memoryUsagePercent)}>
|
<span className={getMemoryPercentTextColor(memoryUsagePercent)}>
|
||||||
{memoryUsagePercent.toFixed(1)}%
|
{memoryUsagePercent.toFixed(1)}%
|
||||||
@@ -443,7 +443,7 @@ export function VirtualMachines() {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<div className="text-2xl font-bold text-muted-foreground">--</div>
|
<div className="text-xl lg:text-2xl font-bold text-muted-foreground">--</div>
|
||||||
<div className="text-xs text-muted-foreground mt-1">Loading memory usage...</div>
|
<div className="text-xs text-muted-foreground mt-1">Loading memory usage...</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -479,7 +479,7 @@ export function VirtualMachines() {
|
|||||||
<HardDrive className="h-4 w-4 text-muted-foreground" />
|
<HardDrive className="h-4 w-4 text-muted-foreground" />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="text-2xl font-bold text-foreground">
|
<div className="text-xl lg:text-2xl font-bold text-foreground">
|
||||||
{formatStorage(safeVMData.reduce((sum, vm) => sum + (vm.maxdisk || 0), 0) / 1024 ** 3)}
|
{formatStorage(safeVMData.reduce((sum, vm) => sum + (vm.maxdisk || 0), 0) / 1024 ** 3)}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground mt-2">Allocated disk space</p>
|
<p className="text-xs text-muted-foreground mt-2">Allocated disk space</p>
|
||||||
@@ -488,9 +488,9 @@ export function VirtualMachines() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card className="bg-card border-border">
|
<Card className="bg-card border-border">
|
||||||
<CardHeader>
|
<CardHeader className="flex flex-row items-center justify-between">
|
||||||
<CardTitle className="text-foreground flex items-center">
|
<CardTitle className="flex items-center gap-2 text-xl lg:text-2xl font-bold text-foreground">
|
||||||
<Server className="h-5 w-5 mr-2" />
|
<Server className="h-6 w-6" />
|
||||||
Virtual Machines & Containers
|
Virtual Machines & Containers
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
@@ -623,15 +623,42 @@ export function VirtualMachines() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-2 flex-shrink-0">
|
<div className="flex items-center gap-3 flex-shrink-0">
|
||||||
{/* CPU icon - color based on usage */}
|
{/* CPU icon with percentage */}
|
||||||
<Cpu className={`h-4 w-4 ${getIconColor(Number.parseFloat(cpuPercent))}`} />
|
<div className="flex flex-col items-center gap-0.5">
|
||||||
|
{vm.status === "running" && (
|
||||||
|
<span className="text-[10px] font-medium text-muted-foreground">{cpuPercent}%</span>
|
||||||
|
)}
|
||||||
|
<Cpu
|
||||||
|
className={`h-4 w-4 ${
|
||||||
|
vm.status === "stopped" ? "text-gray-500" : getIconColor(Number.parseFloat(cpuPercent))
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Memory icon - color based on usage */}
|
{/* Memory icon with percentage */}
|
||||||
<MemoryStick className={`h-4 w-4 ${getIconColor(Number.parseFloat(memPercent))}`} />
|
<div className="flex flex-col items-center gap-0.5">
|
||||||
|
{vm.status === "running" && (
|
||||||
|
<span className="text-[10px] font-medium text-muted-foreground">{memPercent}%</span>
|
||||||
|
)}
|
||||||
|
<MemoryStick
|
||||||
|
className={`h-4 w-4 ${
|
||||||
|
vm.status === "stopped" ? "text-gray-500" : getIconColor(Number.parseFloat(memPercent))
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Disk icon - color based on usage */}
|
{/* Disk icon with percentage */}
|
||||||
<HardDrive className={`h-4 w-4 ${getIconColor(Number.parseFloat(diskPercent))}`} />
|
<div className="flex flex-col items-center gap-0.5">
|
||||||
|
{vm.status === "running" && (
|
||||||
|
<span className="text-[10px] font-medium text-muted-foreground">{diskPercent}%</span>
|
||||||
|
)}
|
||||||
|
<HardDrive
|
||||||
|
className={`h-4 w-4 ${
|
||||||
|
vm.status === "stopped" ? "text-gray-500" : getIconColor(Number.parseFloat(diskPercent))
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user