diff --git a/AppImage/components/virtual-machines.tsx b/AppImage/components/virtual-machines.tsx index c052002..9f97efc 100644 --- a/AppImage/components/virtual-machines.tsx +++ b/AppImage/components/virtual-machines.tsx @@ -20,6 +20,7 @@ import { Container, } from "lucide-react" import useSWR from "swr" +import { MetricsDialog } from "./metrics-dialog" interface VMData { vmid: number @@ -184,6 +185,8 @@ export function VirtualMachines() { const [controlLoading, setControlLoading] = useState(false) const [detailsLoading, setDetailsLoading] = useState(false) const [vmConfigs, setVmConfigs] = useState>({}) + const [metricsDialogOpen, setMetricsDialogOpen] = useState(false) + const [selectedMetric, setSelectedMetric] = useState<"cpu" | "memory" | "disk" | "network" | null>(null) useEffect(() => { const fetchLXCIPs = async () => { @@ -540,37 +543,65 @@ export function VirtualMachines() {
CPU Usage
-
- {cpuPercent}% +
{ + setSelectedMetric("cpu") + setMetricsDialogOpen(true) + }} + > +
+ {cpuPercent}% +
+
-
Memory
-
- {memGB} / {maxMemGB} GB +
{ + setSelectedMetric("memory") + setMetricsDialogOpen(true) + }} + > +
+ {memGB} / {maxMemGB} GB +
+
-
Disk Usage
{ + setSelectedMetric("disk") + setMetricsDialogOpen(true) + }} > - {diskGB} / {maxDiskGB} GB +
+ {diskGB} / {maxDiskGB} GB +
+
-
@@ -718,37 +749,62 @@ export function VirtualMachines() {
CPU Usage
-
- {(selectedVM.cpu * 100).toFixed(1)}% +
{ + setSelectedMetric("cpu") + setMetricsDialogOpen(true) + }} + > +
+ {(selectedVM.cpu * 100).toFixed(1)}% +
+
-
Memory
{ + setSelectedMetric("memory") + setMetricsDialogOpen(true) + }} > - {(selectedVM.mem / 1024 ** 3).toFixed(1)} / {(selectedVM.maxmem / 1024 ** 3).toFixed(1)} GB +
+ {(selectedVM.mem / 1024 ** 3).toFixed(1)} / {(selectedVM.maxmem / 1024 ** 3).toFixed(1)} GB +
+
-
Disk
{ + setSelectedMetric("disk") + setMetricsDialogOpen(true) + }} > - {(selectedVM.disk / 1024 ** 3).toFixed(1)} / {(selectedVM.maxdisk / 1024 ** 3).toFixed(1)} GB +
+ {(selectedVM.disk / 1024 ** 3).toFixed(1)} / {(selectedVM.maxdisk / 1024 ** 3).toFixed(1)}{" "} + GB +
+
-
Uptime
@@ -756,23 +812,39 @@ export function VirtualMachines() {
Disk I/O
-
-
- ↓ {formatBytes(selectedVM.diskread)} +
{ + setSelectedMetric("disk") + setMetricsDialogOpen(true) + }} + > +
+ + {((selectedVM.diskread || 0) / 1024 ** 2).toFixed(2)} MB
-
- ↑ {formatBytes(selectedVM.diskwrite)} +
+ + {((selectedVM.diskwrite || 0) / 1024 ** 2).toFixed(2)} MB
Network I/O
-
-
- ↓ {formatBytes(selectedVM.netin)} +
{ + setSelectedMetric("network") + setMetricsDialogOpen(true) + }} + > +
+ + {((selectedVM.netin || 0) / 1024 ** 2).toFixed(2)} MB
-
- ↑ {formatBytes(selectedVM.netout)} +
+ + {((selectedVM.netout || 0) / 1024 ** 2).toFixed(2)} MB
@@ -978,18 +1050,25 @@ export function VirtualMachines() { Force Stop -
+ + {/* MetricsDialog component usage */} + {selectedVM && selectedMetric && ( + { + setMetricsDialogOpen(false) + setSelectedMetric(null) + }} + vmid={selectedVM.vmid} + vmName={selectedVM.name} + vmType={selectedVM.type} + metricType={selectedMetric} + /> + )}
) } diff --git a/AppImage/public/apple-touch-icon.png b/AppImage/public/apple-touch-icon.png index e685b28..7853452 100644 Binary files a/AppImage/public/apple-touch-icon.png and b/AppImage/public/apple-touch-icon.png differ diff --git a/AppImage/public/apple-touch-icon2.png b/AppImage/public/apple-touch-icon2.png deleted file mode 100644 index fcdbf43..0000000 Binary files a/AppImage/public/apple-touch-icon2.png and /dev/null differ